MySQL SSL replication error - Error_code: 2026 - mysql

Master MySql version - 5.6.24-enterprise-commercial-advanced-log MySQL Enterprise Server
Slave MySql version - 5.7.15-enterprise-commercial-advanced-log MySQL Enterprise Server
SSL replication enabled between the nodes:-
Master SSL config - my.cnf
ssl-ca=/data/mysql_data/ca.pem
ssl-cert=/data/mysql_data/server-cert.pem
ssl-key=/data/mysql_data/server-key.pem
Slave - config
CHANGE MASTER TO MASTER_HOST='ip_address_host', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000013', MASTER_LOG_POS= 507,MASTER_USER='repl', MASTER_SSL=1 , MASTER_SSL_CA='/data/server-cert.pem' , MASTER_SSL_CIPHER=' DHE-RSA-AES256-SHA:AES128-SHA'
Seeing following error in the slave logs -
2017-10-02T17:33:37.348979Z 1 [ERROR] Slave I/O for channel '': error connecting to master 'repl#10.10.*.*:3306' - retry-time: 60 retries: 1, Error_code: 2026

When we downgraded the slave to same version as 5.6, it worked

I had a similar issue but with identical MySQL versions. It happened after an upgrade to 5.7.41.
All self-made certificates were disabled in my.cnf (by the upgrade).
Normal connection with mysql -u my-replication-user -p -h my-awesome-server --ssl worked as expected, but replication slave still could not connect.
I pinpointed it to the actual usage of our old certificates. And they were still used in the master configuration. So, I solved it by deleting the originally given file names of the SSL certificates.
change MASTER to MASTER_SSL_CA = '', MASTER_SSL_CERT = '', MASTER_SSL_KEY = ''

Related

How to set time_zone for Source DB in AWS DMS?

I am trying to migrate a MySQL database to Aurora, but can't get the timezone set.
According to the documentation: "Valid values are the standard time zone abbreviations for the operating system hosting the source MySQL database."
Executing date on my Linux (Ubuntu) machine shows: Thu Dec 7 10:27:48 AEDT 2017.
I have configured the Source Endpoint to use:
Extra connection attributes: initstmt=SET time_zone=AEDT
Which results in my connection test to fail with:
Error Details: [errType=ERROR_RESPONSE, status=1022502, errMessage=Cannot connect to ODBC provider ODBC general error., errDetails= RetCode: SQL_ERROR SqlState: HY000 NativeError: 1298 Message: [unixODBC][MySQL][ODBC 5.3(w) Driver]Unknown or incorrect time zone: 'AEDT' ODBC general error.]
I've tried "Australia/Sydney" as well (same value as in RDS Parameter Groups) but getting the same error.
Any ideas?
I am totally aware of that this should be UTC. Not my choice - legacy.
Update: It seems initstmt=SET time_zone="+11:00" works, but leading to this issue.
Do you want to Migrate MySQL from a Linux server to Aurora, the user replication instead of DMS. DMS will not support many DDL during the data load. So create a replication between MySQL to Aurora.
Master - Your current MySQL.
slave - Aurora.
Prepare:
Both instances are able to communicate with each other.
The master must be 5.5 or greater version.
binlog_format to ROW on the Master MySQL.
Create user for replication:
CREATE USER 'rep_user'#'%' IDENTIFIED BY 'rep_user';
GRANT REPLICATION slave ON *.* TO 'rep_user'#'%' IDENTIFIED BY 'rep_user';
FLUSH PRIVILEGES;
Take dump with Binlog details:
mysqldump -u user -p dbname --master-data=2 > backup.sql
less backup.sql
this will give you the binlog file name and its position.
Restore the Backup:
mysql -h auroraendpoint -u user -p dbname < backup.sql
Enable replication:
CALL mysql.rds_set_external_master ('Master_RDS_EndPoint', 3306, 'Replication_user_name', 'Replication_User_password', 'BinLog_FileName', BingLog_Position, 0);
Strat replication:
call mysql.rds_start_replication;
Cutover:
During the maintenance window do a cutover and make the Aurora as a master.
call mysql.rds_stop_replication;
CALL mysql.rds_reset_external_master;

