Explain how MySQL implements master-slave replication, and explain how mysql implements master-slave replication.
1. What is master-slave replication?
The DDL and DML operations in the primary database are transmitted to the slave database through binary logs, and these logs
.
Master-Slave Replication configuration steps:
Set Server-id (server identity, which cannot be duplicated in a group of hosts)
Turn on the binary log and specify the path to save the binary log file
Record Bin-log files and bin-log (position) locations
If you keep on master, add a global lock, backup the database that needs to be synchronized to the slave node, and unlock the global lock.
Create a user for synchronous
= 2Auto_increment_offset = 1
Node B:
Log-bin = mysql-binServer-id = 2Binlog-do-db = testBinlog-ignore-db = mysqlReplicate-do-db = testReplicate-ignore-db = mysqlLog-slave-updatesSync_binlog = 1Auto_increment_increment = 2Auto_increment_offset = 2
After the configuration is changed, you must start mysql before proceeding to the next step.
Each AB node creates an
The content is organized according to leader training and sharingI'm the split line ****************************************.mysql5.5 replicationApproximate process:One. First execute a thing in master, commit (MySQL default is set to Auto commit),Two. After committing to write to 2 files, one is to write data to datafile (this data is consistent, for example, there is a data unit start data is 1, in the mi
Build a MYSQL master-slave replication structure and a mysql master-slave replication Structure
1. Select two servers as the master and backup databases respectively.
2. log on to the server,
Yum install mysql;
Yum install mysql-s
Previously we introduced is the master-slave replication, here to introduce a double master replication, the following are expected to two of the main server data automatically copied, you can refer to this article.The MySQL master replication structure differs from the master-slave
IntroductionGtid is a global transaction ID that has been successfully executed based on the original MySQL server, combined with the server ID and transaction ID. This global transaction ID is unique not only on the original server, but also on all MySQL servers where the master-slave relationship exists. It is this feature that makes MySQL master-slave
the relay log, replays the event, and updates the slave data so that it is consistent with the data in the master. As long as the thread is consistent with the I/O thread, the relay log is usually located in the OS cache, so the overhead of the relay log is very small.In addition, there is also a working thread in the master: Like other MySQL connections, opening a connection in the master will also enable the master to
Tags: test error:end systemctl ORM amp Command database outDocker container Master node: 172.17.0.9Docker Container Sub-node: 172.17.0.10Asynchronous replication: First confirm that the main library and from the library is consistent, preferably a clean database that has just been initialized if the main library is in use cannot initialize, it is necessary to first copy the contents of the main library to the library to do synchronization 1, first to
Mysql Cluster 1: master-slave replication, using mysql-proxy for load balancing Mysql Cluster
There are many mysql Cluster architecture methods, and different architectures are implemented according to different requirements. Simply put,
There are 3 main steps to the MySQL replication function The primary server logs changes to the binary log (these are called Binary log events)Copy the primary server's binary log events from the server to its trunk logRedo the events in the relay log from the server.The first part of the process is that the primary server records the binary logs, and before each transaction updates the data is completed,Ma
from Server featureMysql>start slave; 8. Check replication feature status from serverMysql>Show Slave Status\g***************************1. Row ***************************slave_io_state:waiting forMaster to send event Master_host:192.168.145. Ten //Primary server addressMaster_user:repl//authorization account name, try to avoid using rootMaster_port:3306 //database port, some versions do not have thi
multiple binlog-do-db options are used. # If no database exists in databases, enabling binlog-do-db will cause mysql to fail to start. # binglog-do-db = # do not write binary logs to changes to the specified database. If multiple databases can be separated by commas, or multiple binlog-ignore-db options are used. binlog-ignore-db = information_schema, mysql, cec
Replication between mysql tables, the same database and different databases, mysql table replication Database
Mysql statement
We can first export the structure of table t1 under test, and then create a new table test1.t1.
Execute the following statement
Insert into test1
--i/o thread. The I/O thread opens a normal connection on master and then starts Binlog dump process. Binlog dump process reads the event from the binary log of master, and if it has been followed by master, it sleeps and waits for master to produce a new event. The I/O thread writes these events to the relay log.The SQL slave thread handles the final step of the process. The SQL thread reads events from the log, updating the slave data so that it is consistent with the data in master. As long a
Tags: start vim global method permissions Gtid_mode allow log serverAB replication: The master server builds a synchronization environment by modifying the MySQL configuration file, enabling the server to synchronize the primary server's database.Note: Both the master and slave servers need to shut down the firewall.Primary server:Modify
# Chown-R root/usr/local/mysql note: set root to access/usr/local/mysq# Chown-R mysql/usr/local/mysql/var note: set mysql users to access/usr/local/mysql/var# Chgrp-R mysql/usr/local/mysql
MySQL replication (2) Master-Slave replication practices, mysqlmaster-slave1. Preparations
First, prepare two machines to install mysql
My version here is 5.1.73, mysql database installation refer to: http://www.cnblogs.com/tangyanbo/p/4289753.html
Centos for linux
The ma
Semi-synchronous replication in MySQL master-slave Replication
Experiment MySQL uses the plug-in provided by Google to complete the semi-synchronous replication model; the physical machine is still Windows 7, and the virtual machine is CentOS 7;
Master node: 192.168.255.2
Sl
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.