MySQLのSSLレプリケーションを試みるがSlave_IO_RunningがConnectingのまま変わらない。
下記の公式バイナリを使ってSSLレプリケーションを試みたら嵌った話。(解決済み)
mysql-5.5.24-linux2.6-x86_64.tar.gz
症状
もろもろの設定を終えてスレーブ側でSTART SLAVE
mysql> START SLAVE; Query OK, 0 rows affected (0.00 sec)
SHOW SLAVE STATUSで確認すると、Slave_IO_Running(★)が「Connecting」のまま変わらない・・・
mysql> SHOW SLAVE STATUS\G *************************** 1. row *************************** Slave_IO_State: Connecting to master Master_Host: xxx.xxx.xxx.xxx Master_User: slave_one Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000002 Read_Master_Log_Pos: 539 Relay_Log_File: hostname-relay-bin.000003 Relay_Log_Pos: 4 Relay_Master_Log_File: mysql-bin.000003 Slave_IO_Running: Connecting ★ 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: 255 Relay_Log_Space: 107 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: Yes Master_SSL_CA_File: /path/to/ca.pem Master_SSL_CA_Path: Master_SSL_Cert: /path/to/server-cert.pem Master_SSL_Cipher: Master_SSL_Key: /path/to/server-key.pem Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 2026 Last_IO_Error: error connecting to master 'slave_user@xxx.xxx.xxx.xxx:3306' - retry-time: 60 retries: 86400 Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 0 1 row in set (0.00 sec)
mysqldのログを見るとマスターに接続できないとのエラーが出ている。
120531 24:00:00 [ERROR] Slave I/O: error connecting to master 'slave_user@xxx.xxx.xxx.xxx:3306' - retry-time: 60 retries: 86400, Error_code: 2026
原因が見えてこないので手動で接続しようとすると・・・ん?プロトコルのバージョンが合わない?
# mysql -u slave_user -p -h xxx.xxx.xxx.xxx --ssl-ca=/path/to/ca.pem \ --ssl-cert=/path/to/server-cert.pem --ssl-key=/path/to/server-key.pem Enter password: ERROR 2026 (HY000): SSL connection error: protocol version mismatch
解決
証明書を作成する際に使ったOpenSSLを 1.0.0 から 0.9.8e に変更したら直った。