Ubuntu configuration MySQL master-slave database

Source: Internet
Author: User

The MySQL database supports the master-slave replication of the database and therefore has its unique advantages in clustering. Many domestic and foreign large-scale website architecture system, have adopted MySQL master-slave database configuration to realize query load, database hot-standby and other functions. I also covered this requirement in the actual Web project, where I will make a brief summary of how to configure the implementation.

This environment: virtual machine under

Server: Ubuntu 14.04 LTS
Database: 5.5.37
Port: 3306
Main ip:192.168.63.133
From ip:192.168.63.134
Authorized account:
User:suxh
password:111111
All right, let's finish. Environment: We directly configure:
The first step: the master and slave two servers to have the same database (need to synchronize) here is the backup database (not much, (www.jbxue.com) before the synchronization started, copy the main library to the library on the line)
The second step of configuring Primary (Master) database editing/etc/my.cnf is to turn on the binary log and set some parameters such as the database to be synchronized

#binaryLogging format-Mixed Recommendedbinlog_format=Mixedbinlog-Ignore-Db=Mysqlbinlog-Do-Db=Backup# RequiredUniqueIdbetween 1  and 2^ + - 1# defaults to 1 ifMaster-Host is  not Set# but would not function  asA masterifOmittedserver-Id= 1

Parameters explained below:

Server-id This is the only one that cannot follow the same server.
Binlog_format binary file format
Binlog_ignore-db ignored databases
BINLOG-DO-DB the database to synchronize
Restart the database after Setup is finished.
The third step from the database:
Similarly modifying/etc/my.cnf in MySQL version 5.1.7 does not support master-host "similar parameters; So just configure server-id=2 to do it.
Then log in from the database settings
Change Master to master_host= ' 192.168.63.133 ', master_user= ' suxh ', master_password= ' 111111 ';
Slave start;

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.