A test of HA

Source: Internet
Author: User

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/0255553945-0.jpg "/>

After the network is configured and the heartbeat Nic is disconnected, the application will not switch. At one time, the application thought it was a problem with its own configuration. However, the problem is solved when vnet3 is switched to a direct bridge with the NIC. This is most likely because there are some problems with the packet sending between vnet3.

 
 
  1. Prerequisite deployment:
  2. 1. Environment Configuration
  3. 2. Host Name, yum, ssh
  4.  
  5. 1. Install heartbeat.
  6. # Yum install-y heartbeat * # Run the command twice. Otherwise, some packages are not installed.
  7.  
  8. # Rpm-qa | grep heartbeat *
  9. Heartbeat-gui-2.1.3-3.el5.centos
  10. Heartbeat-2.1.3-3.el5.centos
  11. Heartbeat-stonith-2.1.3-3.el5.centos
  12. Heartbeat-devel-2.1.3-3.el5.centos
  13. Heartbeat-ldirectord-2.1.3-3.el5.centos
  14. Heartbeat-pils-2.1.3-3.el5.centos
  15.  
  16. Copy related configuration files:
  17. # Cp/usr/share/doc/heartbeat-2.1.3/ha. cf/etc/ha. d/# configuration file of ha. cf HA
  18. # Cp/usr/share/doc/heartbeat-2.1.3/haresources/etc/ha. d/# haresources resource file
  19. # Cp/usr/share/doc/heartbeat-2.1.3/authkeys/etc/ha. d/# authentication file between HA nodes
  20.  
  21. # Yum install-y httpd
  22.  
  23. # Vim/etc/ha. d/ha. cf
  24. Debugfile/var/log/ha-debug
  25. Logfile/var/log/ha-log
  26. Logfacility local0
  27. Keepalive 2
  28. Deadtime 30
  29. Warntime 10
  30. Initdead 120
  31. Udpport 694
  32. Ucast eth1 1.1.1.2 # Heartbeat
  33. Auto_failback on
  34. Node ha1
  35. Node ha2
  36. Ping 172.16.1.1 172.16.1.11 # IP address of the gateway and another node
  37. Respawn hacluster/usr/lib/heartbeat/ipfail
  38. Deadping 30
  39. Apiauth ipfail uid = hacluster
  40. Use_logd yes
  41. Conn_logd_time 60
  42.  
  43. # Cat authkeys # define the authenticated keys
  44. Auth 1
  45. 1 crc
  46. ======================
  47. Heartbeat [8404]: 2011/07/26 _ 05:02:48 ERROR: Bad permissions on keyfile [/etc/ha. d/authkeys], 600 recommended.
  48. Heartbeat [8404]: _ 05:02:48 ERROR: Authentication configuration error.
  49. Heartbeat [8404]: 2011/07/26 _ 05:02:48 ERROR: Configuration error, heartbeat not started.
  50.  
  51. # Chmod 600/etc/ha. d/authkeys
  52. ========================
  53. # Cat/etc/ha. d/haresources # configure HA Resources
  54. Ha1 IPaddr: 172.16.1.100/24/eth0: 0 httpd
  55.  
  56. #/Etc/init. d/heartbeat start
  57. Logd is already running
  58. Starting High-Availability services:
  59. 05:05:15 INFO: Resource is stopped
  60. [OK]
  61.  
  62. # The difference between ha1 and ha2 is that the ucast value and the IP address to be pinged.
  63. # ++ ++
  64. #
  65. # ++ ++
  66. The following are the process logs of breaking the happy jumper and re-inserting the heartbeat line:
  67. #Disconnect the heartbeat of one party
    Heartbeat [7043]: 2011/07/26 _ 13:53:40 WARN: node ha2.example.com: is dead
    Heartbeat [7043]: 2011/07/26 _ 13:53:40 info: Dead node ha2.example.com gave up resources.
    Heartbeat [7043]: 2011/07/26 _ 13:53:40 info: Link ha2.example.com: eth1 dead.
    Ipfail [7069]: 2011/07/26 _ 13:53:40 info: Status update: Node ha2.example.com now has status dead
    Ipfail [7069]: 2011/07/26 _ 13:53:42 info: NS: We are still alive!
    Ipfail [7069]: 2011/07/26 _ 13:53:42 info: Link Status update: Link ha2.example.com/eth1 now has status dead
    Ipfail [7069]: 2011/07/26 _ 13:53:44 info: Asking other side for ping node count.
    Ipfail [7069]: 2011/07/26 _ 13:53:44 info: Checking remote count of ping nodes.
  68. At this time, please use ip addr to observe the ip addresses of both parties, and we will find that the VIP address appears on two machines. Split-brain!

  69. # The second node is active again
    Heartbeat [7043]: 2011/07/26 _ 13:56:09 CRIT: Cluster node ha2.example.com returning after partition.
    Heartbeat [7043]: 2011/07/26 _ 13:56:09 info: For information on cluster partitions, See URL: http://linux-ha.org/SplitBrain
    Heartbeat [7043]: 2011/07/26 _ 13:56:09 WARN: Deadtime value may be too small.
    Heartbeat [7043]: 2011/07/26 _ 13:56:09 info: See FAQ for information on tuning deadtime.
    Heartbeat [7043]: 2011/07/26 _ 13:56:09 info: URL: http://linux-ha.org/FAQ#heavy_load
    Heartbeat [7043]: 2011/07/26 _ 13:56:09 info: Link ha2.example.com: eth1 up.
  70. Heartbeat [7043]: 2011/07/26 _ 13:56:09 WARN: Late heartbeat: Node ha2.example.com: interval 104930 MS
    Ipfail [7069]: 2011/07/26 _ 13:56:09 info: Link Status update: Link ha2.example.com/eth1 now has status up
    Heartbeat [7043]: 2011/07/26 _ 13:56:09 info: Status update for node ha2.example.com: status active
    Ipfail [7069]: 2011/07/26 _ 13:56:09 info: Status update: Node ha2.example.com now has status active
    Harc [7916]: 2011/07/26 _ 13:56:09 info: Running/etc/ha. d/rc. d/status
    Heartbeat [7043]: 2011/07/26 _ 13:56:12 info: Heartbeat shutdown in progress. (7043)
    # It is found that the heartbeat Nic of Node 2 is active again and heartbeat is restarted.
  71. Heartbeat [7932]: 2011/07/26 _ 13:56:13 info: Giving up all HA resources.
    ResourceManager [7945]: 2011/07/26 _ 13:56:13 info: Releasing resource group: ha1.example.com IPaddr: 172.16.1.100/24/eth0: 0 httpd
    ResourceManager [7945]: 2011/07/26 _ 13:56:13 info: Running/etc/init. d/httpd stop
    # The resource manager closes the previous application.
  72. ResourceManager [7945]: 2011/07/26 _ 13:56:13 info: Running/etc/ha. d/resource. d/IPaddr 172.16.1.100/24/eth0: 0 stop
    IPaddr [8037]: 2011/07/26 _ 13:56:13 INFO: ifconfig eth0: 0 down
    IPaddr [8008]: 2011/07/26 _ 13:56:13 INFO: Success
    # The corresponding VIP is also disabled.
  73. ResourceManager [8067]: 2011/07/26 _ 13:56:13 info: Releasing resource group: ha2.example.com IPaddr: 172.16.1.101/24/eth0: 1 vsftpd
    # Release the original ftp service ha2.example.com
  74. ResourceManager [8067]: 2011/07/26 _ 13:56:13 info: Running/etc/init. d/vsftpd stop
    ResourceManager [8067]: 2011/07/26 _ 13:56:14 info: Running/etc/ha. d/resource. d/IPaddr 172.16.1.101/24/eth0: 1 stop
    IPaddr [8161]: 2011/07/26 _ 13:56:14 INFO: ifconfig eth0: 1 down
    # Stop the service and stop the NIC.
  75. IPaddr [8132]: 2011/07/26 _ 13:56:14 INFO: Success
    Heartbeat [7932]: 2011/07/26 _ 13:56:14 info: All HA resources relinquished.
    Heartbeat [7043]: 2011/07/26 _ 13:56:16 info: killing/usr/lib/heartbeat/ipfail process group 7069 with signal 15
    Heartbeat [7043]: 2011/07/26 _ 13:56:17 info: stored ed shutdown notice from 'ha2 .example.com '.
    Heartbeat [7043]: 2011/07/26 _ 13:56:17 info: Resource takeover canceled-shutdown in progress.
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: killing HBFIFO process 7045 with signal 15
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: killing HBWRITE process 7046 with signal 15
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: killing HBREAD process 7047 with signal 15
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: killing HBWRITE process 7048 with signal 15
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: killing HBREAD process 7049 with signal 15
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Core process 7049 exited. 5 remaining
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Core process 7047 exited. 4 remaining
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Core process 7046 exited. 3 remaining
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Core process 7048 exited. 2 remaining
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Core process 7045 exited. 1 remaining
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: ha1.example.com Heartbeat shutdown complete.
    # Turn off the heartbeat Service
  76. Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Heartbeat restart triggered.
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Restarting heartbeat.
    Heartbeat [7043]: 2011/07/26 _ 13:56:19 info: Refreshing heartbeat restart exec.
    Heartbeat [7043]: 2011/07/26 _ 13:56:30 info: Version 2 support: false
    Heartbeat [7043]: 2011/07/26 _ 13:56:30 WARN: Logging daemon is disabled -- enabling logging daemon is recommended
    Heartbeat [7043]: _ 13:56:30 info :**************************
    Heartbeat [7043]: 2011/07/26 _ 13:56:30 info: Configuration validated. Starting heartbeat 2.1.3
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: heartbeat: version 2.1.3
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: Heartbeat generation: 1311635912
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: glib: ucast: write socket priority set to IPTOS_LOWDELAY on eth1
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: glib: ucast: bound send socket to device: eth1
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: glib: ucast: bound receive socket to device: eth1
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: glib: ucast: started on port 694 interface eth1 to 10.1.1.2
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: glib: ping group heartbeat started.
  77. Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: G_main_add_TriggerHandler: Added signal manual handler
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: G_main_add_TriggerHandler: Added signal manual handler
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: G_main_add_SignalHandler: Added signal handler for signal 17
    Heartbeat [8191]: 2011/07/26 _ 13:56:30 info: Local status now set to: 'up'
    Heartbeat [8191]: 2011/07/26 _ 13:56:32 info: Link group1: group1 up.
    Heartbeat [8191]: 2011/07/26 _ 13:56:32 info: Status update for node group1: status ping
    Heartbeat [8191]: 2011/07/26 _ 13:56:33 info: Link ha2.example.com: eth1 up.
    Heartbeat [8191]: 2011/07/26 _ 13:56:33 info: Status update for node ha2.example.com: status up
  78. Harc [8199]: 2011/07/26 _ 13:56:33 info: Running/etc/ha. d/rc. d/status
    Heartbeat [8191]: 2011/07/26 _ 13:56:33 info: Comm_now_up (): updating status to active
    Heartbeat [8191]: 2011/07/26 _ 13:56:33 info: Local status now set to: 'active'
    Heartbeat [8191]: 2011/07/26 _ 13:56:33 info: Starting child client "/usr/lib/heartbeat/ipfail" (498,496)
    Heartbeat [8216]: 2011/07/26 _ 13:56:33 info: Starting "/usr/lib/heartbeat/ipfail" as uid 498 gid 496 (pid 8216)
    Heartbeat [8191]: 2011/07/26 _ 13:56:34 info: Status update for node ha2.example.com: status active
    Harc [8219]: 2011/07/26 _ 13:56:34 info: Running/etc/ha. d/rc. d/status
    Ipfail [8216]: 2011/07/26 _ 13:56:40 info: Status update: Node ha2.example.com now has status active
    # Check the status of another node
    Ipfail [8216]: 2011/07/26 _ 13:56:43 info: Asking other side for ping node count.
    Ipfail [8216]: 2011/07/26 _ 13:56:46 info: No giveup timer to abort.
    Heartbeat [8191]: 2011/07/26 _ 13:56:50 info: local resource transition completed.
    Heartbeat [8191]: 2011/07/26 _ 13:56:50 info: Initial resource acquisition complete (T_RESOURCES (us ))
    Heartbeat [8191]: 2011/07/26 _ 13:56:50 info: remote resource transition completed.
    IPaddr [8271]: 2011/07/26 _ 13:56:51 INFO: Resource is stopped
    Heartbeat [8235]: 2011/07/26 _ 13:56:51 info: Local Resource acquisition completed.
    Harc [8324]: 2011/07/26 _ 13:56:51 info: Running/etc/ha. d/rc. d/ip-request-resp
    Ip-request-resp [8324]: 2011/07/26 _ 13:56:51 received ed ip-request-resp IPaddr: 172.16.1.100/24/eth0: 0 OK yes
    ResourceManager [8345]: 2011/07/26 _ 13:56:51 info: Acquiring resource group: ha1.example.com IPaddr: 172.16.1.100/24/eth0: 0 httpd
    IPaddr [8372]: 2011/07/26 _ 13:56:52 INFO: Resource is stopped
    # Obtain Resource Information
    ResourceManager [8345]: 2011/07/26 _ 13:56:53 info: Running/etc/ha. d/resource. d/IPaddr 172.16.1.100/24/eth0: 0 start
    IPaddr [8470]: 2011/07/26 _ 13:56:54 INFO: Using calculated netmask for 172.16.1.100: 255.255.255.0
    IPaddr [8470]: 2011/07/26 _ 13:56:54 INFO: eval ifconfig eth0: 0 172.16.1.100 netmask 255.255.255.0 broadcast 172.16.1.255
    IPaddr [8441]: 2011/07/26 _ 13:56:54 INFO: Success
    # Obtaining VIP addresses and IP addresses
    ResourceManager [8345]: 2011/07/26 _ 13:56:54 info: Running/etc/init. d/httpd start
  79. The service is normal! This log is a complete log!

Dual heartbeat and HA personal understanding http://myhat.blog.51cto.com/391263/623546

This article from the "diving into the ocean of technology" blog, please be sure to keep this source http://myhat.blog.51cto.com/391263/623559

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.