MySQL Ubuntu master-Slave sync Configuration
One, install MySQL on two Linux machines
Second, Master master server configuration (192.168.1.3)
1. Edit my.cnf (Command Find file location: Find/-name my.cnf)
Vi/etc/mysql/my.cnf
Add in [mysqld]:
Server-id = 1
Log_bin = Master-bin
Log_bin_index = Master-bin.index
binlog_do_db = My_data
binlog_ignore_db = MySQL
Note: Server-id server Unique identification, Log_bin starts the MySQL binary log, binlog_do_db specifies the database that logs the binary log, binlog_ignore_db specifies a database that does not log binary logs.
2. Log in to the master server to create the account and permissions to use from the server:
Grant Replication Slave on * * to ' masterbackup ' @ ' 192.168.1.% ' identified by ' masterbackup ';
(192.168.1.% wildcard, which indicates that 0-255 of IP are accessible to the primary server, formal environment please configure specify from server IP)
3. Restart MySQL, command:/etc/init.d/mysql restart
4. Check the status of the primary server:
Show master status;
Iii. slave from server configuration (192.168.1.5)
1. Edit my.cnf (Command Find file location: Find/-name my.cnf)
Vi/etc/mysql/my.cnf
Add in [mysqld]:
Server-id = 2
Relay-log = Slave-relay-bin
Relay-log-index = Slave-relay-bin.index
2. Restart slave from server mysql, command:/etc/init.d/mysql restart
3. Log slave from the server and connect to master master server:
Change Master to master_host= ' 192.168.1.103 ', master_port=3306,master_user= ' masterbackup ', master_password= ' Masterbackup ', master_log_file= ' master-bin.000001 ', master_log_pos=2403;
Note: Master_log_file corresponds to the file column shown in Show Master status: Master-bin.000001;master_log_pos corresponds to position column: 2403, otherwise synchronization failure may occur.
4. Start slave data synchronization.
Start slave;
5. View slave information:
show slave status\g;
Note: Both slave_io_running and slave_sql_running are yes to indicate that the synchronization was successful.
Manuscripts: Diligent Learning qkxue.net
Extended reading:
MySQL Ubuntu master-Slave sync Configuration
Http://qkxue.net/info/30550/MySQL-Ubuntu
MySQL Ubuntu master-Slave sync Configuration