MySQL database master-slave synchronization fourth edition

Source: Internet
Author: User
Keywords Network programming Mysql tutorial
Tags backup compiled configuration data environment function install it is

MySQL master-slave synchronization is a very mature architecture, the advantages are: ① from the server can perform the query (that is, we often say reading function), reducing the pressure on the main server; ② in the backup from the main server to avoid the impact of the backup Main server service; ③ When the main server problems, you can switch to the server. So I often use this program in the deployment and implementation of the project; view of the mysql production environment rigor, I recommend Zhang fellow MySQL source code compiled here.

The fourth edition updated as follows:

First, an increase of mysql5.1.38 compile and install process, the installation process is still used to install the method of early mystery Zhang ban, abandoned the use of script control approach;

Second, the main library from the library access method is still used to obtain tar did not use mysqldump reason is found in the actual configuration, this method is relatively large chance of failure, it has been using tar to take a full snapshot of the main database, there are users is not too Understand, focus here;

Third, mysql master-slave replication Although the configuration is relatively simple, but it is also a razor-edge sword; because if the main library mistakenly delete the phenomenon, from the library will happen; so the main table stand-alone backup must be made, it is recommended FTP backup

Fourth, binlog log must be open, signed in the rigor of the production environment, this post we welcome the exchange of discussion, to identify one of the bugs and errors, so as not to mislead the new people; this post I will continue to pay attention to and update (Fuqin cooking wine)

Database directory and others

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

mysql database location / usr / local / webserver / mysql / data /

The main database: 192.168.4.191

From the database: 192.168.4.192

Operating System: RHEL5.4 64-bit

Server Type: HP 580G5, dual quad-core XeonE5520, 32G memory, four 300GSAS made RAID10

mysql5.1.38 source compilation process is as follows:

/ usr / sbin / groupadd mysql / usr / sbin / useradd -g mysql mysql unzip mysql-5.1.38.zip cd mysql-5.1.38 / ./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 make && make install chmod + w / usr / local / webserver / mysql chown -R mysql: mysql / usr / local / webserver / mysql cp support-files / my-medium.cnf / usr /local/webserver/mysql/my.cnf # This may be based on the specific circumstances, the pressure can be used huge.cnf cd ../

① mysql user account to create a data table:

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

② start MySQL (the last & said running in the background)

/ bin / sh / usr / local / webserver / mysql / bin / mysqld_safe --defaults-file = / usr / local / webserver / mysql / my.cnf &

Related Article

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

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.