Notes 2 Myself

MySQL Replication in Single BOX

MYSQL replication in the same box 

 

MYSQL 5.0.17 standard (SLAVE) - 10.0.0.1

MYSQL 4.1.1  standard (MASTER) - 10.0.0.2 

MASTER running on port 3306 SLAVE running on port 3308 

MASTER (my.cnf)
server-id  = 1
log-bin 

SLAVE (my.cnf)
[mysqld]
server-id  = 2
master-host = localhost
master-user = root
master-password = mysql
master-port = 3306

 

replicate-do-db = dbrep

to check the MASTER status on mysql cosole execute this query

mysql > SHOW MASTER STATUS;

mysql > grant replication slave, replication client,file,super,reload,select on *.* to root@’%hostname%’ identified by ‘mysql’; 

to check the SLAVE status on mysql cosole execute this query

mysql > SHOW SLAVE STATUS;

mysql > grant all on *.* to root@%hostname% identified by ‘mysql’;  

mysql> CHANGE MASTER TO   
->     MASTER_HOST=’master_host_name’,   
->     MASTER_USER=’master_user_name’,
   
->     MASTER_PASSWORD=’master_pass’,
   
->     MASTER_LOG_FILE=’recorded_log_file_name’,
   
->     MASTER_LOG_POS=recorded_log_position;
 

Above mentioned query can be used to chnage the slave info at runtime.  restart both MYSQL SLAVE & MASTER 

On slave execute the command
mysql > start slave; 

Now create the database at MASTER and start creating tables and inserting values into it. Check the slave it started replicating all those tables. 

Isn’t it simple. :)

 

1 Response to "MySQL Replication in Single BOX"

Comment Form

 

October 2008
M T W T F S S
« Sep    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Blog Stats

  • 5,257 hits

RSS Digg

  • An error has occurred; the feed is probably down. Try again later.

RSS Digg Videos

  • An error has occurred; the feed is probably down. Try again later.

Flickr Photos

IMG_0191

IMG_0190

IMG_0189

IMG_0188

IMG_0187

IMG_0186

IMG_0185

IMG_0184

IMG_0183

IMG_0182

More Photos