My configuration:
Master (Mysql 5.5.33)
Slave (MariaDb 5.5.33)
Slave status:
Variable Value
Slave_IO_State Waiting for master to send event
Master_Host 127.0.0.1
Master_User sn1
Master_Port 12345
Connect_Retry 60
Master_Log_File mysql-bin.000011
Read_Master_Log_Pos 1535
Relay_Log_File mysqld-relay-bin.000014
Relay_Log_Pos 391
Relay_Master_Log_File mysql-bin.000011
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB sn1db2
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 1535
Relay_Log_Space 2260
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master 0
After the inserting of a row in a table on master, the slave receive the change but don't apply it.
I disabled on slave the following features:
master_verify_checksum=OFF
slave_sql_verify_checksum=0
binlog_checksum=NONE
and I verified that are effectually disabled.
I verified the mariadb log:
Slave I/O: Notifying master by SET master_binlog_checksum= global.binlog_checksum failed with error: Unknown system variable binlog_checksum, Error_code: 1193
Can somebody help me?
I solved with this option on slave my.cnf file:
replicate-rewrite-db=sn1db->sn1db2
Related
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.
I have a 4 machine mysql cluster running mariadb 10.0.21. I have two masters setup, that are slaving off of each other. And then two read-only slaves that are replicating from the 1st and 2nd db’s respectively.
In short, the way its setup is like this:
db1 replicates -> db2
db1 replicates -> db3
db2 replicates -> db1
db2 replicates -> db4
It's a pretty basic 4 db setup.
The problem I'm having is that I setup a nagios user to monitor the cluster on the 1st db.
I checked and I could log into the first 3 databases but not the 4th one with the nagios user. I could do that without creating the nagios user on each db because I'm replicating my mysql database on the first two database machines.
But for some reason the nagios user never was created on db4 the way it was on db2 even tho replication seems fine on all nodes.
As you probably recall, I have db 2 replicating to the 4th db.
And if I do a show master status on db 2, I can see that I'm replicating the mysql db:
MariaDB [mysql]> show master status;
+--------------------+----------+------------------------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+------------------------------+------------------+
| mariadb-bin.000078 | 376 | jfwiki,jokefire,bacula,mysql | |
+--------------------+----------+------------------------------+------------------+
1 row in set (0.00 sec)
If I check that the nagios user is there on the 2nd db, it is.
MariaDB [mysql]> select User,Host,Password from user where user like 'nagios';
+--------+-------------+-------------------------------------------+
| User | Host | Password |
+--------+-------------+-------------------------------------------+
| nagios | 52.4.204.96 | *somepasswordhash |
+--------+-------------+-------------------------------------------+
1 row in set (0.00 sec)
This user was not created on db2, but is there because of the replication.
And if I check the slave status on db4, replication seems completely fine:
[root#db4:~] #mysql -e "show slave status\G" | egrep "Slave_IO_State|Master_Host|Slave_IO_Running|Slave_SQL_Running|Last_Errno|Seconds_Behind_Master"
Slave_IO_State: Waiting for master to send event
Master_Host: db2.example.com
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Last_Errno: 0
Seconds_Behind_Master: 0
And if I check for the presence of the nagios user on db4 the way I did on db2, the user just isn't there:
MariaDB [mysql]> select User,Host from user where user like 'nagios';
Empty set (0.00 sec)
So my question is, why did the nagios user not get replicated to db4 the way it did from db1 -> db2 and from db1 -> db3? Even tho slave replication on db4 seems to be okay? I could log into all those hosts using the nagios user from the monitoring host.
Here's the full output of the slave replication command on db4 in case I missed anything from my grep earlier:
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: db2.example.com
Master_User: jf_slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000078
Read_Master_Log_Pos: 376
Relay_Log_File: db4-relay-bin.000044
Relay_Log_Pos: 537
Relay_Master_Log_File: mariadb-bin.000078
Slave_IO_Running: Yes
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: 376
Relay_Log_Space: 1121
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: Yes
Master_SSL_CA_File: /opt/mysql/ca.crt
Master_SSL_CA_Path:
Master_SSL_Cert: /opt/mysql/db4.example.com.crt
Master_SSL_Cipher:
Master_SSL_Key: /opt/mysql/db4.example.com.key
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
Master_SSL_Crl: /opt/mysql/ca.crt
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
1 row in set (0.00 sec)
I am seeing some errors in the mariadb logs on db4, however they're no different than the errors I'm seeing on the 1st 3 databases where the nagios user data replicated successfully.
151004 15:34:36 [Note] Error reading relay log event: slave SQL thread was killed
151004 15:34:36 [ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)
151004 15:34:36 [Note] Slave I/O thread killed while reading event
151004 15:34:36 [Note] Slave I/O thread exiting, read up to log 'mariadb-bin.000078', position 376
151004 15:36:47 [Note] Slave SQL thread initialized, starting replication in log 'mariadb-bin.000078' at position 376, relay log './db4-relay-bin.000042' position: 537
151004 15:36:47 [Note] Slave I/O thread: connected to master 'jf_slave#db2.example.com:3306',replication started in log 'mariadb-bin.000078' at position 376
151007 4:24:12 [Note] Error reading relay log event: slave SQL thread was killed
151007 4:24:12 [ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)
151007 4:24:12 [Note] Slave I/O thread killed while reading event
151007 4:24:12 [Note] Slave I/O thread exiting, read up to log 'mariadb-bin.000078', position 376
151007 4:28:20 [Note] Slave SQL thread initialized, starting replication in log 'mariadb-bin.000078' at position 376, relay log './db4-relay-bin.000043' position: 537
151007 4:28:20 [Note] Slave I/O thread: connected to master 'jf_slave#db2.example.com:3306',replication started in log 'mariadb-bin.000078' at position 376
So why would there be this database inconsistency, when all the indicators of replication seem okay? Why can't the nagios user log into db4 the way it can on the 1st 3 db's?
Thanks
Because you need to set Log_slave_updates in the CNF file on each server.
We had a shutdown on slave server (at 13:47) and after that slave does not follow the master.
I have all the data until the shutdown in the slave server.
Here is the slave:
mysql> show slave status \G <br>
*************************** 1. row ***************************<br>
Master_Host: 192.168.0.56<br>
Master_Log_File: mysql-bin.000226<br>
Read_Master_Log_Pos: 695831819<br>
Relay_Log_File: mysql-relay-bin.000001<br>
Relay_Log_Pos: 4<br>
Relay_Master_Log_File: mysql-bin.000226<br>
Slave_IO_Running: No<br>
Slave_SQL_Running: Yes<br>
Exec_Master_Log_Pos: 695831819<br>
Relay_Log_Space: 120<br>
Last_IO_Errno: 1236<br>
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'<br>
Last_IO_Error_Timestamp: 150709 14:26:07<br>
It seems slave receives the logs.
Actually we have "Master with Relay Slave" replication and the slave itself act as master for another slave.
How long was your slave shut down?
This error message:
Could not find first log file name in binary log index file
means that the slave asked the master for binary log file mysql-bin.000226 and the master replied "Sorry, I don't know about that file anymore."
On you master type this: SHOW BINARY LOGS; Do you see the log file the slave is asking for? If not and you see others, then someone or some script removed it.
In any case, you either need to restore that binary log to the master (from a backup) or you will need to re-initialize your slave from the master using Percona XtraBackup.
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 replicate my database using master slave replication on my wamp server. I have made the following changes to my my.ini file:
# Number of threads allowed inside the InnoDB kernel.The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=8
#Defining the directory for logs and database and the server id
log-bin=C:\wamp\logs\mysql-bin.log
binlog-do-db=bank
server-id=2
On Master Server I configured this:
mysql> GRANT REPLICATION SLAVE
-> ON *.* TO 'root'#'slave_ip'
-> IDENTIFIED BY '';
On the slave server, I configured this:
mysql> CHANGE MASTER TO
-> MASTER_HOST='(master_ip)',
-> MASTER_PORT=3306,
-> MASTER_USER='root',
-> MASTER_PASSWORD='';
I got the error: Error 1198: This operation cannot be performed with a running slave; run stop slave first.
So I ran stop slave and nothing happened. Any help would be appreciated.
on master:
SHOW MASTER STATUS;
output is :
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 107 | karbord_test | |
+------------------+----------+--------------+------------------+
1 row in set
on slave:
STOP SLAVE;
CHANGE MASTER TO
MASTER_LOG_FILE='mysql-bin.000001',
MASTER_LOG_POS=107;
START SLAVE;