MySQL database master-slave sync Fourth Edition

Source: Internet
Author: User
Tags mysql mysql database

MySQL's master-slave synchronization is a very mature architecture, the advantages are: ① can perform query work from the server (that is, we often say read function), reduce the pressure of the primary server; ② is backing up from the primary server to avoid affecting the primary server service during the backup, ③ can switch to from the server when there is a problem with the primary server. So I am often used in project deployment and implementation of this scenario, in view of the production environment of MySQL rigor, I recommend the use of Zhang Yi MySQL source code compiled method.

The updated version of ④ is as follows:

First, increased the mysql5.1.38 of the installation process, the installation process is still used Zhang Yi early installation of MySQL method, abandoned the script control approach;

Second, from the main library of the method is still used to obtain the tar, did not use the mysqldump reason is found in the actual configuration, the probability of failure of this method is relatively large, so has been using tar to take a complete snapshot of the main database, there are netizens are not too understanding, here is the key note

Third, the MySQL master and slave copy although the configuration is relatively simple, but also is the hilt blade sword; Because if the error deletes the table phenomenon in the main library, also can take place from the library, therefore the primary table's stand-alone backup must make, recommended also makes the FTP backup;

Four, Binlog log must be opened, signed in the strict production environment, this post welcomes everyone to discuss, find out the bugs and errors, so as not to mislead new people; This post I will continue to pay attention to and update (Fuqin cooking wine)

Database directory and other

MY.CNF configuration file/usr/local/webserver/mysql/my.cnf

MySQL Database location/usr/local/webserver/mysql/data/

master database:

From database:

Operating system: RHEL5.4 64 bits

Server type: HP 580G5, dual quad-core xeone5520,32g memory, 4 300GSAS made of RAID10

MYSQL5.1.38 source code compilation process is as follows:

  1. /usr/sbin/groupadd MySQL
  2. /usr/sbin/useradd-g MySQL MySQL
  3. Unzip
  4. CD mysql-5.1.38/
  5. ./configure--prefix=/usr/local/webserver/mysql/--enable-assembler--with-extra-charsets=complex-- Enable-thread-safe-client--with-big-tables--with-readline--with-ssl--with-embedded-server--enable-local-infile --with-plugins=innobase
  6. Make && make install
  7. chmod +w/usr/local/webserver/mysql
  8. Chown-r Mysql:mysql/usr/local/webserver/mysql
  10. #这部可依具体环境而定, the pressure of a large huge.cnf can be used
  11. Cd.. /

① establishes the data table as a MySQL user account:

/usr/local/webserver/mysql/bin/mysql_install_db--basedir=/usr/local/webserver/mysql--datadir=/usr/local/ Webserver/mysql/data--user=mysql

② boot MySQL (final & indicates running in background)

/bin/sh/usr/local/webserver/mysql/bin/mysqld_safe--DEFAULTS-FILE=/USR/LOCAL/WEBSERVER/MYSQL/MY.CNF &

Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.