博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UbuntuHighAvailabilityTeam
阅读量:4164 次
发布时间:2019-05-26

本文共 3025 字,大约阅读时间需要 10 分钟。

For the sample configuration we will have two nodes called ha01 and ha02, and we will service an IP address, that we will call the Virtual IP address (VIP), on anactive / passive configuration. Both nodes will need to have name resolution configured either through DNS or the /etc/hosts file.

Installing Pacemaker-Heartbeat

First of all, we need to add the repositories to be able to install heartbeat. We add the following to /etc/apt/sources.list

deb http://ppa.launchpad.net/ubuntu-ha/ppa/ubuntu karmic maindeb-src http://ppa.launchpad.net/ubuntu-ha/ppa/ubuntu karmic main

Then, we issue the following:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B64F0AFA

Now, we can install pacemaker-heartbeat:

sudo apt-get update && sudo apt-get install pacemaker-heartbeat

Configuring

Pacemaker-Heartbeat needs 3 main configuration files. These are /etc/ha.d/authkeys, /etc/ha.d/ha.cf, and /var/lib/heartbeat/crm/cib.xml. There is a fourth configuration file, /etc/logd.cf, which contains the log settings.

  • On the first host, edit /etc/ha.d/authekys. This file is the same in all Pacemaker-Heartbeat style configurations. It stores the authentication information that will be used in the cluster nodes.
auth 11 md5 DesiredPassword
  • Then, change permissions of the file:
sudo chmod 600 /etc/ha.d/authkeys
  • Then, we need to create the file which has the logging configurations (/etc/logd.cf):
logfile /var/log/ha-log

or do as root

sed -e 's/#logfile*/logfile/' /usr/share/doc/heartbeat/logd.cf > /etc/logd.cf
  • Then, edit /etc/ha.d/ha.cf with the following:
use_logd onudpport 694keepalive 2warntime 15deadtime 30initdead 30mcast eth0 239.0.0.43 694 1 0node ha01 ha02crm respawn
  • To finish, copy all configuration files to the second node:
scp /etc/ha.d/authkeys ha02:~scp /etc/ha.d/ha.cf ha02:~scp /etc/logd.cf ha02:~
  • And move then to the corresponding directories in the second node.
sudo mv authkeys /etc/ha.d/sudo mv ha.cf /etc/ha.d/sudo mv logd.cf /etc/
  • Then, start Heartbeat and wait for it to make intra cluster communication so that we can add the service to the cluster resources manager.
sudo /etc/init.d/heartbeat start
  • Once it has made intra cluster configuration, specify some global options for the cluster resource manager:
crm_attribute --attr-name symmetric-cluster --attr-value truecrm_attribute --attr-name default-resource-stickiness --attr-value INFINITYcrm_attribute --attr-name stonith-enabled --attr-value false
  • Then, edit the following file /tmp/resources.xml, which configuration parameters for the resource:
 
  • After creating above file, you need to tell Heartbeat to add it to the cluster configuration.
cibadmin -o resources -C -x /tmp/resources.xml
  • Finally, we need to edit the following file again, /tmp/resources.xml, which will specify the constraints, that will tell the Cluster Resource Manager how it should failover the services.
 

After editing above file, you need to tell Heartbeat to add it to the cluster configuration.

cibadmin -o constraints -C -x /tmp/resources.xml

 

from :    

 

see also :   

转载地址:http://tutxi.baihongyu.com/

你可能感兴趣的文章
Android 的source (需安装 git repo)
查看>>
LOCAL_PRELINK_MODULE和prelink-linux-arm.map
查看>>
Simple Guide to use the gdb tool in Android environment
查看>>
Build GingerBread on 32 bit machine.
查看>>
Timestamping Linux kernel printk output in dmesg for fun and profit
查看>>
CentOS7 安装MySQL 5.6.43
查看>>
使用Java 导入/导出 Excel ----Jakarta POI
查看>>
本地tomcat 服务器内存不足
查看>>
IntelliJ IDAE 2018.2 汉化
查看>>
Openwrt源码下载与编译
查看>>
rootkit related
查看>>
go语言如何从终端逐行读取数据?------用bufio包
查看>>
go的值类型和引用类型------重要的概念
查看>>
求二叉树中结点的最大值(所有结点的值都是正整数)
查看>>
用go的flag包来解析命令行参数
查看>>
来玩下go的http get
查看>>
队列和栈的本质区别
查看>>
matlab中inline的用法
查看>>
如何用matlab求函数的最值?
查看>>
EasySwift/YXJOnePixelLine 极其方便的画出真正的一个像素的线
查看>>