본문 바로가기
MySQL

[MySQL] MySQL 5.7.9 Replication Error Fix - Error_no 1593 , related Master SERVER_UUID

by 돌프홍 2015. 10. 26.


MySQL 5.7.9 를 Replication Slave 로 추가하려고 시도하였는데, 실패했다.


[Replication 정보]


Master DB  : MariaDB 5.5.24

ㄴ Slave DB : MySQL 5.7.9  /  ( 그리고 MySQL 5.7.8-rc )



위 Replication 정보를 바탕으로 하여 CHANGE MASTER TO 구문으로 replication 정보를 입력하고,

start slave 를 시작하면 I/O thread 가 연결 에러가 발생한다.


Last_IO_Errno: 1593

Last_IO_Error: Fatal error: The slave I/O thread stops because a fatal error is encountered when it tries to get the value of SERVER_UUID variable from master.


error log 에는 다음과 같이 남는다.


2015-10-23T07:26:49.143546Z 4 [ERROR] Slave I/O for channel '': Fatal error: The slave I/O thread stops because a fatal error is encountered when it tries to get the value of SERVER_UUID variable from master. Error_code: 1593


원인은, 마스터DB 의 SERVER_UUID 값을 가져오지 못해서 슬레이브 DB 의 I/O thread 가 연결 실패했다는 것이다.


그런데 의문은 여기서부터 시작이다.

MySQL 5.7.8 버전에서는 error log 에 warning 구문이 남지만, Replication 에는 문제 없이 연결이 잘 된다.


2015-10-26T10:00:38.596947Z 2 [Warning] Slave I/O for channel '': Unknown system variable 'SERVER_UUID' on master. A probable cause is that the variable is not supported on the master (version: 5.5.24-MariaDB-log), even though it is on the slave (version: 5.7.8-rc-log), Error_code: 1193


MySQL 5.7.9 버전에서는 error 가 발생하면서 Replication 연결이 실패된다.

하위버전에서 상위버전으로 마이그레이션을 하기 위해 replication 연결을 해야 하는데, 연결 할 수 없는 문제가 발생한다.


MySQL 5.7.8 버전과 MySQL 5.7.9 버전에서 어떤 차이로 인해 Replication 연결 성공 여부가 결졍되는 것인가 ?


마스터 DB 에서 general log 를 활성화 한 뒤에 확인해 보았다.


MASTER_DB> set global general_log = ON ; 



그리고 슬레이브 DB 에서 MySQL 5.7.8 버전과 MySQL 5.7.9 버전 각각에서 Replication 연결을 해 보았다.

마스터 DB에 남은 쿼리의 결과는 다음과 같다.


-- mysql 5.7.8 에서 replication start 시 다음과 같은 명령이 실행된다 ( general log ) 


151026 10:05:12   302 Connect replication@10.10.10.10 as anonymous on

      302 Query SELECT UNIX_TIMESTAMP()

      302 Query SHOW GLOBAL VARIABLES LIKE 'SERVER_ID'

      302 Query SET @master_heartbeat_period= 30000001024

      302 Query SET @master_binlog_checksum= @@global.binlog_checksum

      302 Query SELECT @master_binlog_checksum

      302 Query SELECT @@GLOBAL.GTID_MODE

      302 Query SHOW GLOBAL VARIABLES LIKE 'SERVER_UUID'

      302 Query SET @slave_uuid= '5f141444-72e7-11e5-9072-fa163e688ead'

      302 Binlog Dump Log: 'mysql-binary.000004'  Pos: 527


-- mysql 5.7.9 에서 replication start 시 다음과 같은 명령이 실행된다 ( general log )


151026 10:03:07   299 Connect replication@10.10.10.10 as anonymous on

      299 Query SELECT UNIX_TIMESTAMP()

      299 Query SELECT @@GLOBAL.SERVER_ID

      299 Query SET @master_heartbeat_period= 30000001024

      299 Query SET @master_binlog_checksum= @@global.binlog_checksum

      299 Query SELECT @master_binlog_checksum

      299 Query SELECT @@GLOBAL.GTID_MODE

      299 Query SELECT @@GLOBAL.SERVER_UUID     <--- 여기서  SERVER_UUID 를 얻지 못하면 에러가 발생한다.

      299 Quit



