I'm trying to do mariadb replication over a ssh tunnel. Here is my config. First, I created a ssh tunnel from my replication server(R1) to my Master server (M1).
ssh -L 13306:localhost:3306 -p 22111 admin@M1 -f -N
Both the mariadb instances are already running on both the servers. And I have already created a replication user on the M1 mariadb instance.
CREATE USER 'replication'@'127.0.0.1' identified by 'xxxx';
GRANT REPLICATION SLAVE on *.* to 'replication'@'127.0.0.1' REQUIRE SSL;
From R1 I check if I can connect to the M1 mariadb instance.
mysql -u replication -pxxxx -h 127.0.0.1 --protocol=TCP -P 13306
The above operation succeeded. But now, when I instruct the replication instance R1 to change master and start slave, it fails.
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='replication', MASTER_PASSWORD='xxxx', MASTER_PORT=13306, MASTER_LOG_FILE='mysql-bin.000022', MASTER_LOG_POS=9164599, MASTER_SSL=1, MASTER_SSL_CA='/etc/tls/ca-cert.pem', MASTER_SSL_CERT='/etc/tls/client-cert.pem', MASTER_SSL_KEY='/etc/tls/client-key.pem', MASTER_CONNECT_RETRY=10;
START SLAVE;
SHOW SLAVE STATUS \G
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 127.0.0.1
Master_User: replication
Master_Port: 13306
Connect_Retry: 10
Master_Log_File: mysql-bin.000022
Read_Master_Log_Pos: 9164599
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000022
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: 9164599
Relay_Log_Space: 249
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: Yes
Master_SSL_CA_File: /etc/tls/ca-cert.pem
Master_SSL_CA_Path:
Master_SSL_Cert: /etc/tls/client-cert.pem
Master_SSL_Cipher:
Master_SSL_Key: /etc/tls/client-key.pem
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 2003
Last_IO_Error: error connecting to master 'ubi_replication@127.0.0.1:13306' - retry-time: 10 retries: 86400 message: Can't connect to MySQL server on '127.0.0.1' (111 "Connection refused")
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_SSL_Crl: /etc/tls/ca-cert.pem
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: conservative
1 row in set (0.00 sec)
Any help pointing to the error config is highly welcome.
Regards,
Ashutosh Singh