I am trying to setup mysql master master replication as mentined in the
https://www.digitalocean.com/community/tutorials/how-to-set-up-mysql-master-master-replication
my two sever config.
Server C:
ubuntu version mysql /etc/mysql/my.cnf
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = example
auto-increment-increment = 2
Server D:
centos /etc/my.cnf
server-id = 2
log_bin = mysql-bin
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = example
auto-increment-increment = 2
auto-increment-offset = 2
I configures this and followed the post as mentioned in the link.
I can only replicate from server C to D.
D to C is not working
Server D
stop slave;
CHANGE MASTER TO MASTER_HOST = '192.168.0.203', MASTER_USER = 'hopereplicate', MASTER_PASSWORD = 'password', MASTER_LOG_FILE = 'mysql-bin.000002', MASTER_LOG_POS = 107;
start slave;
SERVER C
stop slave;
CHANGE MASTER TO MASTER_HOST = '192.168.0.205', MASTER_USER = 'hopereplicate', MASTER_PASSWORD = 'password', MASTER_LOG_FILE = 'mysql-bin.000008', MASTER_LOG_POS = 311;
strat slave;
Any help please ?
Error log on Server D.
2016-12-14T07:19:36.888867Z 0 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--r$
2016-12-14T07:19:36.980635Z 1 [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 PA$
2016-12-14T07:19:36.980976Z 1 [Note] Slave I/O thread for channel '': connected to master 'hopereplicate#192.168.0.203:3306',replication started in log 'mysql-bin.000231' at position 1720
2016-12-14T07:19:36.981192Z 1 [Warning] Slave I/O for channel '': Notifying master by SET #master_binlog_checksum= ##global.binlog_checksum failed with error: Unknown system variable 'binlog_checksum', E$
2016-12-14T07:19:36.981248Z 1 [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.53-0u$
2016-12-14T07:19:36.983493Z 0 [Note] Event Scheduler: Loaded 0 events
2016-12-14T07:19:36.983572Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.16-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
2016-12-14T07:19:36.988889Z 2 [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
2016-12-14T07:19:37.159916Z 2 [Note] Slave SQL thread for channel '' initialized, starting replication in log 'mysql-bin.000231' at position 1720, relay log './server05-relay-bin.000002' position:$
2016-12-14T07:19:55.186781Z 2 [Note] Error reading relay log event for channel '': slave SQL thread was killed
2016-12-14T07:19:55.208979Z 1 [Note] Slave I/O thread killed while reading event for channel ''
2016-12-14T07:19:55.208999Z 1 [Note] Slave I/O thread exiting for channel '', read up to log 'mysql-bin.000231', position 1720
2016-12-14T07:24:10.481707Z 5 [Warning] IP address '192.168.0.203' could not be resolved: Name or service not known
2016-12-14T07:24:10.484472Z 5 [Note] Start binlog_dump to master_thread_id(5) slave_server(1), pos(mysql-bin.000007, 154)
2016-12-14T07:24:10.484491Z 5 [Warning] Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them
2016-12-14T07:25:25.669710Z 4 [Note] 'CHANGE MASTER TO FOR CHANNEL '' executed'. Previous state master_host='192.168.0.203', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New $
2016-12-14T07:25:34.553928Z 6 [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 PA$
2016-12-14T07:25:34.563892Z 7 [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
2016-12-14T07:25:34.563921Z 7 [Note] Slave SQL thread for channel '' initialized, starting replication in log 'mysql-bin.000002' at position 107, relay log './server05-relay-bin.000001' position: 4
2016-12-14T07:25:34.749727Z 6 [Note] Slave I/O thread for channel '': connected to master 'hopereplicate#192.168.0.203:3306',replication started in log 'mysql-bin.000002' at position 107
2016-12-14T07:25:34.749962Z 6 [Warning] Slave I/O for channel '': Notifying master by SET #master_binlog_checksum= ##global.binlog_checksum failed with error: Unknown system variable 'binlog_checksum', E$
2016-12-14T07:25:34.750009Z 6 [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.53-0u$
2016-12-14T07:26:26.348302Z 8 [Note] Start binlog_dump to master_thread_id(8) slave_server(1), pos(mysql-bin.000008, 311)
2016-12-14T07:26:26.348326Z 8 [Warning] Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them
2016-12-14T07:47:15.388940Z 0 [Note] Giving 2 client threads a chance to die gracefully
2016-12-14T07:47:15.388957Z 0 [Note] Shutting down slave threads
2016-12-14T07:47:15.388973Z 7 [Note] Error reading relay log event for channel '': slave SQL thread was killed
2016-12-14T07:47:15.437794Z 6 [Note] Slave I/O thread killed while reading event for channel ''
2016-12-14T07:47:15.437812Z 6 [Note] Slave I/O thread exiting for channel '', read up to log 'mysql-bin.000002', position 327
2016-12-14T07:47:15.446619Z 0 [Note] Forcefully disconnecting 0 remaining clients
The problem is that the two versions of MySQL server are not the same.
This created an incompatibility identified in the logs:
[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.53-0u$
Updating the servers to both the same should sort this issue out.
Related
In my MySQL 5.6 environment, I have A -> B -> C replication setup. On C slave, there is no mysql binlog generated since I set it up as a slave. But the replication is running per show slave status. The Slave_SQL_Running_State showed "Slave has read all relay log; waiting for the slave I/O thread to update it". The show master status on C slave showed it is on "mysql-bin.000003" position 120. That file was dated on Nov 29, not today. I have checked C slave my.cnf and I have binlog configured:
log-bin=/mysql-binlog/mysql-bin
binlog_format=mixed
max_binlog_size = 200M
There is relay-bin log on C slave generated and kept current.
What is the reason C slave has no binlog?
I use MySQL-8.0.12 to setup a master-slave replication cluster. But slave always gets following errors, does anyone know how to fix this ?
2018-11-01T04:17:58.327576Z 19 [ERROR] [MY-010834] [Server] next log
error: -1 offset: 50 log: ./mysql-relay-bin.000002 included: 1,
2018-11-01T04:17:58.327675Z 19 [ERROR] [MY-010596] [Repl] Error
reading relay log event for channel '': Error purging processed logs,
2018-11-01T04:17:58.327932Z 19 [ERROR] [MY-013121] [Repl] Slave SQL
for channel '': Relay log read failure: Could not parse relay log
event entry. The possible reasons are: the master's binary log is
corrupted (you can check this by running 'mysqlbinlog' on the binary
log), the slave's relay log is corrupted (you can check this by
running 'mysqlbinlog' on the relay log), a network problem, or a bug
in the master's or slave's MySQL code. If you want to check the
master's binary log or slave's relay log, you will be able to know
their names by issuing 'SHOW SLAVE STATUS' on this slave. Error_code:
MY-013121,
2018-11-01T04:17:58.327982Z 19 [ERROR] [MY-010586] [Repl] Error
running query, slave SQL thread aborted. Fix the problem, and restart
the slave SQL thread with "SLAVE START". We stopped at log
'mysql-bin.000003' position 805
check disk space in slave
faced the same issue once.
during the replication, if slave server disk is full and no space left mysql replication thread wait for the disk to be freed wait time is 60 sec if the server restarted during that time then relay log cannot be recovered and slave cannot read the relay log.
I'm experiencing some trouble setting up mysql replication between a master & a slave..
I did the setup successfully, but data doesn't update.
Master : show master status;
[File]: mysql-bin.000033
[Position]: 1757196
[Binlog_Do_DB]: ciel
Master : show processlist;
[User]: slave
[Host]: 92.222.177.xxx:57578 ( right slave ip )
[db]:
[Command]: Binlog Dump
[Time]: 1231
[State]: Has sent all binlog to slave; waiting for binlog to be updated
Slave : show slave status;
[Slave_IO_State]: Waiting for master to send event
[Master_Host]: 46.105.122.xxx
[Master_User]: slave
[Master_Port]: 3306
[Connect_Retry]: 60
[Master_Log_File]: mysql-bin.000033
[Read_Master_Log_Pos]: 1757196
[Relay_Log_File]: mysqld-relay-bin.000006
[Relay_Log_Pos]: 252
[Relay_Master_Log_File]: mysql-bin.000033
[Slave_IO_Running]: Yes
[Slave_SQL_Running]: Yes
[Replicate_Do_DB]: ciel
[Exec_Master_Log_Pos]: 1757196
[Relay_Log_Space]: 409
[Until_Condition]: None
[Master_SSL_Allowed]: No
[Master_SSL_Verify_Server_Cert]: No
[Master_Server_Id]: 1
Slave : show proccesslist;
[User]: system user
[Host]:
[db]:
[Command]: Connect
[Time]: 1231
[State]: Waiting for master to send event
[Info]:
[Id]: 2
[User]: system user
[Host]:
[db]:
[Command]: Connect
[Time]: 1231
[State]: Slave has read all relay log; waiting for the slave I/O thread to update it
then selecting data on master :
master: lastmod: 2014-10-26 17:14:55
slave: lastmod: 2014-10-26 15:45:45
I'm feeling lost, because I'm still not finding after 8 hours, how to set this up correctly.
I am trying to configure master-master replication however I am getting an error. I am sending my configuration below
Server A
server-id = 1
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 1
master-host = Kooler-PC
master-user = replicacao
master-password = replicacao
master-connect-retry = 60
replicate-do-db = gestao_quadra
log-bin = C:\mysql\log\log-bin.log
binlog-do-db = gestao_quadra
CHANGE MASTER TO MASTER_HOST='Kooler-PC', MASTER_USER='replicacao', MASTER_PASSWORD='replicacao', MASTER_LOG_FILE='log-bin.log ', MASTER_LOG_POS=0;
I am have done the same steps for other server changing server-id, host and created the file in the path.
I get this error:
130218 18:03:02 [Note] Slave I/O thread: connected to master 'replicacao#Kooler-PC:3306',replication started in log 'log-bin.log ' at position 4
130218 18:03:02 [ERROR] Error reading packet from server: Binary log is not open ( server_errno=1236)
130218 18:03:02 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Binary log is not open', Error_code: 1236
130218 18:03:02 [Note] Slave I/O thread exiting, read up to log 'log-bin.log ', position 4
I am using MySQL 5.5
So if you read the mysql manual on replication an binary logging, it would tell you that this line:
log-bin = C:\mysql\log\log-bin.log
Does not create a log file with exactly that name. It specifies the base name. The log files that actually get created would be named:
C:\mysql\log\log-bin.log.000001
That is to say the actual logs have a sequence number appended to the end of the name you specified. To see the actual log names use the command:
SHOW MASTER STATUS
SHOW BINARY LOGS;
This part of your change master statement is not valid:
MASTER_LOG_FILE='log-bin.log ', MASTER_LOG_POS=0;
There's no part of any replication related instructions I've ever read which would lead you to use position 0. You have to use the master's binary log file and position that correspond to the snapshot of the data with which you initialized the slave.
See the manual for more info. Start with basic master->slave replication first before you attempt more complex replication structures. http://dev.mysql.com/doc/refman/5.5/en/replication.html
I have multiple servers set up with MySQL one-way replication for backup purposes. On one of these slaves I have a problem. Exactly each 10 minutes it loses connection and reconnects without problems. Example from error log:
121216 18:05:49 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000002' at position 782733912
121216 18:05:49 [ERROR] Slave I/O: error reconnecting to master 'repl#127.0.0.1:5002' - retry-time: 60 retries: 86400, Error_code: 2013
121216 18:06:49 [Note] Slave: connected to master 'repl#127.0.0.1:5002',replication resumed in log 'mysql-bin.000002' at position 782733912
121216 18:15:49 [ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)
121216 18:15:49 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000002' at position 822218944
121216 18:15:49 [ERROR] Slave I/O: error reconnecting to master 'repl#127.0.0.1:5002' - retry-time: 60 retries: 86400, Error_code: 2013
121216 18:16:49 [Note] Slave: connected to master 'repl#127.0.0.1:5002',replication resumed in log 'mysql-bin.000002' at position 822218944
121216 18:25:49 [ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)
121216 18:25:49 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000002' at position 850106111
121216 18:25:49 [ERROR] Slave I/O: error reconnecting to master 'repl#127.0.0.1:5002' - retry-time: 60 retries: 86400, Error_code: 2013
So, everything works, but the error log is flooded with messages.
I looked at various MySQL settings, but I don't see any set to 10 minutes or 600 seconds.
FWIW, replication works through SSH tunnel using AutoSSH. I looked into sshd_config, but also do not see any timeout setting.
Which setting should I look into?
I am looking at some similar problems lately and it turns out that our firewall blocks autossh monitoring port thus autossh restarts ssh every 10 mins. This may happen to you too.
Check your autossh log. It is usually /var/log/syslog unless you specifies AUTOSSH_LOGFILE
As #interskh pointed out, the culprit may be ssh. My /var/log/syslog contained messages like the following:
Sep 15 16:34:57 servername autossh[2799]: timeout polling to accept read connection
Sep 15 16:34:57 servername autossh[2799]: port down, restarting ssh
Sep 15 16:34:57 servername autossh[2799]: starting ssh (count 136)
Sep 15 16:34:57 servername autossh[2799]: ssh child pid is 11664
I found a Debian bug report thread that suggested that contrary to many tutorials, it isn't necessary to include the -M parameter. Since version 1.4a-1, autossh will use a randomly selected "high" port by default (which is arguably better than manually specifying a monitoring port with -M).
Omitting the -M flag solved the problem for me.
Previous command (restarts the SSH connection every 10 minutes)
autossh -p2223 -M 20000 -f username#example.com -L 12345:127.0.0.1:3306 -N
New (working) command
autossh -p2223 -f username#example.com -L 12345:127.0.0.1:3306 -N
In case it helps anyone, our SSH client is running Ubuntu and the SSH server is running CentOS.