Main configuration:
Install MySQL
Modify MY.CNF, add server-id=130 and Log_bin=aminglinux1
After modifying the configuration file, start or restart the Mysqld service
/etc/init.d/mysqld restart
To back up the catalog's library
Backup and restore MySQL library to aming library as test data
Create a new library called aming
Back up the library to the new library aming
There's a problem here, it should be mysql-uroot-paminglinux aming </tmp/blog.sql
Back up the Zrlog database
Create any database that is used by any user who is synchronizing the data to the IP is 192.168.91.128 new user repl, password is aminglinux111
Grant replication Slave on . to ' repl ' @slave_ip identified by ' password ';
Lock Database Write operations
Flush tables with read lock;
View Master Master Status
Show master status;
View directory files prepared for master and slave past
On the configuration from the
Modifying a configuration file
Restart MySQL Service
Synchronize the Library of our Lord, to the top, the few SQL
In the beginning, the first new library, and then the synchronized library backup to the corresponding new library,
View the directory below from the top of the library is not the same as the Lord
Core point, start syncing
Check sync status, key is two Yes
Verify Master-slave configuration View master and slave table information
Master and slave use Zrlog Library, the Lord to see the number of user table rows
To view the number of user table rows from the top
Clear User Table
The Lord performs a flush operation, prompting an error, setting set foreign_key_checks = 0;
View table row count from top, table content
Delete a table
Perform delete actions on master and slave
Validating from the top
In the video, there is an interesting question, deleted from the table above, in the Lord can also look at the table, and then deleted in the Lord, in the view from the master-slave configuration When prompted error, from the table does not exist
Workaround: Re-master from the configuration
In the Lord Show master status; View file and Pos;
On the top,
Stop slave;
Change Master to master_host= ' 192.168.91.128 ', master_user= ' repl ', master_password= ' aminglinux111 ', master_log_file= ' aminglinux1.000002 ', master_log_pos=537;
Start slave;
show slave status;
MySQL Master-slave configuration