Centos + heartbeat + mysql configuration

Source: Internet
Author: User
Tags nameserver
Centos + heartbeat + mysql configuration 1: install two linux (rh4.5-32-bit) systems and disable the firewall. selinux is set to disable, and two NICs are required for each computer. The two computers are node1 and node2www. 2cto. the IP addresses of comnode1 are :----... centos + heartbeat + mysql configuration 1: install two linux (rh4.5-32-bit) systems and disable the firewall. selinux is set to disable, and two NICs are required for each computer. The IP addresses of node1 and node2 www.2cto.com node1 on the two computers are respectively: -------------------------------- eth0: 192.168.18.33 eth1: 10.0.0.3 (heartbeat address) and node2 respectively: -------------------------------- eth0: 192.168.18.44 eth1: 10.0.0.4 (heartbeat address) -------------------------- 192.168.18.30 (Virtual IP address) -------------------------------- Note: ensure that each Nic of the two computers can be pinged. 2. ensure that the files under the two computers must be the same as www.2cto.com/etc/hosts/etc/host. conf/etc/resolv. conf # vi/etc/hosts node1 hosts content is as follows: IP address domain name Machine name 192.168.18.33 real-node1 10.0.0.3 node1 192.168.18.44 real-node2 10.0.0.4 node2 (ensure that the machine name and parameter uname-n output is consistent) # vi/etc/host. conf order hosts, bind # vi/etc/resolv. conf nameserver 8.8.8.8 (if the DNS address is empty, enter it according to the local dns) the hosts content of node2 is as follows: IP address domain name Machine name 192.168.18.33 real node1 10.0.0.3 node1 192.168.18.4 4 real node2 10.0.0.4 node2 (ensure that the machine name and parameter uname-n output are consistent) # vi/etc/host. conf order hosts, bind # vi/etc/resolv. conf nameserver 8.8.8.8 (enter the DNS address based on the local dns if it is null) 3. install the heartbeat software package on both computers. In order 1: heartbeat-gui-2.1.2-2.el4.centos.i386.rpm 2: heartbeat-pils-2.1.2-2.el4.centos.i386.rpm 3: heartbeat-stonith-2.1.2-2.el4.centos.i386.rpm 4: heartbeat-2.1.2-2.el4.centos.i386.rpm 4: profiles. Go to the/usr/share/doc/heartbeat-2.1.2/directory and copy authkeys, ha. cf, and haresources to the/etc/ha. d/directory for configuration. (These three files must be consistent on two computers .) Configure the following method: authkeys # vi/etc/ha. d/authkeys dual-host couplet line (the network cable is a crossover line). The configuration is as follows: # vi/etc/hc. d/authkeys auth 1 1 crc disk exit, then # chmod 600 authkeys modify file permissions (required) configure heartbeat configuration file: ha. cf # vi/etc/ha. d/ha. cf logfile/var/log/ha-log (location of the ha log file record. If this directory does not exist, you need to manually add bcast eth1 keepalive 2 (set the heartbeat (monitoring) time to 2 seconds) warntime 10 (beyond this interval, the heartbeat of the other node is not received, A warning is issued and recorded in the log .) Deadtime 30 (if the heartbeat of the other node is not received beyond this interval, the other node is considered dead.) initdead 120 (on some systems, after the system is started or restarted, it takes some time for the network to work normally. this option is used to solve the time interval generated in this case. The value must be at least twice the deadtime value .) Udpport 694 (using udp port 694 for heartback monitoring) auto_failback off nice_failback on (nice_failback) is not available in this version of heartbeat. if not, you can manually add it as needed. The two master nodes of heartbeat are the master node and Slave node respectively. the master node normally occupies resources and runs all services, in case of a fault, the resource is handed over to the Slave node and the Slave node runs the service. 1: When the auto_failback option is on, resources are automatically restored once the master node resumes running. 2: When the auto_failback option is off and the nice_failback option is on, resources are not automatically restored once the master node recovers. This is the second case .) Node node1 (node 1, which must be consistent with the result obtained by The uname-n Command .) node node2 (node 2) configure the heartbeat resource: haresources # vi/etc/ha. d/haresources node1 192.168.18.30 httpd mysql (start httpd first and then start mysql, close mysql first and then disable httpd) specify node1 to start httpd and mysql services, and the system attaches a virtual IP address 192.168.18.30 to eth0: 0. If node1 goes down, node2 can automatically start httpd and mysql services, and assign a new IP address 192.168.18.30 to the eth0: 0. the web service listening address of node2. 5. set heartbeat to automatically start (start when the system starts) cd/etc/rc. d/rc0.d ln-s/etc/init. d/heartbeat K05heartbeat cd/etc/rc. d/rc3.d ln-s/etc/init. d/heartbeat S75heartbeat cd/etc/rc. d/rc5.d ln-s/etc/init. d/heartbeat S75heartbeat cd/etc/rc. d/rc6.d ln-s/etc/init. d/heartbeat K05heartbeat (uppercase letters: S and K)
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.