Mysql DBA Advanced Operations Learning Note-heartbeat High availability cases and maintenance essentials for Web Services

Source: Internet
Author: User
Tags dba svn web services haproxy

8.Heartbeat High-availability case for Web Services 8.1 deployment Readiness

Familiarize yourself with the use of the Heatbeat software using the Web services high Availability case, with the two server machine names above heartbeat-1-130 and heartbeat-1-129 respectively

8.2 Installing the Configuration HTTP service (two machines are installed)
yum install httpd -y
8.3 Configuring the HTTPd startup script

Copy the httpd boot script to/etc/ha.d/resource.d/on both machines, and make sure the permissions are executable.

[[email protected] html]# cp /etc/init.d/httpd /etc/ha.d/resource.d/

Script Requirements for heartbeat control:

(1) Script path to be put into/etc/init.d/httpd or/etc/ha.d/resource.d/

(2) Script execution needs to be/etc/init.d/httpd start/stop way

(3) scripts have executable permissions

(4)/ETC/INIT.D/HTTPD name should be the same as set on Haresources

8.4 Modifying the Haresource configuration file

Setting up the HTTPD service does not start and stops the HTTPD service so heartbeat is responsible for starting and stopping the httpd service.

[[email protected] html]# chkconfig httpd off[[email protected] html]# /etc/init.d/httpd stop停止 httpd:   [确定]

Modify the Haresource file (two machines are to be modified)

[[email protected] ha.d]# cat haresources heartbeat-1-130 IPaddr::192.168.1.131/24/eth0:1 httpd

HTTPD is a service for heartbeat monitoring, and it is also the core service provided by two machines externally.

9. Production scenario application for heartbeat call resources

There are two ways to implement high-availability issues in your work:

(1) Heartbeat can only control the shift of VIP resources and is not responsible for the start and stop of service resources. This approach is appropriate for Web services.

(2) Heartbeat is to control the shift of VIP resources, but also responsible for the start and stop of service resources, and IP and services to switch between switching, this method is suitable for data services. VIP Normal, httpd server outage, this time will not do high-availability switch. Write a script or daemon to judge the httpd service. If there is a problem, stop heartbeat to proactively switch the business on to another one.

Application scenarios and differences of Heartbeat and keepalived

(1) for the general web, DB, load Balancing (nginx,haproxy), and so on, heartbeat and keepalived can be achieved.

(2) LVs load Balancing and keepalived combination, although heartbeat can also invoke a script with ipvsadm command to start and stop the LVS load balancer, but heartbeat itself does not have the RS check function, This flaw can be remedied by Idircetord plugins.

(3) High-availability services that require data synchronization (with DRBD) are best used with heartbeat columns such as: MySQL dual master multi-slave, Nfs/mfs storage, their greatest feature is the need for data synchronization, such business is best used heartbeat, Because heartbeat comes with a script for DRBD.

One by one. Recovery Essentials in heartbeat service production environment

Every day there may be some needs, new projects on-line or VIP change requirements, may be added to modify the service VIP operations. Let's take Heartbeat+haproxy/nginx high-availability load balancing as an example to learn about maintenance methods in a production environment.
All profiles are placed in SVN, after the changes are submitted to the SVN comparison and pushed to the formal environment.

(1) Execute/etc/init.d/heartbeat stop or/usr/lib64/heartbeat/hb_standby (this command is best) before modifying the configuration file, push the native command to the standby node, and when the confirmation node is working properly, Start to modify the local configuration, modify and execute/etc/init.d/heartbeat start to take the resource service back. When you push the business to the standby node and modify the configuration to take over back to the server immediately whether the service is normal, especially if all the VIP (new old) to start the Ok,url address is not able to open, this check process can be written in the Hearbeat service startup script parameters.

(2) First set the VIP to add, add the IP alias. Setup succeeds and then modifies the haresources configuration file to modify the newly added VIP. Restarting heartbeat at night or at a lower volume of business is of course to stop the old VIP.

Mysql DBA Advanced Operations Learning Note-heartbeat High availability cases and maintenance essentials for Web Services

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.