설치 하기 관련 사이트
http://code.google.com/p/mysql-master-ha/
위 사이트에서 관련 프로그램및 인스톨 가이드를 받을 수 있음
동작 방식
1) Master 노드의 VIP down
2) Master 노드의 서버 강제 shutdown (마스터노드 O/S 또는 네트워크 장애 시)
3) 가장 최신의 로그를 갖고 있는 슬레이브 노드를 후보 마스터로 선정
4) 후보 마스터의 최신 로그를 다른 슬레이브 노드에 적용 및 동기화
5) 후보 마스터 노드에 VIP up
6) 후보 마스터 노드를 마스터 노드로 변경(서비스 시작)
7) 다른 슬레이브 로그 변경분 반영 후 변경된 마스터로 복제 재시작
#ping interval, 3 times trial (5초에 3번 select ping 체크)
ping_interval=5
failover 시 걸리는 시간 (10-30초)
node (MASTER, SLAVE server 에서 설치)
## If you have not installed DBD::mysql, install it like below, or install from source.
# yum install perl-DBD-MySQL
## Get MHA Node rpm package from "Downloads" section.
# rpm -ivh mha4mysql-node-X.Y-0.noarch.rpm
키 값 생성 하기
[root@mha_manager .ssh]# ssh-keygen -b 1024 -t rsa (그냥 모두 enter 로)
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): // 인증 파일 생성 위치
Enter passphrase (empty for no passphrase): // 암호입력
Enter same passphrase again: // 암호확인
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
f2:7b:0b:7e:64:df:5a:a4:12:6f:e5:14:91:34:08:cd root@ mha_manager
The key's randomart image is:
+--[ RSA 1024]----+
| .+ o+. |
| E .o |
| . |
| . |
키값 구성하기 ( 각서버에서 같은 그룹내로 접속 가능하도록 구성)
이슈 SSH 접속을 비번없이 가능하게 하기 위해 키를 교환함
manager -> node 1 , node 2
node1 -> node2, manager
node2 -> node 1, manager
[root@adb1 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsISFYyapi5m5ybivhAGt8tylPBMqTrfaMWYJz6jisUAq5zDP5WOSBdrbf6ByvJAAMcwmqHroEVMVdAGxa3W8+By7RSJgHwUKoOncY9yFItgU7iAGZQyjP5HUCt0Qcd4ixI4VV5zB3ECk49UgKknxTWRVpHE+C99dwzdM2Xrp/8jWTNv1oREOvJZWbgRQevqlEVC2XC3MKAQcVPcS/D/xrXA3XoDbg/07OfcrQc+mzPzK2Grqu7+WVU69aJf4ZEFIKtEHnwzdGtTkEya2kzSolXefF1XiipH0MWsJ5sUaYwaScsnhAHl2/JHN/Iq8nrVYyI9dqJ0UBdn6qE+47oowNw== root@afile
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAqYt25vrpjwwJJHm+MNiuruR03bGpGC6mCH4P6A7P8pnJmfcXZIq17hBu9iASYRwj4hOifNefUw1DAxADVIaNpDFOSO9UG08k2eMqjA72N7Kym+1ipT7GIj2rspxqWmwUI9QvRA9RbtzL9JwMoOYOY0ajtbXE8Jl9pX6Y21qEuBE= root@adb2
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA0fJzCB9ujpySGAwq8PPX8dQWlNuwIX11p4OYWMCmn0AG46B3XcdH7Gmrr++UMgaUDUCU9zuiScnr0aUoNTxn6FMwbXDdXpqfRVqCpcN8qTT40wh6A3HkD8+i2EfB7g+L8l0goknLuViZJOt+DZd8cz6SOM2aDVRN/zWwL0s9fOM= root@adb1
manager(manager 서버에 설치)
관련 라이브러리 설치
## Install dependent Perl modules
# yum install perl-DBD-MySQL
# yum install perl-Config-Tiny
# yum install perl-Log-Dispatch
# yum install perl-Parallel-ForkManager
## Install MHA Node, since MHA Manager uses some modules provided by MHA Node.
[root@adb1 log]# rpm -ivh mha4mysql-node-X.Y-0.noarch.rpm
[root@adb1 log]# rpm -ql mha4mysql-node-0.54-0.el6.noarch
/usr/bin/apply_diff_relay_logs
/usr/bin/filter_mysqlbinlog
/usr/bin/purge_relay_logs
/usr/bin/save_binary_logs
/usr/share/man/man1/apply_diff_relay_logs.1.gz
/usr/share/man/man1/filter_mysqlbinlog.1.gz
/usr/share/man/man1/purge_relay_logs.1.gz
/usr/share/man/man1/save_binary_logs.1.gz
/usr/share/perl5/vendor_perl/MHA/BinlogHeaderParser.pm
/usr/share/perl5/vendor_perl/MHA/BinlogManager.pm
/usr/share/perl5/vendor_perl/MHA/BinlogPosFindManager.pm
/usr/share/perl5/vendor_perl/MHA/BinlogPosFinder.pm
/usr/share/perl5/vendor_perl/MHA/BinlogPosFinderElp.pm
/usr/share/perl5/vendor_perl/MHA/BinlogPosFinderXid.pm
/usr/share/perl5/vendor_perl/MHA/NodeConst.pm
/usr/share/perl5/vendor_perl/MHA/NodeUtil.pm
/usr/share/perl5/vendor_perl/MHA/SlaveUtil.pm
## Finally you can install MHA Manager
[root@adb1 log]# rpm -ivh mha4mysql-manager-X.Y-0.noarch.rpm
[root@adb1 log]# rpm -ql mha4mysql-manager-0.55-0.el6.noarch
/usr/bin/masterha_check_repl
/usr/bin/masterha_check_ssh
/usr/bin/masterha_check_status
/usr/bin/masterha_conf_host
/usr/bin/masterha_manager
/usr/bin/masterha_master_monitor
/usr/bin/masterha_master_switch
/usr/bin/masterha_secondary_check
/usr/bin/masterha_stop
/usr/share/man/man1/masterha_check_repl.1.gz
/usr/share/man/man1/masterha_check_ssh.1.gz
/usr/share/man/man1/masterha_check_status.1.gz
/usr/share/man/man1/masterha_conf_host.1.gz
/usr/share/man/man1/masterha_manager.1.gz
/usr/share/man/man1/masterha_master_monitor.1.gz
/usr/share/man/man1/masterha_master_switch.1.gz
/usr/share/man/man1/masterha_secondary_check.1.gz
/usr/share/man/man1/masterha_stop.1.gz
/usr/share/perl5/vendor_perl/MHA/Config.pm
/usr/share/perl5/vendor_perl/MHA/DBHelper.pm
/usr/share/perl5/vendor_perl/MHA/FileStatus.pm
/usr/share/perl5/vendor_perl/MHA/HealthCheck.pm
/usr/share/perl5/vendor_perl/MHA/ManagerAdmin.pm
/usr/share/perl5/vendor_perl/MHA/ManagerAdminWrapper.pm
/usr/share/perl5/vendor_perl/MHA/ManagerConst.pm
/usr/share/perl5/vendor_perl/MHA/ManagerUtil.pm
/usr/share/perl5/vendor_perl/MHA/MasterFailover.pm
/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm
/usr/share/perl5/vendor_perl/MHA/MasterRotate.pm
/usr/share/perl5/vendor_perl/MHA/SSHCheck.pm
/usr/share/perl5/vendor_perl/MHA/Server.pm
/usr/share/perl5/vendor_perl/MHA/ServerManager.pm
configuration
manager_host$ cat /etc/masterha_default.cnf
[server default]
user=root
password=""
ssh_user=root
master_binlog_dir= /usr/local/mysql/data
remote_workdir=/var/log/masterha/app1
secondary_check_script= masterha_secondary_check -s remote_host1 -s remote_host2
ping_interval=3
#master_ip_failover_script=/script/masterha/master_ip_failover (표준안에는 해당사항이 설정됨)
#shutdown_script= /script/masterha/power_manager
#report_script= /script/masterha/send_master_failover_mail
manager_host$ cat /etc/app1.cnf
[server default]
# working directory on the manager
manager_workdir=/var/log/masterha/app1
# manager log file
manager_log=/var/log/masterha/app/app1.log
[server1]
hostname=sv1
[server2]
hostname=sv2
MHA 매니저 실행 중지 하기
# masterha_manager --conf=/etc/conf/masterha/app1.cnf ###매니저 실행 명령어
# manager_host$ masterha_stop --conf=/etc/app1.cnf ### 매니저 중지 명령어
키 값이 제대로 구성되어 있는지 확인
# masterha_check_ssh --conf=/etc/app1.cnf
Sat May 14 14:42:19 2011 - [warn] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sat May 14 14:42:19 2011 - [info] Reading application default configurations from /etc/app1.cnf..
Sat May 14 14:42:19 2011 - [info] Reading server configurations from /etc/app1.cnf..
Sat May 14 14:42:19 2011 - [info] Starting SSH connection tests..
Sat May 14 14:42:19 2011 - [debug] Connecting via SSH from root@host1(192.168.0.1) to root@host2(192.168.0.2)..
Sat May 14 14:42:20 2011 - [debug] ok.
Sat May 14 14:42:20 2011 - [debug] Connecting via SSH from root@host1(192.168.0.1) to root@host3(192.168.0.3)..
Sat May 14 14:42:20 2011 - [debug] ok. Sat May 14 14:42:21 2011 - [debug] Connecting via SSH from root@host2(192.168.0.2) to root@host1(192.168.0.1)..
Sat May 14 14:42:21 2011 - [debug] ok. Sat May 14 14:42:21 2011 - [debug] Connecting via SSH from root@host2(192.168.0.2) to root@host3(192.168.0.3)..
Sat May 14 14:42:21 2011 - [debug] ok. Sat May 14 14:42:22 2011 - [debug] Connecting via SSH from root@host3(192.168.0.3) to root@host1(192.168.0.1)..
Sat May 14 14:42:22 2011 - [debug] ok. Sat May 14 14:42:22 2011 - [debug] Connecting via SSH from root@host3(192.168.0.3) to root@host2(192.168.0.2)..
Sat May 14 14:42:22 2011 - [debug] ok. Sat May 14 14:42:22 2011 - [info] All SSH connection tests passed successfully.
MySQL Replication Health check 하기
.
[root@sv3 bin]# masterha_check_repl --conf=/etc/app1.cnf
Wed Jul 31 11:28:20 2013 - [info] Reading default configuratoins from /etc/masterha_default.cnf..
Wed Jul 31 11:28:20 2013 - [info] Reading application default configurations from /etc/app.cnf..
Wed Jul 31 11:28:20 2013 - [info] Reading server configurations from /etc/app.cnf..
Wed Jul 31 11:28:20 2013 - [info] MHA::MasterMonitor version 0.52.
Wed Jul 31 11:28:20 2013 - [debug] Connecting to servers..
Wed Jul 31 11:28:24 2013 - [debug] Connected to: sv1(192.168.0.3:3306), user=root
Wed Jul 31 11:28:36 2013 - [debug] Connected to: sv2(192.168.0.4:3306), user=root
Wed Jul 31 11:28:36 2013 - [debug] Comparing MySQL versions..
Wed Jul 31 11:28:36 2013 - [debug] Comparing MySQL versions done.
Wed Jul 31 11:28:36 2013 - [debug] Connecting to servers done.
Wed Jul 31 11:28:36 2013 - [info] Dead Servers:
Wed Jul 31 11:28:36 2013 - [info] Alive Servers:
Wed Jul 31 11:28:36 2013 - [info] sv1(192.168.0.3:3306)
Wed Jul 31 11:28:36 2013 - [info] sv2(192.168.0.4:3306)
Wed Jul 31 11:28:36 2013 - [info] Alive Slaves:
Wed Jul 31 11:28:36 2013 - [info] sv2(192.168.0.4:3306) Version=5.5.15-log (oldest major version between slaves) log-bin:enabled
Wed Jul 31 11:28:36 2013 - [debug] Relay log info repository: FILE
Wed Jul 31 11:28:36 2013 - [info] Replicating from 192.168.0.3(192.168.0.3:3306)
Wed Jul 31 11:28:36 2013 - [info] Current Alive Master: sv1(192.168.0.3:3306)
Wed Jul 31 11:28:36 2013 - [info] Checking slave configurations..
Wed Jul 31 11:28:36 2013 - [warning] relay_log_purge=0 is not set on slave sv2(192.168.0.4:3306).
Wed Jul 31 11:28:36 2013 - [info] Checking replication filtering settings..
Wed Jul 31 11:28:36 2013 - [info] binlog_do_db= , binlog_ignore_db=
Wed Jul 31 11:28:36 2013 - [info] Replication filtering check ok.
Wed Jul 31 11:28:36 2013 - [info] Starting SSH connection tests..
Wed Jul 31 11:28:36 2013 - [debug]
Wed Jul 31 11:28:36 2013 - [debug] Connecting via SSH from root@sv1(192.168.0.3) to root@sv2(192.168.0.4)..
Wed Jul 31 11:28:36 2013 - [debug] ok.
Wed Jul 31 11:28:37 2013 - [debug]
Wed Jul 31 11:28:36 2013 - [debug] Connecting via SSH from root@sv2(192.168.0.4) to root@sv1(192.168.0.3)..
Wed Jul 31 11:28:37 2013 - [debug] ok.
Wed Jul 31 11:28:37 2013 - [info] All SSH connection tests passed successfully.
Wed Jul 31 11:28:37 2013 - [info] Checking MHA Node version..
Wed Jul 31 11:28:37 2013 - [info] Version check ok.
Wed Jul 31 11:28:37 2013 - [info] Checking SSH publickey authentication and checking recovery script configurations on the current master..
Wed Jul 31 11:28:37 2013 - [info] Executing command: save_binary_logs --command=test --start_file=mysql-bin.000010 --start_pos=4 --binlog_dir=/usr/local/mysql/data --output_file=/var/log/masterha/app1/save_binary_logs_test --manager_version=0.52 --debug
Wed Jul 31 11:28:37 2013 - [info] Connecting to root@sv1(sv1)..
Creating /var/log/masterha/app1 if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /usr/local/mysql/data, up to mysql-bin.000010
Wed Jul 31 11:28:38 2013 - [info] Master setting check done.
Wed Jul 31 11:28:38 2013 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Wed Jul 31 11:28:38 2013 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user=root --slave_host=sv2 --slave_ip=192.168.0.4 --slave_port=3306 --workdir=/var/log/masterha/app1 --target_version=5.5.15-log --manager_version=0.52 --relay_log_info=/usr/local/mysql/data/relay-log.info --debug --slave_pass=xxx
Wed Jul 31 11:28:38 2013 - [info] Connecting to root@192.168.0.4(sv2)..
Checking slave recovery environment settings..
Opening /usr/local/mysql/data/relay-log.info ... ok.
Relay log found at /usr/local/mysql/data, up to sv2-relay-bin.000002
Temporary relay log file is /usr/local/mysql/data/sv2-relay-bin.000002
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Jul 31 11:28:38 2013 - [info] Slaves settings check done.
Wed Jul 31 11:28:38 2013 - [info]
sv1 (current master)
+--sv2
Wed Jul 31 11:28:38 2013 - [info] Checking replication health on sv2..
Wed Jul 31 11:28:38 2013 - [info] ok.
Wed Jul 31 11:28:38 2013 - [warning] master_ip_failover_script is not defined.
Wed Jul 31 11:28:38 2013 - [warning] shutdown_script is not defined.
Wed Jul 31 11:28:38 2013 - [debug] Disconnected from sv1(192.168.0.3:3306)
Wed Jul 31 11:28:38 2013 - [debug] Disconnected from sv2(192.168.0.4:3306)
Wed Jul 31 11:28:38 2013 - [info] Got exit code 0 (Not master dead).
MySQL Replication Health is OK.
$ masterha_check_status --conf=/path/to/app1.cnf ## 상태확인
app1 (pid:8368) is running(0:PING_OK), master:host1
상태코드
Status Code Status String Description
0 PING_OK Master is running and MHA Manager is monitoring. Master state is alive.
1 --- Unexpected error happened. For example, config file does not exist. If this error happens, check arguments are valid or not.
2 NOT_RUNNING MHA Manager is not running. Master state is unknown.
3 PARTIALLY_RUNNING MHA Manager main process is not running, but child processes are running. This should not happen and should be investigated. Master state is unknown.
10 INITIALIZING_MONITOR MHA Manager is just after startup and initializing. Wait for a while and see how the status changes. Master state is unknown.
20 PING_FAILING MHA Manager detects ping to master is failing. Master state is maybe down.
21 PING_FAILED MHA Manager detects either a) ping to master failed three times, b) preparing for starting master failover. Master state is maybe down.
30 RETRYING_MONITOR MHA Manager internal health check program detected that master was not reachable from manager, but after double check MHA Manager verified the master is alive, and currently waiting for retry. Master state is very likely alive.
31 CONFIG_ERROR There are some configuration problems and MHA Manager can't monitor the target master. Check a logfile for detail. Master state is unknown.
32 TIMESTAMP_OLD MHA Manager detects that ping to master is ok but status file is not updated for a long time. Check whether MHA Manager itself hangs or not. Master state is unknown.
50 FAILOVER_RUNNING MHA Manager confirms that master is down and running failover. Master state is dead.
51 FAILOVER_ERROR MHA Manager confirms that master is down and running failover, but failed during failover. Master state is dead.
MHA master 수동으로 바꾸기
[root@adb1 ~]# /usr/bin/masterha_master_switch --master_state=alive --conf=/etc/app1.cnf
Tue Feb 25 09:36:39 2014 - [info] MHA::MasterRotate version 0.55.
Tue Feb 25 09:36:39 2014 - [info] Starting online master switch..
Tue Feb 25 09:36:39 2014 - [info]
Tue Feb 25 09:36:39 2014 - [info] * Phase 1: Configuration Check Phase..
Tue Feb 25 09:36:39 2014 - [info]
Tue Feb 25 09:36:39 2014 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Feb 25 09:36:39 2014 - [info] Reading application default configurations from /etc/app1.cnf..
Tue Feb 25 09:36:39 2014 - [info] Reading server configurations from /etc/app1.cnf..
Tue Feb 25 09:36:39 2014 - [warning] SQL Thread is stopped(no error) on 192.168.229.238(192.168.229.238:3309)
Tue Feb 25 09:36:39 2014 - [info] Current Alive Master: 192.168.229.236(192.168.229.236:3301)
Tue Feb 25 09:36:39 2014 - [info] Alive Slaves:
Tue Feb 25 09:36:39 2014 - [info] 192.168.229.238(192.168.229.238:3309) Version=5.5.31-MariaDB-log (oldest major version between slaves) log-bin:enabled
Tue Feb 25 09:36:39 2014 - [info] Replicating from 192.168.229.236(192.168.229.236:3301)
It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching. Is it ok to execute on 192.168.229.236(192.168.229.236:3301)? (YES/no): yes
Tue Feb 25 09:36:42 2014 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Tue Feb 25 09:36:42 2014 - [info] ok.
Tue Feb 25 09:36:42 2014 - [info] Checking MHA is not monitoring or doing failover..
Tue Feb 25 09:36:42 2014 - [info] Checking replication health on 192.168.229.238..
Tue Feb 25 09:36:42 2014 - [error][/usr/share/perl5/vendor_perl/MHA/Server.pm, ln472] Slave IO thread is not running on 192.168.229.238(192.168.229.238:3309)
Tue Feb 25 09:36:42 2014 - [error][/usr/share/perl5/vendor_perl/MHA/ServerManager.pm, ln1429] failed!
Tue Feb 25 09:36:42 2014 - [error][/usr/share/perl5/vendor_perl/MHA/ManagerUtil.pm, ln178] Got ERROR: at /usr/share/perl5/vendor_perl/MHA/MasterRotate.pm line 156
[root@adb1 ~]# /usr/bin/masterha_master_switch --master_state=alive --conf=/etc/app1.cnf
Tue Feb 25 09:43:48 2014 - [info] MHA::MasterRotate version 0.55.
Tue Feb 25 09:43:48 2014 - [info] Starting online master switch..
Tue Feb 25 09:43:48 2014 - [info]
Tue Feb 25 09:43:48 2014 - [info] * Phase 1: Configuration Check Phase..
Tue Feb 25 09:43:48 2014 - [info]
Tue Feb 25 09:43:48 2014 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Tue Feb 25 09:43:48 2014 - [info] Reading application default configurations from /etc/app1.cnf..
Tue Feb 25 09:43:48 2014 - [info] Reading server configurations from /etc/app1.cnf..
Tue Feb 25 09:43:48 2014 - [info] Current Alive Master: 192.168.229.236(192.168.229.236:3301)
Tue Feb 25 09:43:48 2014 - [info] Alive Slaves:
Tue Feb 25 09:43:48 2014 - [info] 192.168.229.238(192.168.229.238:3309) Version=5.5.31-MariaDB-log (oldest major version between slaves) log-bin:enabled
Tue Feb 25 09:43:48 2014 - [info] Replicating from 192.168.229.236(192.168.229.236:3301)
It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching. Is it ok to execute on 192.168.229.236(192.168.229.236:3301)? (YES/no): yes
Tue Feb 25 09:43:51 2014 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Tue Feb 25 09:43:51 2014 - [info] ok.
Tue Feb 25 09:43:51 2014 - [info] Checking MHA is not monitoring or doing failover..
Tue Feb 25 09:43:51 2014 - [info] Checking replication health on 192.168.229.238..
Tue Feb 25 09:43:51 2014 - [info] ok.
Tue Feb 25 09:43:51 2014 - [info] Searching new master from slaves..
Tue Feb 25 09:43:51 2014 - [info] Candidate masters from the configuration file:
Tue Feb 25 09:43:51 2014 - [info] Non-candidate masters:
Tue Feb 25 09:43:51 2014 - [info]
From:
192.168.229.236 (current master)
+--192.168.229.238
To:
192.168.229.238 (new master)
Starting master switch from 192.168.229.236(192.168.229.236:3301) to 192.168.229.238(192.168.229.238:3309)? (yes/NO): yes
Tue Feb 25 09:43:52 2014 - [info] Checking whether 192.168.229.238(192.168.229.238:3309) is ok for the new master..
Tue Feb 25 09:43:52 2014 - [info] ok.
Tue Feb 25 09:43:52 2014 - [info] ** Phase 1: Configuration Check Phase completed.
Tue Feb 25 09:43:52 2014 - [info]
Tue Feb 25 09:43:52 2014 - [info] * Phase 2: Rejecting updates Phase..
Tue Feb 25 09:43:52 2014 - [info]
master_ip_online_change_script is not defined. If you do not disable writes on the current master manually, applications keep writing on the current master. Is it ok to proceed? (yes/NO): yes
Tue Feb 25 09:44:00 2014 - [info] Locking all tables on the orig master to reject updates from everybody (including root):
Tue Feb 25 09:44:00 2014 - [info] Executing FLUSH TABLES WITH READ LOCK..
Tue Feb 25 09:44:00 2014 - [info] ok.
Tue Feb 25 09:44:00 2014 - [info] Orig master binlog:pos is mysql-bin.000005:245.
Tue Feb 25 09:44:00 2014 - [info] Waiting to execute all relay logs on 192.168.229.238(192.168.229.238:3309)..
Tue Feb 25 09:44:00 2014 - [info] master_pos_wait(mysql-bin.000005:245) completed on 192.168.229.238(192.168.229.238:3309). Executed 0 events.
Tue Feb 25 09:44:00 2014 - [info] done.
Tue Feb 25 09:44:00 2014 - [info] Getting new master's binlog name and position..
Tue Feb 25 09:44:00 2014 - [info] mysql-bin.000006:245
Tue Feb 25 09:44:00 2014 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.229.238', MASTER_PORT=3309, MASTER_LOG_FILE='mysql-bin.000006', MASTER_LOG_POS=245, MASTER_USER='repl', MASTER_PASSWORD='xxx';
Tue Feb 25 09:44:00 2014 - [info] Setting read_only=0 on 192.168.229.238(192.168.229.238:3309)..
Tue Feb 25 09:44:00 2014 - [info] ok.
Tue Feb 25 09:44:00 2014 - [info]
Tue Feb 25 09:44:00 2014 - [info] * Switching slaves in parallel..
Tue Feb 25 09:44:00 2014 - [info]
Tue Feb 25 09:44:00 2014 - [info] Unlocking all tables on the orig master:
Tue Feb 25 09:44:00 2014 - [info] Executing UNLOCK TABLES..
Tue Feb 25 09:44:00 2014 - [info] ok.
Tue Feb 25 09:44:00 2014 - [info] All new slave servers switched successfully.
Tue Feb 25 09:44:00 2014 - [info]
Tue Feb 25 09:44:00 2014 - [info] * Phase 5: New master cleanup phase..
Tue Feb 25 09:44:00 2014 - [info]
Tue Feb 25 09:44:00 2014 - [info] 192.168.229.238: Resetting slave info succeeded.
Tue Feb 25 09:44:00 2014 - [info] Switching master to 192.168.229.238(192.168.229.238:3309) completed successfully.
명령어 정리
명령어 설명
masterha_check_ssh --conf=/etc/app1.cnf SSH 체크
masterha_manager --conf=/etc/conf/masterha/app1.cnf Manager 실행
manager_host$ masterha_stop --conf=/etc/app1.cnf Manager 중지
masterha_master_switch --master_state=alive
--conf=/etc/app.cnf --new_master_host=sv2 Master 수동변경하기
masterha_check_status --conf=/path/to/app1.cnf Status 확인하기
'DB - MySQL' 카테고리의 다른 글
MySQL my.cnf 파일 설정 (0) | 2017.03.23 |
---|---|
MySQL Isolation LEVEL (0) | 2017.03.22 |
MySQL 모니터링 툴 (0) | 2017.03.06 |
MySQL DB 리소스 사용량 (0) | 2017.03.06 |
MySQL 이중화 방식 - replication 구성 방법 (0) | 2017.03.06 |