How often slave gets updated in master slave configuration? - mysql

We have set up master-slave configuration and I need to know at what time slave is getting updated OR how often slave is getting updated. Where can I see the settings saved for replication.

Manual contains the needed info under this FAQ point:
http://dev.mysql.com/doc/refman/5.0/en/faqs-replication.html#qandaitem-B-13-1-3
see last line of below output
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: localhost
Master_User: root
Master_Port: 3306
Connect_Retry: 3
Master_Log_File: gbichot-bin.005
Read_Master_Log_Pos: 79
Relay_Log_File: gbichot-relay-bin.005
Relay_Log_Pos: 548
Relay_Master_Log_File: gbichot-bin.005
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: 79
Relay_Log_Space: 552
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: 8

Related

Mysql error 1236 from master when reading data from binary log

I have 2 MySql with a master/slave configuration and the replication is failing. The MySql Master crashed and a new register in the mysql-bin.index was created. I deleted this new register because this file was not existed in the file system. Then the MySql Master restarted successfully.
Now, I have the next error in the slave:
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 10.64.253.99
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.001050
Read_Master_Log_Pos: 54868051
Relay_Log_File: mysqld-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.001050
Slave_IO_Running: No
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: 54868051
Relay_Log_Space: 107
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1236
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'
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
If I execute the "show master status" for view the mysql bin log file and the position:
mysql> show master status \G
*************************** 1. row ***************************
File: mysql-bin.001050
Position: 55586895
Binlog_Do_DB: aaa
Binlog_Ignore_DB: xxx,yyy,zzz,mysql
Then I set new config to the slave:
STOP SLAVE;
CHANGE MASTER TO
MASTER_HOST='10.64.253.99',
MASTER_USER='slaveUser',
MASTER_PASSWORD='12345',
MASTER_LOG_FILE='mysql-bin.001050',
MASTER_LOG_POS=55586895;
START SLAVE;
And if I check slave status again I have the same error:
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 10.64.253.99
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.001050
Read_Master_Log_Pos: 55586895
Relay_Log_File: mysqld-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.001050
Slave_IO_Running: No
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: 55586895
Relay_Log_Space: 107
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1236
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'
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
I have checked in the MySql Master that the mysql-bin.001050 exist and is not empty.
This is a production environment then new data are inserted every minute. The position value can to change in minutes or seconds. I don't know if this is a problem.
The max_allowed_packet variable has the same value in the two MySql (16M).
Why can not the slave find the binary log file?
You can try this:
Slave: stop slave;
Master: flush logs
Master: show master status; — take note of the master log file and master log position
Slave: CHANGE MASTER TO MASTER_LOG_FILE='log-bin.00000X', MASTER_LOG_POS=106;
Slave: start slave;

MySQL Replication is Not Working Master Slave

I am new to MySQL and tried to create replication
Here are my.cnf on Master
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
log-bin = /var/lib/mysql/logs/mysql-bin.log
binlog-do-db=fedorareptest1
server-id=1
----
My.cnf on Slave
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
server-id=2
master-host=130.14.165.25
master-connect-retry=60
master-user=reptest
master-password=nopass!123
replicate-do-db=fedorareptest1
relay-log = /var/lib/mysql/logs/slave-relay.log
relay-log-index = /var/lib/mysql/logs/slave-relay-log.index
--------
Note: The database mentioned in "replicate-do-db=fedorareptest1" is the database on the master. This database name on the slave is fedoratest2. Should I use this above or it should be the one on master
When I do Slave status:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 130.14.165.25
Master_User: reptest
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 107
Relay_Log_File: slave-relay.000005
Relay_Log_Pos: 252
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: fedorareptest1
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: 107
Relay_Log_Space: 549
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
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
--------------------------------------
When I do update on the table the row does not show up on the slave!
PLEASE HELP AND I AM NEW TO MYSQL.
You should avoid the *do-db options, as they can cause problems
Check that the queries are coming through to your slave:
mysqlbinlog --short-form /path/to/relaylogfile | less
.. or ..
tcpdump -vv -A -i lo0 tcp port 3306 | tee dump.log
UPDATE having reread your post I noticed the issue: you have change the DB name and not used replicate-rewrite-db

