Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am settings up two new servers. One is the master and the other is the slave. Below is the config file for both. Master DB

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_file_per_table

server-id=1
binlog_do_db=data1


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Slave DB

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_file_per_table


server-id=2
master-host = 202.*.*.*
master-user = replicationUser1
master-password = ********
master-port = 3306
replicate-do-db=data1



[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

So first in the master I run this reset master command it gave me this error. reset master; ERROR 1186 (HY000): Binlog closed, cannot RESET MASTER. Then on the slave I first ran stop master then reset slave then start slave. THen I notice this files are generated in the slave master.info,mysqld-relay-bin.000001, mysqld-relay-bin.index and relay-log.info. In addition I have also ran this command on slave and it gave me no errors.

change master to MASTER_HOST='202.*.*.*', MASTER_USER='replicationUser1', MASTER_PASSWORD='******',

What should I do now I am quite stuck do not know how to move it next? Thank you.

share|improve this question
add comment

1 Answer 1

You need a log-bin entry in your master my.cnf file

Per http://dev.mysql.com/doc/refman/5.0/en/binary-log.html


To enable the binary log, start the server with the --log-bin[=base_name] option. If no base_name value is given, the default name is the value of the pid-file option (which by default is the name of host machine) followed by -bin. If the basename is given, the server writes the file in the data directory unless the basename is given with a leading absolute path name to specify a different directory.


After setting the log-bin and restarting the master, you then can run RESET MASTER; and then SHOW MASTER STATUS; to get the correct values for your CHANGE MASTER command for your slave.

share|improve this answer
    
ok what happened now is that my master is running fine show master status; | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 | 21068398 | tData1 | | Now the problem is that my slave keep showing error connecting to my master. I have tried to ping to my master is healthy. So what could be wrong. On my master I could see the replication user too. What else to check out? –  newbie14 Jun 17 '12 at 16:50
    
You need to set the positions to start replication from: change master to MASTER_HOST='202.*.*.*', MASTER_USER='replicationUser1', MASTER_PASSWORD='******', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS= 21068398; Adjust the values as needed. At this point, you might want to do another clean snapshot for the slave so you know the position the slave is currently at to start replication from –  kormoc Jun 19 '12 at 17:42
    
so if I start from this position wouldnt I miss the earlier data then? Thank you. –  newbie14 Jun 21 '12 at 5:03
    
Yes, this is why you should do another snapshot of the master and restore that onto the slaves to get the slaves back in sync with the master. –  kormoc Jun 21 '12 at 17:29
    
so are you saying stop master first then stop slave. then reset master is it? then I backup master and dump back to slave and restart from there ? Am I doing it right? –  newbie14 Jun 22 '12 at 17:39
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.