Discover mysql replication status, include the articles, news, trends, analysis and practical advice about mysql replication status on alibabacloud.com
.
1.mysql>create user ' user ' @ ' x.x.x.x ' identified by ' password ';2.mysql>grant REPLICATION SLAVE on *.* to ' user ' @ ' x.x.x.x ' identified by ' password ';4, execute the following command to lock the database to prevent writing data.
1.mysql>flush TABLES with READ LOCK;Do not exit the
= 2//thread concurrency (cpu*2)Log-bin=mysql-bin//Turn on the binary logging featureSave exit and restart MySQL.Log in to MySQL:[[email protected] mysql]# mysql-uroot-p//default password empty, directly hit entermysql> grant replication Slave on * * to [e-mail protected] '
MySQL database master-slave replication bitsCN. the master-slave replication of comMySQL 5.5 Database is studied based on the data on the Internet. The data on the Internet is already very detailed, but I still encountered many problems in practice, the following is a summary based on the information on the Internet and the problems I encountered. System environm
-binbinlog_format = MIXED #非必需relay-log = mysqld-relay-binbinlog-ignore-db = Mysqlbinlog-ig nore-db = information_schemabinlog-ignore-db = Performance_schemareplicate-wild-ignore-table = mysql.% replicate-wild-ignore-table = Information_schema.%replicate-wild-ignore-table = performance_schema.%Iv. manual synchronization of the databaseIf there is already data on master, it is necessary to synchronize the two MySQL
server's relay log, then, the SQL thread reads the relay log and replays it on the slave server to achieve MySQL replication. As shown in:
MySQL Replication
The whole process is reflected on the slave server. You can view three sets of log information on the slave server with the following command:
In this section, we will learn how to grant user authorization and master-slave replication in Mysql.
The following describes the advantages of Mysql master-slave replication:
1. if a problem occurs on the master server, you can quickly switch to the service provided by the slave server.
2. query operations can be
MySQL Semisynchronous Replication
In addition to the built-in asynchronous replication mechanism, MySQL5.5 also provides interfaces to support semi-synchronous replication.
Disadvantages of asynchronous replication:
MySQL
Tags: completing the Generate Plugins Status tool parameters MySQL database size1 OverviewSemi-synchronous replication refers to a subset of host synchronous replication, and another part of the host asynchronous replicationThe logic of synchronization is that the user writes to the primary server, the primary service
用mysql-uroot-p123456-s/data/3306/mysql.sock-e "Show Master Status"#锁表后, you must open a new SSH window, export all data of the database, if the amount of data is large (more than 50G), and allow downtime, can be parked directly packaged data files for migration, so faster#新开一个窗口, back up the database to migrate the data to the library[Email protected] ~]# mkdir/server/backup-p[Email protected] ~]# mysqldump
row, the value is to the newly added library, and then restart the mysql services;4, then through the Linux command to enter MySQL, to see if the slave is properly started, if the boot has an exception to handle, to ensure normal startup; 5, the newly added library to the main master replication chain, test can be;V. How to remove a library from the existing ma
;flush privileges;
5) See if authorization is successful
Mysql> Show grants for [email protected]' 192.168.1.1 ';
6) Mutual Bin-log information A road executes the following command:
Mysql> Show master status;
Route B executes the following command:
Label:sizecacherequestsiatres over revmyscreated mysql> show global status; Can list MySQL server running various status values, my personal preferred usage is show status like ' query value% '; One, slow query mysql> show v
database and grant permissions Using replication slave, for example:
mysql> GRANT REPLICATION SLAVE ON *.* TO 'slave001'@'192.168.0.99' IDENTIFIED BY '123456';mysql> FLUSH PRIVILEGES; (2) modify the configuration file my. cnf of the primary database, enable BINLOG, and set the value of server-id. After modification,
replication, we understand basic information about the binary log files of the master server, which must be used in slave server settings, this information includes the name of the binary file of the master server and the location of the current log record, so that the slave server can know where to start the replication operation. You can use the following operations to view the binary log data of the mas
master status" or "mysqldump"-primary data display. In this case, you need to use the log file of the specified slave and the value after the location is null string ('') and 4.
Now you have the information you need to copy the binary logs that are read from the beginning at the correct position.
Set master-slave connection information
Mysql> CHANGE MASTER
-> MASTER_HOST = 'master _ host_name ',
->
Function
Permission
Monitor user
MMM (Multi-Master replication manager of MYSQL) monitors the health status of each Master
REPLICATION CLIENT
Agent user
MMM proxy is used to set read-only attributes, replication master, etc.
SUPER,
Mysql master-slave replication practicesAsynchronous master-slave Replication
Master-slave deployment steps:
Backup and Restoration
Use mysqldump or xtrabackup
Restore the existing basic data of the master database to the slave Database
Authorization
Grant replication slave on *.*
An accoun
continue copying when the statement returns an error in any option value.For example:-Slave-skip-errors = 255.2,1053-Slave-skip-errors = all
Vi. Configuration replication without stopping services
Method 1:If you have backed up the MASTER server at a certain time point and recorded the binary log name and offset of the corresponding snapshot (output using the show master status Command), follow these steps
main library creates a user who synchronizes replicationMariaDB [(none)]> grant replication slave on *.* to [emailprotected]‘192.168.%.%‘ identified by ‘123456‘;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec) View the Bin-log logging location node for the main libraryThe Bin-log Logging location node of the main library is specified when connecting to the main library when using the chan
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.