Highly Available Centos7 Ha:corosync+packmaker+http\mysql

Source: Internet
Author: User

Corosync+pacemaker: It is best to have more than three nodes in the configuration of Corosync, and the number of nodes is odd, if the use of an even number of nodes, it does not matter, just to turn off the decision-making policy function without legal votes

Supported services in the Pacemaker directory/usr/lib/ocf/resource.d/heartbeat

Environment:

Three machines: Centos7-docker-test1 10.1.1.170

Centos7-docker-test2 10.1.1.169

Centos7-docker-test3 10.1.1.171

Cluster ip:10.1.1.207

1. Configure these 3 machines to identify each other with the host name:

For example,/etc/hosts files on the 10.1.1.170 machine:

[Email protected] ~]# more/etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6

10.1.1.171 Centos7-docker-test3

10.1.1.169 Centos7-docker-test2

10.1.1.170 Centos7-docker-test1

2. Three machines shut down the firewall, setenforece is 0, install NTP service, ensure two machine time synchronization

#setenforce 0

#systemctl Disable Firewalld.service

#systemctl Stop Firewalld.service

#iptables--flush

Installation Time service:

Yum Install NTP

Systemctl Start NTPD

Systemctl Enable NTPD

Ntpdate cn.pool.ntp.org

3. Install the Corosync and pacemaker installation packages on three machines:

Yum install-y pacemaker PCs Psmisc Policycoreutils-python

After installation, a system user Hacluster will be generated

4. Enable PCs

#systemctl Enable Pcsd.service

#systemctl Restart Pcsd.service

#passwd Hacluster (three machine passwords remain the same)

5. Perform cluster authentication on a single machine:

PCS cluster auth-u hacluster-p futong-jw centos7-docker-test1 centos7-docker-test2 centos7-docker-test3

6. Perform cluster synchronization configuration on a single machine

#pcs Cluster setup--start--name mycluster 10.1.1.170 10.1.1.169

This command adds the corosync.conf configuration file to the/etc/corosync directory of three Machines

7. Each reboot automatically starts the cluster:

#pcs cluster Enable--all

Two nodes, the quorum function is ignored:

PCs Property Set No-quorum-policy=ignore

8. Inspection:

#pcs Status Corosync

#pcs status

9. Configure shared resources

PCs property set Stonith-enabled=false disabling Stonith devices

PCS resource Create VIP OCF:HEARTBEAT:IPADDR2 ip=10.1.1.207 cidr_netmask=24 op monitor interval=30s #配置共享IP

#配置http服务HA, note: The HTTP service on all nodes must be shut down before HTTP ha can run properly, so do not configure the auto-start feature with the system after installing the HTTPD service

The status module is not started in the default Apache, so the module required for status is enabled first #所有节点上都要做这个设置

grep status_mod/etc/httpd/conf/httpd.conf

httpd-m | grep status

Vi httpd.conf

<Location/server-status>

SetHandler Server-status

Order Deny,allow

Allow from all

</Location>

http://blog.itpub.net/29620572/viewspace-1773071/httpd.conf Configuration Instructions

PCS resource create Web-server1 Apache configfile= "/etc/httpd/conf/httpd.conf" statusurl= "Http://127.0.0.1/server-status"

Also set the host Clusterip and Web-server1 should run on the unified node so that the cluster IPDE value can be fully exploited

PCS constraint colocation add Web clusterip INFINITY

and set the priorities for both launches.

PCS constraint order Clusterip then Web

To configure MySQL, the system cancels the MySQL self-boot and stops the MySQL run:

PCS resource create mysql-server mysql config= "/etc/my.cnf" datadir= "/var/lib/mysql" user= "root"

PCS constraint colocation add mysql-server VIP1 INFINITY

PCS constraint order VIP1 then mysql-server

10. View current cluster status

#pcs status

11. You can do the following two tests:

1) Close the node that is currently running the resource and transfer the resource to the other node

2) Delete the HTTPD software on the currently running resource node, and the VIP and Web resources are migrated to the other nodes at the same time

View PCs cluster IP address:

[Email protected] etc]# pcs resource show VIP

RESOURCE:VIP (CLASS=OCF provider=heartbeat TYPE=IPADDR2)

attributes:ip=10.1.1.207 cidr_netmask=24

Operations:start interval=0s timeout=20s (vip-start-interval-0s)

Stop interval=0s timeout=20s (vip-stop-interval-0s)

Monitor interval=30s (vip-monitor-interval-30s)

http://blog.csdn.net/jemmy858585/article/details/43203375 PCs command Daquan


This article is from the "old section of the Cultivation of Life" blog, please be sure to keep this source http://031028.blog.51cto.com/9866455/1837012

Highly Available Centos7 Ha:corosync+packmaker+http\mysql

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.