MySQL daemon failed to start

MySQL won't restart when I try "service mysqld restart"because I'm using this part in my.cnf
master-host = [private-IP-of-db01]
master-user = [replication-username]
master-password = [replication-password]
master-connect-retry = 60
when I comment out these parts! MySQL restarts fine. Why is that so? Also I have to include these lines in my.cnf because of master slave replication and I can't omit them out.
Usually master host information on the slave mysql server is stored in "master.info" file and maintained there. You may want to start mysql without adding the configuration to your "my.cnf" file, the only configuration you may want to add is a "server_id" , Once mysql is up and running, you should setup slave with 'change master command....'.

MySQL replication - Slave won't start mysql service

I'm testing MySQL replication on two virtual machines with VirtualBox running Debian 8.2.
Following tutorials, this is how I set the slave's /etc/mysql/my.cnf:
server-id = 2
master-host = 192.168.56.101
master-connect-retry = 60
master-user = slave
master-password = 123
replicate-do-db = base1
replicate-do-db = base2
relay-log = /var/lib/mysql/slave-relay.log
relay-log-index = /var/lib/mysql/slave-relay-log.index
However, doing so also won't let me start mysql. When I run /etc/init.d/mysql start, it fails. These are the two errors that appear on the logs:
error: Can't connect to local MySQL server through socket '/var/run/mysql/mysqld.sock' (2)
Failed to start LSB: Start and stop the mysql server database daemon
Commenting the master-zzz lines allow mysql to start without a hitch.
The virtual machines can see each other and ping without loss. I've tried changing the my.cnf's master-user and password, as well as creating different replication slave users on the master server, to no avail. What am I doing wrong?
Well, turns out the tutorials I was following were a bit outdated. These are the final configurations of my.cnf files:
#master
bind-address = 0.0.0.0
server-id = 1
log-bin= /var/log/mysql/mysql-bin.log
#slave
server-id = 2
Instead of setting the slave's my.cnf, I used the mysql console:
CHANGE MASTER TO master_host='master_ip', master_user='slave', master_password='slavepass';
As per this manual's instructions: https://downloads.mysql.com/docs/mysql-replication-excerpt-5.0-en.pdf

Switch Master and Slave role in mysql

Mysql Server1 is running as MASTER. -- server id =1
Mysql Server2 is running as SLAVE. -- server id =2
Now DB replication is happening from MASTER to SLAVE.
Switch:
Now when I stop Slave on Server2 and Configure Server1 as Slave (by command CHANGE MASTER TO MASTER_HOST=') and start Slave on server1, the replication failed with below error:
Last_IO_Errno: 1593
Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
Im using MYSQL
Pls help as im new to MYSQL.

MySQL replication - Error connecting to master

I'm trying to set up replication in MySQL but I am being given an error that I do not know how to fix -
ERROR 1218 (08S01): Error connecting to master: Host 'sh047.mydomain.com' is not allowed to connect to this MySQL server
I've added the following code to the master my.ini -
server-id=238429
log-bin=mysql-bin
log-error=mysql-bin.err
binlog_do_db=my_databases_to_replicate {not literal, have listed the correct databases}
And I've added this to the slave my.ini -
server-id=2
master-host=192.168.1.15
master-user=replication
master-password=my_password
master-connect-retry=60
replicate-do-db=my_databases_to_replicate
The user 'replication' exists and the password that I use in the slave my.ini is correct. Any suggestions as to how to fix this would be welcome.
Thanks.
The error message says it all:
Host 'sh047.mydomain.com' is not allowed to connect to this MySQL
server
Make sure the user replication is configurated as replication#sh047.mydomain.com (or, but only for testing purposes: replication#%) on your master database.
If this doesn't work out, check the MySQL Documentation for this, there might be one or two special cases (Linux compilation etc.), where that error might occur, too.