Since after struggling so many days, I accomplished basic setup of Pacemaker with Corosync in Cent OS 6.4 and following are the steps, thought of sharing...
Hope Cent OS is installed already in both the host machines. Here am using 2-node clustering.
We need to update /etc/sysconfig/network. This is what it should look like before we start.
SSH is a convenient and secure way to copy files and perform commands remotely. For the purposes of this guide, we will create a key without a password (using the -N option) so that we can perform remote actions without being prompted.
The instructions below only apply for a machine with a single NIC. If you have a more complicated setup, you should edit the configuration manually.
Once you’re happy with the chosen values, update the Corosync configuration
cat << END >> /etc/corosync/corosync.conf
quorum {
provider: corosync_votequorum
expected_votes: 2
}
END
Verify Pacemaker Insatllation
Hope Cent OS is installed already in both the host machines. Here am using 2-node clustering.
Networking
As a first step disable the selinux and iptables# service iptables stopShort node Names
# chkconfig iptables off
# setenforce 0
# sed -i.bak "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config (to make permanent)
We need to update /etc/sysconfig/network. This is what it should look like before we start.
# cat /etc/sysconfig/networkHowever we’re not finished. The machine wont normally see the host name until about it reboots, but we can force it to update.
NETWORKING=yes
HOSTNAME=pcmk-1.example.org
GATEWAY=
# source /etc/sysconfig/networkNow you can check the machine is using correct names
# hostname $HOSTNAME
# uname -nConfigure SSH
# pcmk-1.example.org
SSH is a convenient and secure way to copy files and perform commands remotely. For the purposes of this guide, we will create a key without a password (using the -N option) so that we can perform remote actions without being prompted.
Creating and Activating a new SSH Key
# ssh-keygen -t dsa -f ~/.ssh/id_dsa -N ""
Generating public/private dsa key pair.
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
91:09:5c:82:5a:6a:50:08:4e:b2:0c:62:de:cc:74:44 root@pcmk-1.clusterlabs.org
The key's randomart image is:
+--[ DSA 1024]----+
|==.ooEo.. |
|X O + .o o |
| * A + |
| + . |
| . S |
| |
| |
| |
| |
+-----------------+
# cp .ssh/id_dsa.pub .ssh/authorized_keysInstall the key on the other nodes and test that you can now run commands remotely, without being prompted
# scp -r .ssh pcmk-2.example.org:Cluster Software Installation
The authenticity of host 'pcmk-2.example.org (192.168.122.102)' can't be established.
RSA key fingerprint is b1:2b:55:93:f1:d9:52:2b:0f:f2:8a:4e:ae:c6:7c:9a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'pcmk-2.example.org,192.168.122.102' (RSA) to the list of known hosts.root@pcmk-2.example.org's password:
id_dsa.pub 100% 616 0.6KB/s 00:00
id_dsa 100% 672 0.7KB/s 00:00
known_hosts 100% 400 0.4KB/s 00:00
authorized_keys 100% 616 0.6KB/s 00:00
# ssh pcmk-2.example.org -- uname -n
pcmk-2.example.org
# wget -P /etc/yum.repos.d/ http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/network:ha-clustering:Stable.repo
# yum install -y pacemaker corosyncConfigure Corosync
# yum install -y cman gfs2-utils gfs2-cluster
#yum install crmsh.x86_64
The instructions below only apply for a machine with a single NIC. If you have a more complicated setup, you should edit the configuration manually.
# export ais_port=4000Next we automatically determine the hosts address. By not using the full address, we make the configuration suitable to be copied to other nodes.
# export ais_mcast=239.255.1.1
#export ais_addr=`ip addr | grep "inet " | tail -n 1 | awk '{print $4}' | sed s/255/0/g`Display and verify the configuration options
# env | grep ais_Note: Please make sure you have multicast is enabled in your switch, if not enabled then you will face communication problem between your nodes. In my case I struggled and than changed to unicast, because multicast didn't worked for my setup. For unicast example file will be available in this path by default "/etc/corosync/corosync.conf.example.udpu"
ais_mcast=239.255.1.1
ais_port=4000
ais_addr=192.168.122.0
Once you’re happy with the chosen values, update the Corosync configuration
# cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.confLastly, you’ll need to enable quorum
# sed -i.bak "s/.*mcastaddr:.*/mcastaddr:\ $ais_mcast/g" /etc/corosync/corosync.conf
# sed -i.bak "s/.*mcastport:.*/mcastport:\ $ais_port/g" /etc/corosync/corosync.conf
# sed -i.bak "s/.*\tbindnetaddr:.*/bindnetaddr:\ $ais_addr/g" /etc/corosync/corosync.conf
quorum {
provider: corosync_votequorum
expected_votes: 2
}
END
In my case my /etc/corosync/corosync.conf file looks like the following,
#cat /etc/corosync/corosync.confPropagate the configuration to other node
# Please read the corosync.conf.5 manual page
compatibility: whitetank
totem {
version: 2
secauth: off
threads: 0
interface {
member {
memberaddr: 10.30.2.98
}
member {
memberaddr: 10.30.2.99
}
ringnumber: 0
bindnetaddr: 10.30.2.0
mcastport: 4000
ttl: 1
}
transport: udpu
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: yes
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
quorum {
provider: corosync_votequorum
expected_votes: 2
}
# for f in /etc/corosync/corosync.conf /etc/hosts; do scp $f pcmk-2.example.org:$f ; doneVerify Corosync Installation
# /etc/init.d/corosync startCheck the cluster started correctly and that an initial membership was able to form
Starting Corosync Cluster Engine (corosync): [ OK ]
# grep -e "corosync.*network interface" -e "Corosync Cluster Engine" -e "Successfully read main configuration file" /var/log/messages
Aug 27 09:05:34 pcmk-1 corosync[1540]: [MAIN ] Corosync Cluster Engine ('1.1.0'): started and ready to provide service.
Aug 27 09:05:34 pcmk-1 corosync[1540]: [MAIN ] Successfully read main configuration file '/etc/corosync/corosync.conf'.
# grep TOTEM /var/log/messagesStart Corosync in other node and check for any error messages.
Aug 27 09:05:34 pcmk-1 corosync[1540]: [TOTEM ] Initializing transport (UDP/IP).
Aug 27 09:05:34 pcmk-1 corosync[1540]: [TOTEM ] Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0).
Aug 27 09:05:35 pcmk-1 corosync[1540]: [TOTEM ] The network interface [192.168.122.101] is now up.
Aug 27 09:05:35 pcmk-1 corosync[1540]: [TOTEM ] A processor joined or left the membership and a new membership was formed.
Verify Pacemaker Insatllation
# grep pcmk_startup /var/log/messagesNow try starting Pacemaker and check the necessary processes have been started
Aug 27 09:05:35 pcmk-1 corosync[1540]: [pcmk ] info: pcmk_startup: CRM: InitializedAug 27 09:05:35 pcmk-1 corosync[1540]: [pcmk ] Logging: Initialized pcmk_startup
Aug 27 09:05:35 pcmk-1 corosync[1540]: [pcmk ] info: pcmk_startup: Maximum core file size is: 18446744073709551615
Aug 27 09:05:35 pcmk-1 corosync[1540]: [pcmk ] info: pcmk_startup: Service: 9Aug 27 09:05:35 pcmk-1 corosync[1540]: [pcmk ] info: pcmk_startup: Local hostname: pcmk-1.example.org
# /etc/init.d/pacemaker start
Starting Pacemaker Cluster Manager: [ OK ]
# grep -e pacemakerd.*get_config_opt -e pacemakerd.*start_child -e "Starting Pacemaker" /var/log/messages
Next, check for any ERRORs during startup - there shouldn’t be any.
# grep ERROR: /var/log/messages | grep -v unpack_resourcesRepeat on the other node and display the cluster’s status.
# crm_mon -1So far we have build the basic setup, we have to add to resource, with Active/Passive or Active/Active clustering. Will be coming up in next coming posts.
============
Last updated: Thu Aug 27 16:54:55 2009Stack: openais
Current DC: pcmk-1 - partition with quorum
Version: 1.1.5-bdd89e69ba545404d02445be1f3d72e6a203ba2f
2 Nodes configured, 2 expected votes
0 Resources configured.
============
Online: [ pcmk-1.example.org pcmk-2.example.org ]
Thanks for reading, comments would be appreciated. Article taken from www.cluster.org.
1 comment:
over at this website 7a replica bags wholesale look at more info Louis Vuitton replica Bags find out replica designer bags wholesale
Post a Comment