Mysql+keepalived Configuration High Availability

Source: Internet
Author: User

Server environment:

Main mysql:192.168.1.163

From mysql:192.168.1.126

vip:192.168.1.50

First, MySQL configuration master-Slave synchronization

1. Configure the primary MySQL server

Vim/etc/my.conf

Establish an account and authorize slave

Lock the main library, read and write only

View the Binlog file and location of the primary database

At this point, the main library operation is complete and the operation starts from the library

2. Configure from MySQL server

Modifying from a configuration file

Vim/etc/my.conf

Configuring slave from the server

Log in to the main library to unlock the main library lock status

View from server Status

Second, configure MySQL Master master synchronization

Put the above operation step, reverse in operation again

Third, configuration keepalived

1, two server installation keepalived

2, copy the configuration file (two servers do the following actions)

3. Modify the keepalived configuration file on the 192.168.1.163

Create a detect MySQL script

Start the keepalived service

4. Modify the keepalived configuration file on the 192.168.1.126 (red arrow is required to change)

Create a detect MySQL script

Start keepalived

5. View

Login 192.168.1.163 View VIP

Login 192.168.1.126 view, no VIP

6. Test MySQL for high availability

Create a user on any MySQL computer for testing

Turn off the primary master sync feature

Create a database on 192.168.1.63 with the user you just created

View the database on the 192.168.1.126 server without the database ABC you just created

Log in to the database from another server to see the database created

Stop the MySQL service on the 192.168.1.163 server

Login 192.168.1.126,vip has drifted over.

When you log in to a VIP from another server, view the database

Did not see the created ABC database

At this point, MySQL high-availability creation is complete

Mysql+keepalived Configuration High Availability

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.