First, elaborated the Linux HA cluster use background;
1.1 High-availability cluster definitions:
Highly available cluster full name: High Availability Cluster, simply put, the cluster is a set of highly scalable, high-availability, cost-effective computers. They provide the user with a set of network resources as a whole. One of the individual computer systems is a cluster node. The main function of high-availability cluster software is to automate fault checking and business switching to provide uninterrupted service.
1.2 Key benefits of the cluster system:
(1) High scalability:
(2) Ha: A node in a cluster fails, and its tasks can be passed to other nodes. Can effectively prevent single point of failure.
(3) High performance: load Balancing cluster allows the system to access more users at the same time.
(4) Cost-effective: high-performance systems can be constructed with inexpensive, industry-standard hardware.
Specific HA measurement criteria:
99% downtime of less than 4 days a year
99.9% downtime of less than 10 hours a year
99.99% downtime of less than 1 hours a year
99.999% downtime less than 6 minutes a year
Second, summarize the system composition of Linux ha cluster, the working model of HA cluster;
Third, through the lamp combination, based on heartbeat V2 CRM implementation ha; requirements, the deployment of WordPress, for editing any data in the article can be accessed after the node switch;
1. Prerequisites for configuring HA Clusters:
⑴ time between nodes must be synchronized: using the NTP protocol implementation;
Two node server node1.duoyoumi.com:192.168.1.193 and node2.duoyoumi.com:192.168.1.194 sub-installation NTP service, after installation, two nodes synchronize a stable time server time, Currently on the node1.duoyoumi.com server
Ntpdate 192.168.1.187;ssh 192.168.1.194 ' ntpdate 192.168.1.187 '
⑵ Inter-node requirements through the host name to communicate with each other, must resolve the host to the IP address;
node1.duoyoumi.com 192.168.1.193 Node 1 lamp+heartbeat2
node2.duoyoumi.com 192.168.1.194 Node 2 lamp+heartbeat2
node3.duoyoumi.com 192.168.1.195 Node 3 NFS shared storage
⑶ consider whether the arbitration equipment is used;
⑷ establish the root user between the nodes can be based on key authentication;
Key authentication is the other system generated key pair of the public key appended to the local system in the/root/.ssh/authorized_keys file, the local system can implement the key authentication method login, conversely, remember to append, or else may be the other server key to cover the
2. Package Installation:
⑴ Dependent Package Installation: Yum-install net-snmp-libs libnet PyXML perl-time-date
⑵heartbeat Package Installation: RPM-IVH heartbeat-2.1.4-12.e16.x86_64.rpm heartbeat-pils-2.1.4-12.e16.x86_64.rpm heartbeat- stonith-2.1.4-12.e16.x86_64.rpm
The general error in the process is libnet package through Yum can not be installed, you have to manually next Libnet binary package installation
3. Modify the configuration file:
After the heartbeat package is successfully installed, first copy the HA.CF, Authkeys, and haresources three files from the/usr/share/doc/heartbeat-2.1.4 to the node server/etc/ HA.D directory, note: Authkeys file permissions must be 600 or 400
⑴HA.CF: Master configuration file, defining Heartbeat ha basic properties on each node
# Debugfile/var/log/ha-debug whether the debug feature is turned on, the file location for which the feature has been debugged (you can choose this option) logfacility local0 Logging with Rsyslog and pointing to local0
&N Bsp
keepalive 1 Heartbeat, replacement time
Warntime 8 warning Time
Initdead How long after the heartbeat starts to check the heartbeat
Udpport 694 Heartbeat Port 694, after starting heartbeat, can be viewed by ss-utnl
#bcast eth0 # Linux Linux broadcast ports
mcast eth0 225.23.190.1 694 1 0 multicast address, can be ifconfig to see if a multicast address is opened
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/E9/wKioL1YuJkngoMClAAJTzk89WP8970.jpg "title=" 123. PNG "alt=" wkiol1yujkngomclaajtzk89wp8970.jpg "/> If not, open the multicast mode via IP link set eth0 multicast on
#ucast eth0 192.168.1.2 Multicast address
Auto_failback on fault auto recovery, default on
Node node1.com nodes, remember that the IP address cannot be used in this office and the name must be the same as the hostname result
Node node2.com nodes, remember that you cannot use an IP address in this office
#compression bz2 compression transfer algorithm on the primary node start whether to automatically switch back to the master node
ping 192.168.1.187 quorum device, can point to Gateway
#ping_group group1 10.10.10.25410.10.10.253 Quorum device Group
#debug levels of 1debug
Minimum size of #compression_threshold 2 compression, in kilobytes
CRM on open CRM also disables Haresource.
⑵authkeys: The encryption algorithm and key are used when passing messages to each other in the cluster; file permissions must be set to 600
Edit the Authkeys file to generate a character password using OpenSSL random-base64 23
[email protected] ha.d]# OpenSSL rand-base64 23
Hgtjsdpdwvtvb+6okn7mfnbokglqhhe=
# Vim/etc/ha.d/authkeys
Auth 2
#1 CRC
2 SHA1 hgtjsdpdwvtvb+6okn7mfnbokglqhhe=
#3 MD5 hello!
Wq
[[email protected] HA.D] #chmod Authkeys
⑶ Installing lamp
Yum install http mysql-server php php-mysql
After successful installation
This article is from the "Multi-Surveyors" blog, please be sure to keep this source http://icestick8586.blog.51cto.com/9867871/1834098
Linux HA Cluster High-availability cluster HEARTBEAT2