general log 에 남은 차이점을 살펴보면, SERVER_UUID 를 얻어내기 위해 마스터 DB 에 실행하는 명령이 다르다.


MySQL 5.7.8 버전 :  SHOW GLOBAL VARIABLES LIKE 'SERVER_UUID' 구문 사용

MySQL 5.7.9 버전 : SELECT @@GLOBAL.SERVER_UUID 구문 사용 




참고로 마스터 DB 는  mariaDB 5.5 버전이며, 해당 버전은 server_uuid 시스템 변수가 존재하지 않는다.


SERVER_UUID 시스템 변수가 존재하지 않을 경우, 각각 명령 실행 시 리턴되는 문장이 다르다.


-- MySQL 5.7.8

-- 다음 명령으로 실행하면 empty set 이 나오지만 

SHOW GLOBAL VARIABLES LIKE 'SERVER_UUID' ;

Empty set (0.00 sec)


-- MySQL 5.7.9

-- 다음 명령으로 실행하면 에러가 발생한다. 

SELECT @@GLOBAL.SERVER_UUID  ;

ERROR 1193 (HY000): Unknown system variable 'SERVER_UUID'


이와 같은 문제로, 현재 MySQL 5.7.9 버전에서는 마스터 DB 버전에서 시스템 변수로 SERVER_UUID 가 존재하지 않으면

Replication 연결이 불가능한 이슈가 있다.


( 유사 버그 : https://bugs.mysql.com/bug.php?id=77732 )


이 부분이 문제가 된다고 판단하여, MySQL 5.7.9 소스에서 SELECT @@GLOBAL.SERVER_UUID 쿼리를 SHOW GLOBAL VARIABLES LIKE 'SERVER_UUID' ;

로 실행할 수 있도록 변경하고 빌드하였다.


결과는 성공적으로 Replication 연결이 된다.


쿼리는 다음과 같이 실행된다.


-- 슬레이브 DB 에서 버전 및 replication 상태 확인


select @@version ;

+-----------+

| @@version |

+-----------+

| 5.7.9-log |

+-----------+



start slave ;


-- error log 에는 다음과 같이 Warning 으로 남는다.


2015-10-27T04:57:52.716054Z 10 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.

2015-10-27T04:57:52.717232Z 11 [Warning] Slave SQL for channel '': If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0

2015-10-27T04:57:52.717622Z 11 [Note] Slave SQL thread for channel '' initialized, starting replication in log 'mysql-binary.000004' at position 1179, relay log './relay-bin.000006' position: 1097

2015-10-27T04:57:52.719683Z 10 [Note] Slave I/O thread for channel '': connected to master 'replication@10.10.10.10:3306',replication started in log 'mysql-binary.000004' at position 1179

2015-10-27T04:57:52.723828Z 10 [Warning] Slave I/O for channel '': Unknown system variable 'SERVER_UUID' on master. A probable cause is that the variable is not supported on the master (version: 5.5.24-MariaDB), even though it is on the slave (version: 5.7.9-log), Error_code: 1193



1449 Query SELECT UNIX_TIMESTAMP()

1449 Query SELECT @@GLOBAL.SERVER_ID

1449 Query SET @master_heartbeat_period= 30000001024

1449 Query SET @master_binlog_checksum= @@global.binlog_checksum

1449 Query SELECT @master_binlog_checksum

1449 Query SELECT @@GLOBAL.GTID_MODE

1449 Query SHOW GLOBAL VARIABLES LIKE 'SERVER_UUID'

1449 Query SET @slave_uuid= '5f141444-72e7-11e5-9072-fa163e688ead'

1449 Binlog Dump Log: 'mysql-binary.000004'  Pos: 527