4
votes

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.

1
Please post the query that you are using for the update - Cez

1 Answers

0
votes

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