MySQL transcription 5:mysql+kepalived High-availability architecture

Source: Internet
Author: User

KeepAlive

    • Similar to the 3/4/7 layer Exchange mechanism of the software, which is usually said third layer, fourth layer, seventh layer Exchange
    • The role is to detect the state of the Web server, if there is a Web server, MySQL server down, or work failure, keepalived detected a problem, the faulty Web server or MySQL server will be removed from the system
    • When the service is working properly, Keepalived automatically joins the web, MySQL service into the current service farm
    • Automatic completion of the switching process, no manual interference required
    • Human tasks only fix faulty web and MySQL services
Keepalived installation Configuration
TarZXF keepalived-1.2.1.Tar. GZ CD keepalived-1.2.1&&./configure--with-kernel-dir=/usr/src/kernels/2.6. --164. el5-i686 && Make&& Make InstallDIR=/usr/local/
CP$DIR/etc/rc.d/init.d/keepalived/etc/rc.d/init.d/CP$DIR/etc/sysconfig/keepalived/etc/sysconfig/&&mkdir-p/etc/keepalivedCP$DIR/sbin/keepalived/usr/sbin/

Modifying the master configuration vi/etc/keepalived/keepalived.conf

! Configuration File forkeepalived Global_defs {notification_email {[email protected]139. com} notification_email_from [email protected]139. com smtp_server127.0.0.1Smtp_connect_timeout -router_id Lvs_devel} # VIP1 vrrp_instance vi_1 {State MASTER interface eth0 Lvs_sync_daemon_int Eface eth0 virtual_router_id151 Priority -Advert_int5nopreempt Authentication {auth_type PASS auth_pass2222} virtual_ipaddress {192.168.33.100}} virtual_server192.168.33.100 3306{Delay_loop6Lb_algo wrr lb_kind DR persistence_timeout -protocol TCP Real_server192.168.33.10 3306{weight -Notify_down/data/SH/mysql.SHTcp_check {connect_timeoutTenNb_get_retry3Delay_before_retry3Connect_port3306          }      }  }

Modifying the slave configuration

    • Just change the IP of Realserver to Real_server 192.168.33.11
    • Priority changed from 100 to 90

Script Content

Pkill keepalived

View Ipvs Modules

Modprobe Ipvs

Loading the Ipvs module

Modprobe Ip_vs

Lsmod|grep Ip_vs

Conclusion
    • Use preemption mode for keepalived
    • Master db hung up, cut to backup.
    • Master db restored, automatically cut back to master---is likely to have DB problems, data written on the slave, and wrote on the master
    • If the keepalived on the main is hung (although the odds are small), Master's DB does not hang, and switch to slave, in case the asynchronous data is not synchronized (the odds are low), the data will be inconsistent
    • Is there a usage scenario in this way?

MySQL transcription 5:mysql+kepalived High-availability architecture

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.