, the master database to create a backup account: Backup is the user name,% represents any remote address, the following means that the password is 1234 of any remote address backup can connect to master host mysql> grant replication Slave on * * to ' backup ' @ ' percent ' identified by ' 1234 '; mysql> use MySQL
contained in the log, the returned information also includes the name of the bin-log file on the master end and the location of the bin-log;3) after the slave Io process receives the information, it will add the received log content to the end of the relay-log file on the slave end in sequence, and record the file name and location of the bin-log on the master end to the master-info file, in this way, you can clearly tell the master "from which position of a bin-log I need to
level replication. From 5.0, Mysql replication have been solved a lot of the old version can not appear in the correct copy of the issue. However, due to the emergence a stored procedure, a copy of Mysql brings even greater challenges. Also, see the official documents as the 5.1.8 version from the
slave;mysql> set GLOBAL sql_slave_skip_counter=1;mysql> start slave;Iv. Adding Backup ScriptsThe role of the script is to make an incremental backup every day from Monday to Friday, one weeks to do a fully prepared#! /bin/bashmysqldump () {mysqldump-uroot--single-transaction-R--triggers -e--master-data--flush-logs--all-databases>/var/lib/
In Soundbreak, we play live audio and video continuously 24 hours a day, so we cannot make a convincing test of the new replication feature of MySQL. Through tests, we found that this feature can be used to maintain data synchronization with the backup database server, so that when the master server fails to process for some reason, it can use the backup machine to process all queries for
that the host name of the synchronization Master is A (IP: 192.168.0.1), the Slave host name is B (IP: 192.168.0.2), and the two basedir directories of MySQL are/usr/local/mysql, datadir is both:/var/lib/mysql.
II. set synchronization server
1. set synchronization Master
Modify the my. cnf file in
# Replication Master
Mysql master-slave replication principle, mysql master-slave PrincipleMaster-slave mode
Flexible mysql master-slave Replication
One master, one slave
Master-master Replication
One master multi-slave --- extended system read pe
One, the group copy is a what ghost?Start with MySQL replication technology, first of all, MySQL asynchronous replicationIn asynchronous replication mode, the execution transaction on master generates Binlog,slave on the local relaylog by connecting the contents of the maste
database's Relay Log, and then rewrites the data from the slave database based on the Relay Log to achieve data consistency between the master and slave databases through logical replication;
MySQL completes data replication between master and slave databases through three threads: The Binlog Dump thread runs on the master database, and the I/O thread and SQL th
version1.2, initialization of the table, and in the background to start MySQL1.3, modify the root password (the newly installed MySQL does not have a password)Second, MySQL master server Configuration master (192.168.1.111)
1) Modify master server master:
The code is as follows
Copy Code
#vi/etc/my.cnf[Mysqld]Log-bin =
a thread from the primary server to send the log from the binary log to the slave log from the server? Will this generate a lot of Io, and will that speed be fast? Based on this situation, a multi-level replication approach has been createdMulti-level replication, is from the server to select a dedicated relay master server log sent to the other slave server.PHP does not need to have a relationship with
forwards the connection requests from the foreground application to the database in the background, and through the use of Lua scripting, enables complex connection control and filtering for read-write separation and load balancing. And there is a variety of information and maintenance, although it is necessary to understand some of the Lua language, but the language, it is very easy to get started.
After stability-based, problem-solving, ease-of-use, ease-of-integration with existing p
write in front: If this article is fortunate enough to be seen by a friend and found wrong, I hope to criticize. If you do not understand the place, we would like to discuss together.
Fundamentals of MySQL Replication
Basic issues that MySQL replication solvesKeep the data of one
Mysql master-slave replication technology (TEST) to start configuration: www.2cto.com Step 1: Create a replication account. Each slave uses the standard MySQL user name and password to connect to the master. The user who performs the copy operation will grantREPLICATIONSLAVE
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 start a thread. There is an important limitation
on the Master node, due to the characteristics of the TCP protocol, the server load balancer has no chance to get a notification, so it cannot know whether the data is not received because the Master has not been updated yet or because of a fault.
Fortunately, MySQL 5.5 has added a replication heartbeat function.
For example
stop slave;change master master_heartbeat_period = 10;set global slave_net_timeout
I. Principles of Replication
MySQL replication tracks all database changes (updates, deletions, and so on) in binary logs based on the master server ). Each slave server receives updates recorded by the master server to the storage of its binary logs from the master server so that the slave server can perform the same update on its data copy.
One way to copy data
. d/mysqld
Vim/etc/profile
PATH =/usr/local/mysql/bin:/usr/local/mysql/lib: $ PATH
Export PATH
Source/etc/profile
11. start the mysql service and add the service to start automatically
Service mysqld start
Chkconfig -- level 35 my
specified log location based on the request information and returns it to the Slave IO thread. In addition to the information contained in the Log, the returned information also includes the name of the Binary Log file on the Master end and its location in the Binary Log; 3. after the Slave IO thread receives the information, it writes the received Log content to the end of the Relay Log file (mysql-relay-bin.xxxxxx) at the Slave end in sequence, and
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.