User Tools

Site Tools


mysqlreplication

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mysqlreplication [2019/02/19 11:31] – created z0hpvkmysqlreplication [2025/03/08 22:24] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 <code> <code>
-create user 'repl'@'ubuntu-slave' identified by 'ipswich';+192.168.56.102  ubuntu-master 
 +192.168.56.103  ubuntu-slave 
 +</code> 
 + 
 +==== Set Server ID on Slave ==== 
 +<code> 
 +set persist server_id = 2; 
 + 
 +service mysql restart 
 +systemctl restart mysql 
 +</code> 
 + 
 +==== Create Replication User on Master ==== 
 +<code> 
 +create user 'repl'@'ubuntu-slave' identified by 'teapot';
 grant replication slave on *.* to 'repl'@'ubuntu-slave'; grant replication slave on *.* to 'repl'@'ubuntu-slave';
 </code> </code>
  
 +==== Lock Tables on Master ====
 <code> <code>
 flush tables with read lock; flush tables with read lock;
 </code> </code>
  
 +==== Display Details of Binary Log ====
 <code> <code>
 show master status; show master status;
Line 19: Line 35:
 </code> </code>
  
 +==== Backup / Restore ====
 <code> <code>
 mysqldump -uroot -p --all-databases --master-data --add-drop-database > ubuntu-master.dmp mysqldump -uroot -p --all-databases --master-data --add-drop-database > ubuntu-master.dmp
Line 25: Line 42:
 </code> </code>
  
 +==== Configure Replication on Slave ====
 <code> <code>
 mysql> CHANGE MASTER TO mysql> CHANGE MASTER TO
        ->     MASTER_HOST='ubuntu-master',        ->     MASTER_HOST='ubuntu-master',
        ->     MASTER_USER='repl',        ->     MASTER_USER='repl',
-       ->     MASTER_PASSWORD='ipswich',+       ->     MASTER_PASSWORD='teapot',
        ->     MASTER_LOG_FILE='binlog.000011',        ->     MASTER_LOG_FILE='binlog.000011',
        ->     MASTER_LOG_POS=904;        ->     MASTER_LOG_POS=904;
Line 36: Line 54:
 </code> </code>
  
 +==== Monitoring and Administration ====
 <code> <code>
 mysql> show slave status\G mysql> show slave status\G
mysqlreplication.1550575882.txt.gz · Last modified: 2025/03/08 22:23 (external edit)