2017-05-15 2 views
1

MySQL 데이터베이스의 고 가용성을 달성하기 위해 mysqlfailover 유틸리티를 사용하고 있습니다. 내가--exec-after 스크립트를 실행할 때 응답 없음

mysqlfailover --master=root:[email protected]:3306 --slaves=root:[email protected]:3306 --rpl-user=slave-user:slave-pass --log=log.txt --force --daemon=start 

를 실행하고 때 모든 것이 잘 실행되고 그리고 마스터의 MySQL 데몬을 중지하고 때 출력

2017-05-15 12:41:06 PM INFO Server 'master-host:3306' is using MySQL version 5.6.36-log. 
2017-05-15 12:41:06 PM INFO Server 'slave-host:3306' is using MySQL version 5.6.36-log. 
2017-05-15 12:41:06 PM INFO Unregistering instance on master. 
2017-05-15 12:41:06 PM INFO Checking privileges. 
2017-05-15 12:41:06 PM INFO Unregistering existing instances from slaves. 
2017-05-15 12:41:06 PM INFO Registering instance on master. 
2017-05-15 12:41:06 PM INFO Failover daemon started. 
2017-05-15 12:41:06 PM INFO Failover mode = auto. 
2017-05-15 12:41:09 PM INFO Master Information 
2017-05-15 12:41:09 PM INFO Binary Log File: mysql-bin.000020, Position: 191, Binlog_Do_DB: N/A, Binlog_Ignore_DB: N/A 
2017-05-15 12:41:09 PM INFO GTID Executed Set: 952b004a-3567-11e7-b46e-0a767d02b017:1-10 
2017-05-15 12:41:09 PM INFO Getting health for master: master-host:3306. 
2017-05-15 12:41:09 PM INFO Health Status: 
2017-05-15 12:41:09 PM INFO host: master-host, port: 3306, role: MASTER, state: UP, gtid_mode: ON, health: OK 
2017-05-15 12:41:09 PM INFO host: slave-host, port: 3306, role: SLAVE, state: UP, gtid_mode: ON, health: OK 

에 따라 생산하고, 출력은

2017-05-15 12:40:01 PM INFO Master may be down. Waiting for 3 seconds. 
2017-05-15 12:40:16 PM INFO Failed to reconnect to the master after 3 attemps. 
2017-05-15 12:40:16 PM CRITICAL Master is confirmed to be down or unreachable. 
2017-05-15 12:40:16 PM INFO Failover starting in 'auto' mode... 
2017-05-15 12:40:16 PM INFO Candidate slave slave-host:3306 will become the new master. 
2017-05-15 12:40:16 PM INFO Checking slaves status (before failover). 
2017-05-15 12:40:16 PM INFO Preparing candidate for failover. 
2017-05-15 12:40:16 PM INFO Creating replication user if it does not exist. 
2017-05-15 12:40:16 PM INFO Stopping slaves. 
2017-05-15 12:40:16 PM INFO Performing STOP on all slaves. 
2017-05-15 12:40:16 PM INFO Switching slaves to new master. 
2017-05-15 12:40:16 PM INFO Disconnecting new master as slave. 
2017-05-15 12:40:16 PM INFO Starting slaves. 
2017-05-15 12:40:16 PM INFO Performing START on all slaves. 
2017-05-15 12:40:16 PM INFO Checking slaves for errors. 
2017-05-15 12:40:16 PM INFO Failover complete. 
2017-05-15 12:40:21 PM INFO Unregistering existing instances from slaves. 
2017-05-15 12:40:21 PM INFO Registering instance on new master slave-host:3306. 
2017-05-15 12:40:22 PM INFO Master Information 
2017-05-15 12:40:22 PM INFO Binary Log File: mysql-bin.000003, Position: 191, Binlog_Do_DB: N/A, Binlog_Ignore_DB: N/A 
2017-05-15 12:40:22 PM INFO GTID Executed Set: 952b004a-3567-11e7-b46e-0a767d02b017:1-10 
2017-05-15 12:40:22 PM INFO Getting health for master: slave-host:3306. 
2017-05-15 12:40:22 PM INFO Health Status: 
2017-05-15 12:40:22 PM INFO host: slave-host, port: 3306, role: MASTER, state: UP, gtid_mode: ON, health: OK 

이다 그러나 나는 실행할 스위치 오버 또는 장애 조치 (failover) 후 스크립트가 수행됩니다. 스크립트의 목적은 무엇인가 내 응용 프로그램의 데이터베이스 연결과 관련이 있지만, 현재 나는 다음과 같은 내용으로 샘플 스크립트를 exec.sh를 실행하고 있지만

#!/bin/bash 
echo "creating a new file after failover" 
touch troubleshoot.txt 
exit 0 

그리고 지금은 명령

mysqlfailover --master=root:[email protected]:3306 --slaves=root:[email protected]:3306 --rpl-user=slave-user:slave-pass --log=log.txt --force --daemon=start --exec-after="./exec.sh" 
을 실행하고

는 마스터에 등록 취소 인스턴스에서 중지되고, 출력

2017-05-15 13:04:42 PM INFO Master may be down. Waiting for 3 seconds. 
2017-05-15 13:04:57 PM INFO Failed to reconnect to the master after 3 attemps. 
2017-05-15 13:04:57 PM CRITICAL Master is confirmed to be down or unreachable. 
2017-05-15 13:04:57 PM INFO Failover starting in 'auto' mode... 
2017-05-15 13:04:57 PM INFO Candidate slave slave-host:3306 will become the new master. 
2017-05-15 13:04:57 PM INFO Checking slaves status (before failover). 
2017-05-15 13:04:57 PM INFO Preparing candidate for failover. 
2017-05-15 13:04:57 PM INFO Creating replication user if it does not exist. 
2017-05-15 13:04:57 PM INFO Spawning external script. 
2017-05-15 13:04:57 PM INFO Unregistering instance on master 
,536 인

출력에 "외부 스크립트 생성"이라고 표시되어 있지만이 단계 후에 아무 일도 일어나지 않습니다. 또한 스크립트가 실행 종료 권한과 0 종료 상태를 가지고 있는지 확인했습니다. 앞으로의 실행을 멈추는 문제가 무엇인지 알아 내도록 도와주세요.

+0

아마 obvous라고 말하지만 상대 경로 대신 스크립트의 전체 경로를 제공하려고 시도 했습니까? – lloiacono

+1

@lloiacono 예, 전체 경로를 지정했습니다. 감사. –

답변

0

상대 경로 대신 스크립트의 전체 경로를 입력해야합니다.

mysqlfailover --master=root:[email protected]:3306 --slaves=root:[email protected]:3306 --rpl-user=slave-user:slave-pass --log=log.txt --force --daemon=start --exec-after="/full/path/to/exec.sh" 
관련 문제