Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
VPCでkeepalived+LVS(DSR)
VRRPが使える?安川さんのスライドを読みました。http://www.slideshare.net/kentayasukawa/ec2-20334037
VRRPが使える?あ、VRRP通るのか…ユニキャストならkeepalived+LVSが普通に使えるんじゃね?
keepalived+unicastなんか海外のサイトを見つける…http://harish11g.blogspot.jp/2012/10/high-availability-haproxy-amazon-ec2.html
keepalived+unicast● vrrp_unicast_bind● vrrp_unicast_peerみたことない設定。本家のドキュメントにはない。本家のソースコードにもない。http://www.keepalived.org/
keepalived+unicastぐぐってたら野良パッチを見つける。http://1wt.eu/keepalived/
keepalived+unicastパッチの差分を参考にして最新版を修正してみた。● ソースコード○ https://github.com/winebarrel/keepalived● rpm○ http://bit.ly/10yLoVe
動作確認
動作確認基本情報● クライアント - curl○ dagon - 10.0.214.215● keepalived+LVS○ cthulhu(MASTER) - 10.0.214.216○ hastur(BACKUP) - 10.0.214.2...
動作確認事前準備● LVS・バックエンドのENIのSource/Dest Checkをdisabledにする● バックエンドでiptablesの設定sudo iptables -t nat -A PREROUTING -d 192.168.20...
動作確認VPCのRoute Table
動作確認 - keepalived.cnf(cthulhu)! Configuration File for keepalivedglobal_defs {router_id LVS_DEVEL}vrrp_instance VI_1 {stat...
動作確認 - keepalived.cnf(hastur)! Configuration File for keepalivedglobal_defs {router_id LVS_DEVEL}vrrp_instance VI_1 {state...
動作確認 - notify_master.sh#!/bin/bashVIP=192.168.200.16ROUTE_TABLE_ID=rtb-...INSTANCE_ID=`curl -s 169.254.169.254/latest/meta...
動作確認 - 起動してみるcthulhuhasturcthulhu> sudo /etc/init.d/keepalived startcthulhu> ip addr show | grep "global eth0"inet 10.0.21...
動作確認dagon> while true; do echo `date +%X`" | "`curl -s 192.168.200.16`; sleep 1; done05:19:46 PM | nyar OK05:19:47 PM | yo...
cthulhuのkeepalivedを殺す動作確認cthulhu> sudo killall -9 keepalived05:22:08 PM | yog OK05:22:09 PM | nyar OK05:22:10 PM | yog OK0...
keepalived と LVS の世界が戻ってきたよー!
5/4に同じネタをやっている人がいた…orzhttp://khanhman.com/?p=12
去年、MLに投稿されたようです。http://permalink.gmane.org/gmane.linux.keepalived.devel/3787その後は不明…
Upcoming SlideShare
Loading in …5
×

EC2でkeepalived+LVS(DSR)

18,486 views

Published on

Published in: Technology
  • Follow the link, new dating source: ❶❶❶ http://bit.ly/2ZDZFYj ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ❤❤❤ http://bit.ly/2ZDZFYj ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

EC2でkeepalived+LVS(DSR)

  1. 1. VPCでkeepalived+LVS(DSR)
  2. 2. VRRPが使える?安川さんのスライドを読みました。http://www.slideshare.net/kentayasukawa/ec2-20334037
  3. 3. VRRPが使える?あ、VRRP通るのか…ユニキャストならkeepalived+LVSが普通に使えるんじゃね?
  4. 4. keepalived+unicastなんか海外のサイトを見つける…http://harish11g.blogspot.jp/2012/10/high-availability-haproxy-amazon-ec2.html
  5. 5. keepalived+unicast● vrrp_unicast_bind● vrrp_unicast_peerみたことない設定。本家のドキュメントにはない。本家のソースコードにもない。http://www.keepalived.org/
  6. 6. keepalived+unicastぐぐってたら野良パッチを見つける。http://1wt.eu/keepalived/
  7. 7. keepalived+unicastパッチの差分を参考にして最新版を修正してみた。● ソースコード○ https://github.com/winebarrel/keepalived● rpm○ http://bit.ly/10yLoVe
  8. 8. 動作確認
  9. 9. 動作確認基本情報● クライアント - curl○ dagon - 10.0.214.215● keepalived+LVS○ cthulhu(MASTER) - 10.0.214.216○ hastur(BACKUP) - 10.0.214.217● バックエンド - httpd○ nyar - 10.0.214.218○ yog - 10.0.214.219● VIP○ 192.168.200.16
  10. 10. 動作確認事前準備● LVS・バックエンドのENIのSource/Dest Checkをdisabledにする● バックエンドでiptablesの設定sudo iptables -t nat -A PREROUTING -d 192.168.200.16 -j REDIRECT
  11. 11. 動作確認VPCのRoute Table
  12. 12. 動作確認 - keepalived.cnf(cthulhu)! Configuration File for keepalivedglobal_defs {router_id LVS_DEVEL}vrrp_instance VI_1 {state MASTERinterface eth0virtual_router_id 51priority 101advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.200.16}vrrp_unicast_bind 10.0.214.216vrrp_unicast_peer 10.0.214.217notify_master "/etc/keepalived/notify_master.sh"}virtual_server_group VSG_1 {192.168.200.16 80}virtual_server group VSG_1 {delay_loop 6lb_algo rrlb_kind DRprotocol TCPreal_server 10.0.214.218 80 {weight 1HTTP_GET {url {path /}}}real_server 10.0.214.219 80 {weight 1HTTP_GET {url {path /}}}}
  13. 13. 動作確認 - keepalived.cnf(hastur)! Configuration File for keepalivedglobal_defs {router_id LVS_DEVEL}vrrp_instance VI_1 {state BACKUPinterface eth0virtual_router_id 51priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.200.16}vrrp_unicast_bind 10.0.214.217vrrp_unicast_peer 10.0.214.216notify_master "/etc/keepalived/notify_master.sh"}virtual_server_group VSG_1 {192.168.200.16 80}virtual_server group VSG_1 {delay_loop 6lb_algo rrlb_kind DRprotocol TCPreal_server 10.0.214.218 80 {weight 1HTTP_GET {url {path /}}}real_server 10.0.214.219 80 {weight 1HTTP_GET {url {path /}}}}
  14. 14. 動作確認 - notify_master.sh#!/bin/bashVIP=192.168.200.16ROUTE_TABLE_ID=rtb-...INSTANCE_ID=`curl -s 169.254.169.254/latest/meta-data/instance-id`export AWS_ACCESS_KEY_ID=...export AWS_SECRET_ACCESS_KEY=...export AWS_DEFAULT_REGION=ap-northeast-1aws ec2 delete-route --destination-cidr-block $VIP/32 --route-table-id $ROUTE_TABLE_IDaws ec2 create-route --destination-cidr-block $VIP/32 --route-table-id $ROUTE_TABLE_ID --instance-id $INSTANCE_ID
  15. 15. 動作確認 - 起動してみるcthulhuhasturcthulhu> sudo /etc/init.d/keepalived startcthulhu> ip addr show | grep "global eth0"inet 10.0.214.216/17 brd 10.0.255.255 scope global eth0inet 192.168.200.16/32 scope global eth0cthulhul> sudo ipvsadm -LIP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port Scheduler Flags-> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP 192.168.200.16:http rr-> 10.0.214.218:http Route 1 0 0-> 10.0.214.219:http Route 1 0 0hastur> sudo /etc/init.d/keepalived starthastur> ip addr show | grep "global eth0"inet 10.0.214.217/17 brd 10.0.255.255 scope global eth0hastur> sudo ipvsadm -LIP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port Scheduler Flags-> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP 192.168.200.16:http rr-> 10.0.214.218:http Route 1 0 0-> 10.0.214.219:http Route 1 0 0
  16. 16. 動作確認dagon> while true; do echo `date +%X`" | "`curl -s 192.168.200.16`; sleep 1; done05:19:46 PM | nyar OK05:19:47 PM | yog OK05:19:48 PM | nyar OK05:19:49 PM | yog OK05:19:50 PM | nyar OK05:19:51 PM | yog OK05:19:52 PM | nyar OK05:19:53 PM | yog OK05:19:54 PM | nyar OK05:19:55 PM | yog OK05:19:56 PM | nyar OK05:19:57 PM | yog OK05:19:58 PM | nyar OK05:19:59 PM | yog OK05:20:00 PM | nyar OKdagonからリクエストを投げる
  17. 17. cthulhuのkeepalivedを殺す動作確認cthulhu> sudo killall -9 keepalived05:22:08 PM | yog OK05:22:09 PM | nyar OK05:22:10 PM | yog OK05:22:11 PM | nyar OK # ←このへんで殺した05:22:12 PM | yog OK05:22:13 PM | nyar OK05:22:14 PM | yog OK05:22:15 PM | nyar OKsudo killall -9 keepalivedhastur> ip addr show | grep "global eth0"inet 10.0.214.217/17 brd 10.0.255.255 scope global eth0inet 192.168.200.16/32 scope global eth0
  18. 18. keepalived と LVS の世界が戻ってきたよー!
  19. 19. 5/4に同じネタをやっている人がいた…orzhttp://khanhman.com/?p=12
  20. 20. 去年、MLに投稿されたようです。http://permalink.gmane.org/gmane.linux.keepalived.devel/3787その後は不明…

×