Install mysql server on both server and client machine
Settings in Server
Editi My.conf
log-bin = mysql-bin
server-id = 1
binlog-do-db=DBNAME1
binlog-do-db=DBNAME2
# Backing up Master Database
mysqldump -u root -p –routines –add-drop-table –master-data –databases DBNAME1 DBNAME2 > master.sql
musql -uroot -p
CREATE USER ‘repluser’@'%’ IDENTIFIED BY ‘password’;
GRANT PROCESS , SUPER , REPLICATION SLAVE , REPLICATION CLIENT ON * . * TO ‘repluser’@'%’ IDENTIFIED BY ‘password’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
grant replication slave on *.* to repluser@SLAVE_SERVER_IP_ADDRESS identified by ‘password’;
# Slave configuration
vi /etc/my.cnf
log-bin = mysql-bin
server-id = 2
master-host=MASTER SERVER IP
master-user=repluser
master-password=password;
master-connect-retry=60
replicate-do-db=DBNAME1
replicate-do-db=DBNAME2
# Copying the SQL file rom Master
scp root@master IP address : path to the sql file
# Create Database in SLAVE
# dump database to new dbs
# execute following queries in mysql
change master to master_host=’Master IP address’;
change master to master_user=’repluser’;
change master to master_password=’Master user pass’;
change master to master_log_file=’mysql-bin.
change master to MASTER_LOG_POS=98 ; (the Numbe should be same as that displayed in master when executing the command ’show master status;’
start slave
show slave status




December 2nd, 2009
Aneesh
Posted in 
