mha for mysql の話
DESCRIPTION
TRANSCRIPT
me•Masahiro Nagano• @kazeburo• NHN Japan• Operations EngineerSite Reliability 運用系小姑Perl Monger
2013年3月8日金曜日
MHA for MySQLとは• 元DeNA・現facebookの松信さんによるMySQLのmaster冗長化ツール
• Master High Availability の略• MySQLサーバを監視してのフェイルオーバーとオンラインでのマスター切り替えをサポート
• Proxy型ではないのでSPOFにならない• サーバの切り替えは別スクリプトを起動
2013年3月8日金曜日
MHAの構成
dbm
dbs1
dbs2
mha-node
mha-node
mha-node
manager
masterha-manager
ssh/mysql
master_ip_failover_script!!
2013年3月8日金曜日
MHAの構成
dbm
dbs1
dbs2
mha-node
mha-node
mha-node
manager
masterha-manager
ssh/mysql
master_ip_failover_script!!
DNS
2013年3月8日金曜日
local DNS 構成
©2011 Amazon Web Services LLC or its affiliates. All rights reserved.
Amazon Elastic Compute Cloud (Amazon EC2)
Compute
Instance AMI DB on Instance Elastic IP
Amazon Elastic MapReduce
Cluster HDFS Cluster
Instancewith CloudWatch
Storage
Amazon Simple Storage Service (Amazon S3)
Bucket ObjectBucket with Objects
Amazon Elastic MapReduce
Amazon Elastic Compute Cloud
(EC2)
Amazon Simple Storage Service
(S3)
AWS Import/Export
AWS Import/Export
Auto Scaling
Auto Scaling
Instances
©2011 Amazon Web Services LLC or its affiliates. All rights reserved.
Amazon Elastic Compute Cloud (Amazon EC2)
Compute
Instance AMI DB on Instance Elastic IP
Amazon Elastic MapReduce
Cluster HDFS Cluster
Instancewith CloudWatch
Storage
Amazon Simple Storage Service (Amazon S3)
Bucket ObjectBucket with Objects
Amazon Elastic MapReduce
Amazon Elastic Compute Cloud
(EC2)
Amazon Simple Storage Service
(S3)
AWS Import/Export
AWS Import/Export
Auto Scaling
Auto Scaling
Instances
PDNS
PDNS
WebUI/API
replication
LVSserver
tcp/udp 53
2013年3月8日金曜日
MHA configuration[server default]user=...master_ip_failover_script=/home/user/mhaweb/masterha_failover.pl --app_name=dbm.service --mode=failover --config=/home/user/mhaweb/config_production.pl
[server1]hostname=10.xx.xx.77candidate_master=0no_master=0
[server2]hostname=10.xx.xx.49candidate_master=0no_master=0
この中でDNSの書き換え
2013年3月8日金曜日
masterha_manger$ masterha_manager --conf /var/mha/app21.conf......Tue Dec 11 14:09:22 2012 - [info] Starting ping health check on 10.xx.xx.xxx(10.xx.xx.xxx:3306)..Tue Dec 11 14:09:22 2012 - [info] Ping(SELECT) succeeded, waiting until MySQL doesn't respond..
この状態で動き続ける
わーい起動したー2013年3月8日金曜日
dbmdbs
dbs
Many services
dbmdbs
dbsdbm dbs
dbm dbs
dbmdbs
dbs
dbm dbs
manager
設定とプロセスの管理面倒2013年3月8日金曜日
MHA WebUI&Manager-+= 70422 perl mhaweb.pl --conf config_mydev.pl |--- 70424 perl mhaweb.pl --conf config_mydev.pl |-+- 70425 perl mhaweb.pl --conf config_mydev.pl | |--- 70440 perl masterha_manager --conf /tmp/app/dbm.sample/app1 | |--- 70440 perl masterha_manager --conf /tmp/app/dbm.sample/app2 | \--- 70440 perl masterha_manager --conf /tmp/app/dbm.sample/app3 \-+- 70426 perl mhaweb.pl --conf config_mydev.pl |--- 70427 perl mhaweb.pl --conf config_mydev.pl |--- 70428 perl mhaweb.pl --conf config_mydev.pl |--- 70429 perl mhaweb.pl --conf config_mydev.pl |--- 70430 perl mhaweb.pl --conf config_mydev.pl \--- 70431 perl mhaweb.pl --conf config_mydev.pl
masterha_managerのプロセス
Perl + Proclet + Custom Process Manager2013年3月8日金曜日
MHA WebUI&Manager
• 20+ のサービスで使用中• オンラインでのマスター変更にも使用
• Master障害童貞• sshの設定がいまいち• オープンソース化は予定nashi..
Pros
Cons
2013年3月8日金曜日