728x90
반응형
- OS 및 설치 환경
VMWARE 10
192.168.139.141 DB1
192.168.139.142 DB2
192.168.139.143 Mha-Manager
OS : CentOS 7.3
CPU : 2core
RAM : 1.5G
HDD : 20G
- percona DB 5.7.18-14 설치
- Replication 설정
- Mha 구성
- TEST
- percona DB 5.7.18-14 설치 -
vi /etc/hosts 등록
192.168.139.141 db1
192.168.139.142 db2
192.168.139.143 mha-manager
yum -y install gcc gcc-c++ ncurses ncurses-devel cmake wget
yum install libaio-devel -y
yum -y install epel*
yum -y install readline-devel.x86_64
yum install zlib-devel
cd /usr/local/src
tar xfz percona-server-5.7.18-14.tar.gz
cd percona-server-5.7.18-14
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost_1_59_0
make
make install
useradd -M mysql -u 27 >& /dev/null
chown -R root:mysql /usr/local/mysql
cd /usr/local/mysql
chmod 700 support-files/mysql.server
cp support-files/mysql.server /etc/rc.d/init.d/mysql
ln -s /etc/rc.d/init.d/mysql /etc/rc.d/rc3.d/S97mysql
cp support-files/mysql.server /usr/bin/
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
bin/mysqld --no-defaults --user=mysql --initialize --log-error-verbosity=3
(위 명령어시 결과값 중간에 패스워드 노출됨)
mkdir /var/log/mariadb
touch /var/log/mariadb/mariadb.log
echo "" > /var/log/mariadb/mariadb.log
chown -R mysql:mysql /var/log/mariadb/mariadb.log
vi /etc/my.cnf
[mysqld]
#datadir=/var/lib/mysql
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
datadir 을 원하는 위치로.
/etc/init.d/mysql start
bin/mysql -uroot -p
(패스워드는 위에 중간에 노출된다는 패스워드 입력)
alter user user() identified by '패스워드입력';
- Replication 설정 -
-------------------------------Master---------------------------------------------
[root@localhost ~]# vi /etc/my.cnf
relay-log=mysqld_relay_bin
[mysqld]
#datadir=/var/lib/mysql
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
server_id = 29
log_bin=mysql-bin
relay-log=mysqld_relay_bin
expire_logs_days=15
bind-address = 0.0.0.0
relay-log-purge=0
binlog-format=MIXED
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
-------------------------------slave1---------------------------------------------
[mysqld]
#datadir=/var/lib/mysql
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
server_id = 30
log_bin=mysql-bin
relay-log=mysqld_relay_bin
#max_binlog_size=2000M
expire_logs_days=15
bind-address = 0.0.0.0
relay-log-purge=0
binlog-format=MIXED
read_only=1
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
-------------------------------slave2---------------------------------------------
[mysqld]
#datadir=/var/lib/mysql
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
server_id = 31
log_bin=mysql-bin
relay-log=mysqld_relay_bin
#max_binlog_size=2000M
expire_logs_days=15
bind-address = 0.0.0.0
relay-log-purge=0
binlog-format=MIXED
read_only=1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
Master
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 154 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
File 과 Position 체크 후
Slave 1,2
mysql> CHANGE MASTER TO \
-> MASTER_HOST='192.168.139.141', \
-> MASTER_PORT=3306, \
-> MASTER_USER='repl', \
-> MASTER_PASSWORD='패스워드', \
-> master_log_file='mysql-bin.000001', \
-> master_log_pos=154;
Query OK, 0 rows affected, 2 warnings (0.02 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.139.141
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 154
Relay_Log_File: mysqld_relay_bin.000002
Relay_Log_Pos: 320
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 154
Relay_Log_Space: 528
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 29
Master_UUID: e5729668-9e00-11e7-b7ea-000c297e2d91
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
- Mha 구성
yum -y install perl-DBD-MySQL perl-Params-Validate perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes
접속 후
mha4mysql-manager-0.57.tar.gz
mha4mysql-node-0.57.tar.gz
다운로드
Mater - node 설치
Slave - node 설치
Mha-manager - node,manager 설치
mha4mysql-node-0.57.tar.gz 설치법
tar xvf mha4mysql-node-0.57.tar.gz
cd mha4mysql-node-0.57
perl Makefile.PL
make
make install
mha4mysql-manager-0.57.tar.gz 설치법
tar xvf mha4mysql-manager-0.57.tar.gz
cd mha4mysql-manager-0.57
perl Makefile.PL
make
make install
mysql>
grant all privileges on *.* to root@'localhost' identified by '패스워드' with grant option;
grant all privileges on *.* to root@'192.168.139.%' identified by '패스워드' with grant option;
grant all privileges on *.* to repl@'192.168.139.%' identified by '패스워드';
grant replication slave on *.* to repl@'192.168.139.%' identified by '패스워드';
flush privileges;
groupadd mysql
useradd -g mysql mysql
SSH 인증
ssh-keygen -t rsa
엔터엔터엔터
cat ~/.ssh/id_rsa.pub
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
각 서버에 authorized_keys 에 서로서로 authorized_keys 값을 추가해줘야함
테스트
--1번에서 2번 호출
[root@db1 .ssh]# ssh db2
yes
--1번에서 3번 호출
[root@db1 .ssh]# ssh mha-manager
yes
--2번에서 1번 호출
[root@db2 .ssh]# ssh db1
yes
--2번에서 3번 호출
[root@db2 .ssh]# ssh mha-manager
yes
--3번에서 1번 호출
[root@mha-manager .ssh]# ssh db1
yes
--3번에서 2번 호출
[root@mha-manager .ssh]# ssh db2
yes
테스트겸 한번씩 연결함으로써 known-host에 등록이 목적
mha-manager 설정
[root@localhost mha4mysql-node-0.57]# vi /etc/app1.cnf
[server default]
ping_interval = 3
ping_type = select
## 사용자 패스워드
user=root
password=패스워드
ssh_user=root
repl_user=repl
repl_password=패스워드
##mha 매니저 실행 정보 저장 디렉터리 로그 파일
manager_workdir=/usr/local/mysql/mha/app1
#manager_log=/mysql/mha/app1.log
master_binlog_dir=/usr/local/mysql/data
## mysql 서버의 실행 디렉터리
remote_workdir=/usr/local/mysql/mha/app1
#master_binlog_dir=/data
#master_ip_failover_script= master_ip_online_change
#master_ip_failover_script=/usr/bin/mha_failover
[server1]
hostname=db1
candidate_master=1
[server2]
hostname=db2
candidate_master=1
[server3]
hostname=mha-manager
no_master=1
Master , Slave , Mha-manager 공통
ln -s /usr/local/mysql/bin/mysqlbinlog /usr/local/bin/mysqlbinlog
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
mha-manager 에서 테스트
[root@mha-manager .ssh]# masterha_check_repl --conf=/etc/app1.cnf
Thu Sep 21 01:14:30 2017 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Sep 21 01:14:30 2017 - [info] Reading application default configuration from /etc/app1.cnf..
Thu Sep 21 01:14:30 2017 - [info] Reading server configuration from /etc/app1.cnf..
Thu Sep 21 01:14:30 2017 - [info] MHA::MasterMonitor version 0.57.
Thu Sep 21 01:14:31 2017 - [info] GTID failover mode = 0
Thu Sep 21 01:14:31 2017 - [info] Dead Servers:
Thu Sep 21 01:14:31 2017 - [info] Alive Servers:
Thu Sep 21 01:14:31 2017 - [info] db1(192.168.139.141:3306)
Thu Sep 21 01:14:31 2017 - [info] db2(192.168.139.142:3306)
Thu Sep 21 01:14:31 2017 - [info] mha-manager(192.168.139.143:3306)
Thu Sep 21 01:14:31 2017 - [info] Alive Slaves:
Thu Sep 21 01:14:31 2017 - [info] db2(192.168.139.142:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:14:31 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:14:31 2017 - [info] Primary candidate for the new Master (candidate_master is set)
Thu Sep 21 01:14:31 2017 - [info] mha-manager(192.168.139.143:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:14:31 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:14:31 2017 - [info] Not candidate for the new Master (no_master is set)
Thu Sep 21 01:14:31 2017 - [info] Current Alive Master: db1(192.168.139.141:3306)
Thu Sep 21 01:14:31 2017 - [info] Checking slave configurations..
Thu Sep 21 01:14:31 2017 - [info] Checking replication filtering settings..
Thu Sep 21 01:14:31 2017 - [info] binlog_do_db= , binlog_ignore_db=
Thu Sep 21 01:14:31 2017 - [info] Replication filtering check ok.
Thu Sep 21 01:14:31 2017 - [info] GTID (with auto-pos) is not supported
Thu Sep 21 01:14:31 2017 - [info] Starting SSH connection tests..
Thu Sep 21 01:14:34 2017 - [info] All SSH connection tests passed successfully.
Thu Sep 21 01:14:34 2017 - [info] Checking MHA Node version..
Thu Sep 21 01:14:34 2017 - [info] Version check ok.
Thu Sep 21 01:14:34 2017 - [info] Checking SSH publickey authentication settings on the current master..
Thu Sep 21 01:14:35 2017 - [info] HealthCheck: SSH to db1 is reachable.
Thu Sep 21 01:14:35 2017 - [info] Master MHA Node version is 0.57.
Thu Sep 21 01:14:35 2017 - [info] Checking recovery script configurations on db1(192.168.139.141:3306)..
Thu Sep 21 01:14:35 2017 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/usr/local/mysql/data --output_file=/usr/local/mysql/mha/app1/save_binary_logs_test --manager_version=0.57 --start_file=mysql-bin.000001
Thu Sep 21 01:14:35 2017 - [info] Connecting to root@192.168.139.141(db1:22)..
Creating /usr/local/mysql/mha/app1 if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /usr/local/mysql/data, up to mysql-bin.000001
Thu Sep 21 01:14:35 2017 - [info] Binlog setting check done.
Thu Sep 21 01:14:35 2017 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Thu Sep 21 01:14:35 2017 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=db2 --slave_ip=192.168.139.142 --slave_port=3306 --workdir=/usr/local/mysql/mha/app1 --target_version=5.7.18-14-log --manager_version=0.57 --relay_log_info=/usr/local/mysql/data/relay-log.info --relay_dir=/usr/local/mysql/data/ --slave_pass=xxx
Thu Sep 21 01:14:35 2017 - [info] Connecting to root@192.168.139.142(db2:22)..
Checking slave recovery environment settings..
Opening /usr/local/mysql/data/relay-log.info ... ok.
Relay log found at /usr/local/mysql/data, up to mysqld_relay_bin.000002
Temporary relay log file is /usr/local/mysql/data/mysqld_relay_bin.000002
Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure.
done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Thu Sep 21 01:14:36 2017 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=mha-manager --slave_ip=192.168.139.143 --slave_port=3306 --workdir=/usr/local/mysql/mha/app1 --target_version=5.7.18-14-log --manager_version=0.57 --relay_log_info=/usr/local/mysql/data/relay-log.info --relay_dir=/usr/local/mysql/data/ --slave_pass=xxx
Thu Sep 21 01:14:36 2017 - [info] Connecting to root@192.168.139.143(mha-manager:22)..
Checking slave recovery environment settings..
Opening /usr/local/mysql/data/relay-log.info ... ok.
Relay log found at /usr/local/mysql/data, up to mysqld_relay_bin.000002
Temporary relay log file is /usr/local/mysql/data/mysqld_relay_bin.000002
Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure.
done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Thu Sep 21 01:14:36 2017 - [info] Slaves settings check done.
Thu Sep 21 01:14:36 2017 - [info]
db1(192.168.139.141:3306) (current master)
+--db2(192.168.139.142:3306)
+--mha-manager(192.168.139.143:3306)
Thu Sep 21 01:14:36 2017 - [info] Checking replication health on db2..
Thu Sep 21 01:14:36 2017 - [info] ok.
Thu Sep 21 01:14:36 2017 - [info] Checking replication health on mha-manager..
Thu Sep 21 01:14:36 2017 - [info] ok.
Thu Sep 21 01:14:36 2017 - [warning] master_ip_failover_script is not defined.
Thu Sep 21 01:14:36 2017 - [warning] shutdown_script is not defined.
Thu Sep 21 01:14:36 2017 - [info] Got exit code 0 (Not master dead).
MySQL Replication Health is OK..
mha-manager 에서 Mha Failover 실행
[root@localhost .ssh]# masterha_manager --remove_dead_master_conf --conf=/etc/app1.cnf
Thu Sep 21 01:14:52 2017 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Sep 21 01:14:52 2017 - [info] Reading application default configuration from /etc/app1.cnf..
Thu Sep 21 01:14:52 2017 - [info] Reading server configuration from /etc/app1.cnf..
Thu Sep 21 01:14:52 2017 - [info] MHA::MasterMonitor version 0.57.
Thu Sep 21 01:14:53 2017 - [info] GTID failover mode = 0
Thu Sep 21 01:14:53 2017 - [info] Dead Servers:
Thu Sep 21 01:14:53 2017 - [info] Alive Servers:
Thu Sep 21 01:14:53 2017 - [info] db1(192.168.139.141:3306)
Thu Sep 21 01:14:53 2017 - [info] db2(192.168.139.142:3306)
Thu Sep 21 01:14:53 2017 - [info] mha-manager(192.168.139.143:3306)
Thu Sep 21 01:14:53 2017 - [info] Alive Slaves:
Thu Sep 21 01:14:53 2017 - [info] db2(192.168.139.142:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:14:53 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:14:53 2017 - [info] Primary candidate for the new Master (candidate_master is set)
Thu Sep 21 01:14:53 2017 - [info] mha-manager(192.168.139.143:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:14:53 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:14:53 2017 - [info] Not candidate for the new Master (no_master is set)
Thu Sep 21 01:14:53 2017 - [info] Current Alive Master: db1(192.168.139.141:3306)
Thu Sep 21 01:14:53 2017 - [info] Checking slave configurations..
Thu Sep 21 01:14:53 2017 - [info] Checking replication filtering settings..
Thu Sep 21 01:14:53 2017 - [info] binlog_do_db= , binlog_ignore_db=
Thu Sep 21 01:14:53 2017 - [info] Replication filtering check ok.
Thu Sep 21 01:14:53 2017 - [info] GTID (with auto-pos) is not supported
Thu Sep 21 01:14:53 2017 - [info] Starting SSH connection tests..
Thu Sep 21 01:14:56 2017 - [info] All SSH connection tests passed successfully.
Thu Sep 21 01:14:56 2017 - [info] Checking MHA Node version..
Thu Sep 21 01:14:56 2017 - [info] Version check ok.
Thu Sep 21 01:14:56 2017 - [info] Checking SSH publickey authentication settings on the current master..
Thu Sep 21 01:14:57 2017 - [info] HealthCheck: SSH to db1 is reachable.
Thu Sep 21 01:14:57 2017 - [info] Master MHA Node version is 0.57.
Thu Sep 21 01:14:57 2017 - [info] Checking recovery script configurations on db1(192.168.139.141:3306)..
Thu Sep 21 01:14:57 2017 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/usr/local/mysql/data --output_file=/usr/local/mysql/mha/app1/save_binary_logs_test --manager_version=0.57 --start_file=mysql-bin.000001
Thu Sep 21 01:14:57 2017 - [info] Connecting to root@192.168.139.141(db1:22)..
Creating /usr/local/mysql/mha/app1 if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /usr/local/mysql/data, up to mysql-bin.000001
Thu Sep 21 01:14:57 2017 - [info] Binlog setting check done.
Thu Sep 21 01:14:57 2017 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Thu Sep 21 01:14:57 2017 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=db2 --slave_ip=192.168.139.142 --slave_port=3306 --workdir=/usr/local/mysql/mha/app1 --target_version=5.7.18-14-log --manager_version=0.57 --relay_log_info=/usr/local/mysql/data/relay-log.info --relay_dir=/usr/local/mysql/data/ --slave_pass=xxx
Thu Sep 21 01:14:57 2017 - [info] Connecting to root@192.168.139.142(db2:22)..
Checking slave recovery environment settings..
Opening /usr/local/mysql/data/relay-log.info ... ok.
Relay log found at /usr/local/mysql/data, up to mysqld_relay_bin.000002
Temporary relay log file is /usr/local/mysql/data/mysqld_relay_bin.000002
Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure.
done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Thu Sep 21 01:14:58 2017 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=mha-manager --slave_ip=192.168.139.143 --slave_port=3306 --workdir=/usr/local/mysql/mha/app1 --target_version=5.7.18-14-log --manager_version=0.57 --relay_log_info=/usr/local/mysql/data/relay-log.info --relay_dir=/usr/local/mysql/data/ --slave_pass=xxx
Thu Sep 21 01:14:58 2017 - [info] Connecting to root@192.168.139.143(mha-manager:22)..
Checking slave recovery environment settings..
Opening /usr/local/mysql/data/relay-log.info ... ok.
Relay log found at /usr/local/mysql/data, up to mysqld_relay_bin.000002
Temporary relay log file is /usr/local/mysql/data/mysqld_relay_bin.000002
Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure.
done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Thu Sep 21 01:14:58 2017 - [info] Slaves settings check done.
Thu Sep 21 01:14:58 2017 - [info]
db1(192.168.139.141:3306) (current master)
+--db2(192.168.139.142:3306)
+--mha-manager(192.168.139.143:3306)
Thu Sep 21 01:14:58 2017 - [warning] master_ip_failover_script is not defined.
Thu Sep 21 01:14:58 2017 - [warning] shutdown_script is not defined.
Thu Sep 21 01:14:58 2017 - [info] Set master ping interval 3 seconds.
Thu Sep 21 01:14:58 2017 - [warning] secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.
Thu Sep 21 01:14:58 2017 - [info] Starting ping health check on db1(192.168.139.141:3306)..
Thu Sep 21 01:14:58 2017 - [info] Ping(SELECT) succeeded, waiting until MySQL doesn't respond..
Thu Sep 21 01:15:34 2017 - [warning] Got error on MySQL select ping: 2006 (MySQL server has gone away)
Thu Sep 21 01:15:34 2017 - [info] Executing SSH check script: save_binary_logs --command=test --start_pos=4 --binlog_dir=/usr/local/mysql/data --output_file=/usr/local/mysql/mha/app1/save_binary_logs_test --manager_version=0.57 --binlog_prefix=mysql-bin
Creating /usr/local/mysql/mha/app1 if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /usr/local/mysql/data, up to mysql-bin.000001
Master Down ( 재부팅 하거나 /etc/init.d/mysql stop )
Thu Sep 21 01:15:35 2017 - [info] HealthCheck: SSH to db1 is reachable.
Thu Sep 21 01:15:37 2017 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.139.141' (111))
Thu Sep 21 01:15:37 2017 - [warning] Connection failed 2 time(s)..
Thu Sep 21 01:15:40 2017 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.139.141' (111))
Thu Sep 21 01:15:40 2017 - [warning] Connection failed 3 time(s)..
Thu Sep 21 01:15:43 2017 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.139.141' (111))
Thu Sep 21 01:15:43 2017 - [warning] Connection failed 4 time(s)..
Thu Sep 21 01:15:43 2017 - [warning] Master is not reachable from health checker!
Thu Sep 21 01:15:43 2017 - [warning] Master db1(192.168.139.141:3306) is not reachable!
Thu Sep 21 01:15:43 2017 - [warning] SSH is reachable.
Thu Sep 21 01:15:43 2017 - [info] Connecting to a master server failed. Reading configuration file /etc/masterha_default.cnf and /etc/app1.cnf again, and trying to connect to all servers to check server status..
Thu Sep 21 01:15:43 2017 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Sep 21 01:15:43 2017 - [info] Reading application default configuration from /etc/app1.cnf..
Thu Sep 21 01:15:43 2017 - [info] Reading server configuration from /etc/app1.cnf..
Thu Sep 21 01:15:44 2017 - [info] GTID failover mode = 0
Thu Sep 21 01:15:44 2017 - [info] Dead Servers:
Thu Sep 21 01:15:44 2017 - [info] db1(192.168.139.141:3306)
Thu Sep 21 01:15:44 2017 - [info] Alive Servers:
Thu Sep 21 01:15:44 2017 - [info] db2(192.168.139.142:3306)
Thu Sep 21 01:15:44 2017 - [info] mha-manager(192.168.139.143:3306)
Thu Sep 21 01:15:44 2017 - [info] Alive Slaves:
Thu Sep 21 01:15:44 2017 - [info] db2(192.168.139.142:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:44 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:44 2017 - [info] Primary candidate for the new Master (candidate_master is set)
Thu Sep 21 01:15:44 2017 - [info] mha-manager(192.168.139.143:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:44 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:44 2017 - [info] Not candidate for the new Master (no_master is set)
Thu Sep 21 01:15:44 2017 - [info] Checking slave configurations..
Thu Sep 21 01:15:44 2017 - [info] Checking replication filtering settings..
Thu Sep 21 01:15:44 2017 - [info] Replication filtering check ok.
Thu Sep 21 01:15:44 2017 - [info] Master is down!
Thu Sep 21 01:15:44 2017 - [info] Terminating monitoring script.
Thu Sep 21 01:15:44 2017 - [info] Got exit code 20 (Master dead).
Thu Sep 21 01:15:44 2017 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Sep 21 01:15:44 2017 - [info] Reading application default configuration from /etc/app1.cnf..
Thu Sep 21 01:15:44 2017 - [info] Reading server configuration from /etc/app1.cnf..
Thu Sep 21 01:15:44 2017 - [info] MHA::MasterFailover version 0.57.
Thu Sep 21 01:15:44 2017 - [info] Starting master failover.
Thu Sep 21 01:15:44 2017 - [info]
Thu Sep 21 01:15:44 2017 - [info] * Phase 1: Configuration Check Phase..
Thu Sep 21 01:15:44 2017 - [info]
Thu Sep 21 01:15:45 2017 - [info] GTID failover mode = 0
Thu Sep 21 01:15:45 2017 - [info] Dead Servers:
Thu Sep 21 01:15:45 2017 - [info] db1(192.168.139.141:3306)
Thu Sep 21 01:15:45 2017 - [info] Checking master reachability via MySQL(double check)...
Thu Sep 21 01:15:45 2017 - [info] ok.
Thu Sep 21 01:15:45 2017 - [info] Alive Servers:
Thu Sep 21 01:15:45 2017 - [info] db2(192.168.139.142:3306)
Thu Sep 21 01:15:45 2017 - [info] mha-manager(192.168.139.143:3306)
Thu Sep 21 01:15:45 2017 - [info] Alive Slaves:
Thu Sep 21 01:15:45 2017 - [info] db2(192.168.139.142:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:45 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:45 2017 - [info] Primary candidate for the new Master (candidate_master is set)
Thu Sep 21 01:15:45 2017 - [info] mha-manager(192.168.139.143:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:45 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:45 2017 - [info] Not candidate for the new Master (no_master is set)
Thu Sep 21 01:15:45 2017 - [info] Starting Non-GTID based failover.
Thu Sep 21 01:15:45 2017 - [info]
Thu Sep 21 01:15:45 2017 - [info] ** Phase 1: Configuration Check Phase completed.
Thu Sep 21 01:15:45 2017 - [info]
Thu Sep 21 01:15:45 2017 - [info] * Phase 2: Dead Master Shutdown Phase..
Thu Sep 21 01:15:45 2017 - [info]
Thu Sep 21 01:15:45 2017 - [info] Forcing shutdown so that applications never connect to the current master..
Thu Sep 21 01:15:45 2017 - [warning] master_ip_failover_script is not set. Skipping invalidating dead master IP address.
Thu Sep 21 01:15:45 2017 - [warning] shutdown_script is not set. Skipping explicit shutting down of the dead master.
Thu Sep 21 01:15:46 2017 - [info] * Phase 2: Dead Master Shutdown Phase completed.
Thu Sep 21 01:15:46 2017 - [info]
Thu Sep 21 01:15:46 2017 - [info] * Phase 3: Master Recovery Phase..
Thu Sep 21 01:15:46 2017 - [info]
Thu Sep 21 01:15:46 2017 - [info] * Phase 3.1: Getting Latest Slaves Phase..
Thu Sep 21 01:15:46 2017 - [info]
Thu Sep 21 01:15:46 2017 - [info] The latest binary log file/position on all slaves is mysql-bin.000001:154
Thu Sep 21 01:15:46 2017 - [info] Latest slaves (Slaves that received relay log files to the latest):
Thu Sep 21 01:15:46 2017 - [info] db2(192.168.139.142:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:46 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:46 2017 - [info] Primary candidate for the new Master (candidate_master is set)
Thu Sep 21 01:15:46 2017 - [info] mha-manager(192.168.139.143:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:46 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:46 2017 - [info] Not candidate for the new Master (no_master is set)
Thu Sep 21 01:15:46 2017 - [info] The oldest binary log file/position on all slaves is mysql-bin.000001:154
Thu Sep 21 01:15:46 2017 - [info] Oldest slaves:
Thu Sep 21 01:15:46 2017 - [info] db2(192.168.139.142:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:46 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:46 2017 - [info] Primary candidate for the new Master (candidate_master is set)
Thu Sep 21 01:15:46 2017 - [info] mha-manager(192.168.139.143:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:46 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:46 2017 - [info] Not candidate for the new Master (no_master is set)
Thu Sep 21 01:15:46 2017 - [info]
Thu Sep 21 01:15:46 2017 - [info] * Phase 3.2: Saving Dead Master's Binlog Phase..
Thu Sep 21 01:15:46 2017 - [info]
Thu Sep 21 01:15:47 2017 - [info] Fetching dead master's binary logs..
Thu Sep 21 01:15:47 2017 - [info] Executing command on the dead master db1(192.168.139.141:3306): save_binary_logs --command=save --start_file=mysql-bin.000001 --start_pos=154 --binlog_dir=/usr/local/mysql/data --output_file=/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog --handle_raw_binlog=1 --disable_log_bin=0 --manager_version=0.57
Creating /usr/local/mysql/mha/app1 if not exists.. ok.
Concat binary/relay logs from mysql-bin.000001 pos 154 to mysql-bin.000001 EOF into /usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog ..
Binlog Checksum enabled
Dumping binlog format description event, from position 0 to 154.. ok.
Dumping effective binlog data from /usr/local/mysql/data/mysql-bin.000001 position 154 to tail(177).. ok.
Binlog Checksum enabled
Concat succeeded.
saved_master_binlog_from_db1_3306_20170921011544.binlog 100% 177 86.6KB/s 00:00
Thu Sep 21 01:15:48 2017 - [info] scp from root@192.168.139.141:/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog to local:/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog succeeded.
Thu Sep 21 01:15:48 2017 - [info] HealthCheck: SSH to db2 is reachable.
Thu Sep 21 01:15:49 2017 - [info] HealthCheck: SSH to mha-manager is reachable.
Thu Sep 21 01:15:49 2017 - [info]
Thu Sep 21 01:15:49 2017 - [info] * Phase 3.3: Determining New Master Phase..
Thu Sep 21 01:15:49 2017 - [info]
Thu Sep 21 01:15:49 2017 - [info] Finding the latest slave that has all relay logs for recovering other slaves..
Thu Sep 21 01:15:49 2017 - [info] All slaves received relay logs to the same position. No need to resync each other.
Thu Sep 21 01:15:49 2017 - [info] Searching new master from slaves..
Thu Sep 21 01:15:49 2017 - [info] Candidate masters from the configuration file:
Thu Sep 21 01:15:49 2017 - [info] db2(192.168.139.142:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:49 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:49 2017 - [info] Primary candidate for the new Master (candidate_master is set)
Thu Sep 21 01:15:49 2017 - [info] Non-candidate masters:
Thu Sep 21 01:15:49 2017 - [info] mha-manager(192.168.139.143:3306) Version=5.7.18-14-log (oldest major version between slaves) log-bin:enabled
Thu Sep 21 01:15:49 2017 - [info] Replicating from 192.168.139.141(192.168.139.141:3306)
Thu Sep 21 01:15:49 2017 - [info] Not candidate for the new Master (no_master is set)
Thu Sep 21 01:15:49 2017 - [info] Searching from candidate_master slaves which have received the latest relay log events..
Thu Sep 21 01:15:49 2017 - [info] New master is db2(192.168.139.142:3306)
Thu Sep 21 01:15:49 2017 - [info] Starting master failover..
Thu Sep 21 01:15:49 2017 - [info]
From:
db1(192.168.139.141:3306) (current master)
+--db2(192.168.139.142:3306)
+--mha-manager(192.168.139.143:3306)
To:
db2(192.168.139.142:3306) (new master)
+--mha-manager(192.168.139.143:3306)
Thu Sep 21 01:15:49 2017 - [info]
Thu Sep 21 01:15:49 2017 - [info] * Phase 3.3: New Master Diff Log Generation Phase..
Thu Sep 21 01:15:49 2017 - [info]
Thu Sep 21 01:15:49 2017 - [info] This server has all relay logs. No need to generate diff files from the latest slave.
Thu Sep 21 01:15:49 2017 - [info] Sending binlog..
saved_master_binlog_from_db1_3306_20170921011544.binlog 100% 177 144.8KB/s 00:00
Thu Sep 21 01:15:50 2017 - [info] scp from local:/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog to root@db2:/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog succeeded.
Thu Sep 21 01:15:50 2017 - [info]
Thu Sep 21 01:15:50 2017 - [info] * Phase 3.4: Master Log Apply Phase..
Thu Sep 21 01:15:50 2017 - [info]
Thu Sep 21 01:15:50 2017 - [info] *NOTICE: If any error happens from this phase, manual recovery is needed.
Thu Sep 21 01:15:50 2017 - [info] Starting recovery on db2(192.168.139.142:3306)..
Thu Sep 21 01:15:50 2017 - [info] Generating diffs succeeded.
Thu Sep 21 01:15:50 2017 - [info] Waiting until all relay logs are applied.
Thu Sep 21 01:15:50 2017 - [info] done.
Thu Sep 21 01:15:50 2017 - [info] Getting slave status..
Thu Sep 21 01:15:50 2017 - [info] This slave(db2)'s Exec_Master_Log_Pos equals to Read_Master_Log_Pos(mysql-bin.000001:154). No need to recover from Exec_Master_Log_Pos.
Thu Sep 21 01:15:50 2017 - [info] Connecting to the target slave host db2, running recover script..
Thu Sep 21 01:15:50 2017 - [info] Executing command: apply_diff_relay_logs --command=apply --slave_user='root' --slave_host=db2 --slave_ip=192.168.139.142 --slave_port=3306 --apply_files=/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog --workdir=/usr/local/mysql/mha/app1 --target_version=5.7.18-14-log --timestamp=20170921011544 --handle_raw_binlog=1 --disable_log_bin=0 --manager_version=0.57 --slave_pass=xxx
Thu Sep 21 01:15:50 2017 - [info]
MySQL client version is 5.7.18. Using --binary-mode.
Applying differential binary/relay log files /usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog on db2:3306. This may take long time...
Applying log files succeeded.
Thu Sep 21 01:15:50 2017 - [info] All relay logs were successfully applied.
Thu Sep 21 01:15:50 2017 - [info] Getting new master's binlog name and position..
Thu Sep 21 01:15:50 2017 - [info] mysql-bin.000001:154
Thu Sep 21 01:15:50 2017 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='db2 or 192.168.139.142', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=154, MASTER_USER='repl', MASTER_PASSWORD='xxx';
Thu Sep 21 01:15:50 2017 - [warning] master_ip_failover_script is not set. Skipping taking over new master IP address.
Thu Sep 21 01:15:50 2017 - [info] Setting read_only=0 on db2(192.168.139.142:3306)..
Thu Sep 21 01:15:50 2017 - [info] ok.
Thu Sep 21 01:15:50 2017 - [info] ** Finished master recovery successfully.
Thu Sep 21 01:15:50 2017 - [info] * Phase 3: Master Recovery Phase completed.
Thu Sep 21 01:15:50 2017 - [info]
Thu Sep 21 01:15:50 2017 - [info] * Phase 4: Slaves Recovery Phase..
Thu Sep 21 01:15:50 2017 - [info]
Thu Sep 21 01:15:50 2017 - [info] * Phase 4.1: Starting Parallel Slave Diff Log Generation Phase..
Thu Sep 21 01:15:50 2017 - [info]
Thu Sep 21 01:15:50 2017 - [info] -- Slave diff file generation on host mha-manager(192.168.139.143:3306) started, pid: 42454. Check tmp log /usr/local/mysql/mha/app1/mha-manager_3306_20170921011544.log if it takes time..
Thu Sep 21 01:15:51 2017 - [info]
Thu Sep 21 01:15:51 2017 - [info] Log messages from mha-manager ...
Thu Sep 21 01:15:51 2017 - [info]
Thu Sep 21 01:15:50 2017 - [info] This server has all relay logs. No need to generate diff files from the latest slave.
Thu Sep 21 01:15:51 2017 - [info] End of log messages from mha-manager.
Thu Sep 21 01:15:51 2017 - [info] -- mha-manager(192.168.139.143:3306) has the latest relay log events.
Thu Sep 21 01:15:51 2017 - [info] Generating relay diff files from the latest slave succeeded.
Thu Sep 21 01:15:51 2017 - [info]
Thu Sep 21 01:15:51 2017 - [info] * Phase 4.2: Starting Parallel Slave Log Apply Phase..
Thu Sep 21 01:15:51 2017 - [info]
Thu Sep 21 01:15:51 2017 - [info] -- Slave recovery on host mha-manager(192.168.139.143:3306) started, pid: 42457. Check tmp log /usr/local/mysql/mha/app1/mha-manager_3306_20170921011544.log if it takes time..
saved_master_binlog_from_db1_3306_20170921011544.binlog 100% 177 271.5KB/s 00:00
Thu Sep 21 01:15:53 2017 - [info]
Thu Sep 21 01:15:53 2017 - [info] Log messages from mha-manager ...
Thu Sep 21 01:15:53 2017 - [info]
Thu Sep 21 01:15:51 2017 - [info] Sending binlog..
Thu Sep 21 01:15:52 2017 - [info] scp from local:/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog to root@mha-manager:/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog succeeded.
Thu Sep 21 01:15:52 2017 - [info] Starting recovery on mha-manager(192.168.139.143:3306)..
Thu Sep 21 01:15:52 2017 - [info] Generating diffs succeeded.
Thu Sep 21 01:15:52 2017 - [info] Waiting until all relay logs are applied.
Thu Sep 21 01:15:52 2017 - [info] done.
Thu Sep 21 01:15:52 2017 - [info] Getting slave status..
Thu Sep 21 01:15:52 2017 - [info] This slave(mha-manager)'s Exec_Master_Log_Pos equals to Read_Master_Log_Pos(mysql-bin.000001:154). No need to recover from Exec_Master_Log_Pos.
Thu Sep 21 01:15:52 2017 - [info] Connecting to the target slave host mha-manager, running recover script..
Thu Sep 21 01:15:52 2017 - [info] Executing command: apply_diff_relay_logs --command=apply --slave_user='root' --slave_host=mha-manager --slave_ip=192.168.139.143 --slave_port=3306 --apply_files=/usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog --workdir=/usr/local/mysql/mha/app1 --target_version=5.7.18-14-log --timestamp=20170921011544 --handle_raw_binlog=1 --disable_log_bin=0 --manager_version=0.57 --slave_pass=xxx
Thu Sep 21 01:15:52 2017 - [info]
MySQL client version is 5.7.18. Using --binary-mode.
Applying differential binary/relay log files /usr/local/mysql/mha/app1/saved_master_binlog_from_db1_3306_20170921011544.binlog on mha-manager:3306. This may take long time...
Applying log files succeeded.
Thu Sep 21 01:15:52 2017 - [info] All relay logs were successfully applied.
Thu Sep 21 01:15:52 2017 - [info] Resetting slave mha-manager(192.168.139.143:3306) and starting replication from the new master db2(192.168.139.142:3306)..
Thu Sep 21 01:15:52 2017 - [info] Executed CHANGE MASTER.
Thu Sep 21 01:15:52 2017 - [info] Slave started.
Thu Sep 21 01:15:53 2017 - [info] End of log messages from mha-manager.
Thu Sep 21 01:15:53 2017 - [info] -- Slave recovery on host mha-manager(192.168.139.143:3306) succeeded.
Thu Sep 21 01:15:53 2017 - [info] All new slave servers recovered successfully.
Thu Sep 21 01:15:53 2017 - [info]
Thu Sep 21 01:15:53 2017 - [info] * Phase 5: New master cleanup phase..
Thu Sep 21 01:15:53 2017 - [info]
Thu Sep 21 01:15:53 2017 - [info] Resetting slave info on the new master..
Thu Sep 21 01:15:53 2017 - [info] db2: Resetting slave info succeeded.
Thu Sep 21 01:15:53 2017 - [info] Master failover to db2(192.168.139.142:3306) completed successfully.
Thu Sep 21 01:15:53 2017 - [info] Deleted server1 entry from /etc/app1.cnf .
Thu Sep 21 01:15:53 2017 - [info]
----- Failover Report -----
app1: MySQL Master failover db1(192.168.139.141:3306) to db2(192.168.139.142:3306) succeeded
Master db1(192.168.139.141:3306) is down!
Check MHA Manager logs at localhost.localdomain for details.
Started automated(non-interactive) failover.
The latest slave db2(192.168.139.142:3306) has all relay logs for recovery.
Selected db2(192.168.139.142:3306) as a new master.
db2(192.168.139.142:3306): OK: Applying all logs succeeded.
mha-manager(192.168.139.143:3306): This host has the latest relay log events.
Generating relay diff files from the latest slave succeeded.
mha-manager(192.168.139.143:3306): OK: Applying all logs succeeded. Slave started, replicating from db2(192.168.139.142:3306)
db2(192.168.139.142:3306): Resetting slave info succeeded.
Master failover to db2(192.168.139.142:3306) completed successfully.
Failover 후 Master 변경 체크
[root@localhost .ssh]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.7.18-14-log MySQL Community Server (GPL)
Copyright (c) 2009-2017 Percona LLC and/or its affiliates
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 154 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.139.142
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 154
Relay_Log_File: mysqld_relay_bin.000002
Relay_Log_Pos: 320
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 154
Relay_Log_Space: 528
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 30
Master_UUID: e5a92074-9e00-11e7-9edf-000c297fc913
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
반응형
'엔지니어 > Linux' 카테고리의 다른 글
리눅스 multi default gateway(routing) 설정 (0) | 2017.12.21 |
---|---|
Ubuntu 16.04 LTS iptables 설정 (0) | 2017.11.29 |
CentOS 7 + Apache 2.4.X 설치 + Apr + Apr-Util + Pcre (0) | 2017.09.07 |
CentOS (5.x, 6.x)에서 Apache Web Server 2.4.x 설치 (0) | 2017.09.07 |
ActiveMQ Install (0) | 2017.09.07 |