Unable to replicate due slave_I/O_running:No

I have a master mysql server 5.5 version and a slave 5.1 version. I am getting the
following error.
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: XXX.XX.X.XXX
Master_User: repl_user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000012
Read_Master_Log_Pos: 107
Relay_Log_File: ABC-029-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000012
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB: replication_test
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: 107
Relay_Log_Space: 106
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1045
Last_IO_Error: error connecting to master
'repl_user#XXX.XX.X.XXX:3306' - retry-time: 60 retries: 86400
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
Please suggest what to do?
Error "1045" indicatates a login/credentials issue. Check to see if your login/password is correct or check if your firewall isn't blocking the connection.

Error during Master to Master Replication of MySQL server [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have setup Master to Master Replication on MySQL server 5.2 with my existing database. I am sucessfully able to replicate data of my Master 1 to Master 2 with the user named as replication. But I am getting error from Master 1 when I try to connect to master 2. Here is the detail information of them:
Master 1:
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 10.34.1.37
Master_User: replication
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: mysql-bin.000018
Read_Master_Log_Pos: 107
Relay_Log_File: XX-XX-01-relay-bin.000002
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000018
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: 107
Relay_Log_Space: 107
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 2003
Last_IO_Error: error connecting to master 'replication#10.34.1.3
7:3306' - retry-time: 10 retries: 86400
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
1 row in set (0.00 sec)
In Master 2:
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.5.224.12
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000019
Read_Master_Log_Pos: 107
Relay_Log_File: xx-xx-xx-relay-bin.000029
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000019
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: 107
Relay_Log_Space: 560
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
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: 1
1 row in set (0.00 sec)
ERROR:
No query specified
Please help me. Your solution will guide me to resolve task. Thank you in advance.
Make sure you can connect from the host of Master 1 DB to Master 2's MySQL socket, you can verify if you are able to connect via shell command:
telnet master-2-ip MYSQLPORT //3306 is the default port for mysql
if this command succeeds (which means you don't get 'Connection Refused'), try connecting with:
mysql -u user -p'password' -H host -P port
if the problem is not connectivity issues posting your mysql logs under /var/log might help a bit more.

Mysql Replication Data not updated but log updated

Here are the steps i did.
I was Replicating the mysql 5.0.95 as master and 5.5 as a slave. I'm using linux OS. My DB engine is InnoDBenter code here
I have set the master with
/etc/my.cnf
**#mysql Server setup**
server-id=1
bind-address = 192.168.1.41
innodb_flush_log_at_trx_commit=1
sync_binlog=1
log-bin = /var/log/mysql/mysql-bin.log
binlog-do-db=my_db
I have set the slave with
/etc/my.cnf
**#mysql replication client setup**
server-id=5
master-host=192.168.1.41
master-user=web_master
master-password=webmaster
master-connect-retry=60
replicate-do-db=dev_my_db
log-slave-updates
I have granted permission on master as
GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'web_master'#'192.168.1.41' identified by 'webmaster';
I have set change master and bin position on the slave
CHANGE MASTER TO MASTER_HOST='192.168.1.41', MASTER_USER='web_master', MASTER_PASSWORD='webmaster', MASTER_LOG_FILE='mysql-bin.00002', MASTER_LOG_POS=107;
I did 2 insert and a update and log my queries
and checked My Master status as
mysql> SHOW master STATUS\G
File: mysql-bin.000004
Position: 13790
Binlog_Do_DB: my_db
Binlog_Ignore_DB:
1 row in set (0.00 sec)
I chcekd my slave and slave status as
mysql> SHOW SLAVE STATUS \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.41
Master_User: web_master
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000004
Read_Master_Log_Pos: 13790
Relay_Log_File: mysqld-relay-bin.000007
Relay_Log_Pos: 244
Relay_Master_Log_File: mysql-bin.000004
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: dev_CHGV2_dbo
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: 13790
Relay_Log_Space: 401
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
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: 4
1 row in set (0.00 sec)
ERROR:
No query specified
I could see the bin log are updated on slave, i couldn't figure out what was causing the issue. As my updates on the master is not replicated on slave.
can any one suggest did i have missed out something?