Mysql – Why does replication with SSL fail on the MySQL database in AWS RDS

amazon-rdsawsMySQLreplicationssl

I'm trying to replicate from AWS RDS to my own server. It works without SSL. Whenever I include the SSL property to the slave, it breaks with this error:

error connecting to master
'user@xxxxx.us-west-2.rds.amazonaws.com:3306' – retry-time: 60
retries: 86400

I can log in with SSL to RDS using mysql client without problems:

mysql -h xx.rds.amazon -u user -p --ssl-ca=rds-ca-2015-root.pem --ssl-verify-server-cert

This is the STATUS:

     Slave_IO_State: Connecting to master
                  Master_Host: xxxxx.us-west-2.rds.amazonaws.com
                  Master_User: user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin-changelog.001453
          Read_Master_Log_Pos: 120
               Relay_Log_File: mysqld-relay-bin.000001
                Relay_Log_Pos: 4
        Relay_Master_Log_File: mysql-bin-changelog.001453
             Slave_IO_Running: Connecting
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 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: 120
              Relay_Log_Space: 107
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: Yes
           Master_SSL_CA_File: /etc/mysql/ssl/rds-ca-2015-root.pem
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 2026
                Last_IO_Error: error connecting to master 'user@xxxx.us-west-2.rds.amazonaws.com:3306' - retry-time: 60  retries: 86400
               Last_SQL_Errno: 0
               Last_SQL_Error: 

Again, I want to highlight that REPLICATION works well without using SSL, and SSL works well without using REPLICATION.

Best Answer

You may want to check apparmor/selinux configuration.

Another option is to move your certs to a location already allowed (e.g. /var/lib/mysql).