Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
TetraWiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Cluster of energoindia drbd and heartbeat
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== '''############## ON NODE2 configuration ##############''' == [root@node2 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 mail.energoindia.com mail localhost.localdomain localhost #::1 localhost6.localdomain6 localhost6 192.168.10.149 node1.energoindia.com node1 node.energoindia.com mail 192.168.1.150 node.energoindia.com node mail.energoindia.com mail 10.0.0.1 node1.energoindia.com node1 node.energoindia.com 10.0.0.2 node2.energoindia.com node2 node.energoindia.com 192.168.10.155 node2.energoindia.com node2 node.energoindia.com mail ''':::::::::Installing DRBD:::::::''' [root@node2 ~]# yum install drbd83-utils kmod-drbd83 Configuration should be same as in node1: [root@node2 ~]# mv /etc/drbd.d/global_common.conf /etc/drbd.d/global_common.sample [root@node2 ~]# vim /etc/drbd.d/global_common.conf global { usage-count no; } common { syncer { rate 100M; } } Create a new resource file that I called βmainβ, [root@node2 ~]# vim /etc/drbd.d/main.res resource main { protocol C; startup { wfc-timeout 0; degr-wfc-timeout 120; } disk { on-io-error detach; } on node1.energoindia.com { device /dev/drbd0; disk /dev/VolGroup00/LogVol02; meta-disk internal; address 10.0.0.1:7788; } on node2.energoindia.com { device /dev/drbd0; disk /dev/mapper/VolGroup00-LogVol02; meta-disk internal; address 10.0.0.2:7788; } } Now we have to create the metadata on node2: [root@node2 ~]# dd if=/dev/zero of= /dev/VolGroup00/LogVol02 bs=1M count=50 [root@node2 ~]# drbdadm create-md main Now start DRBD on this (node2) server: [root@node2 ~]# service drbd start Starting DRBD resources: [ d(main) s(main) n(main) ]. After starting drbd on node2 server, it start to synchronization between both nodes. It will take a little while to be completed. Please wait until it is done and move to the next step. [root@node2 ~]# cat /proc/drbd version: 8.3.16 (api:88/proto:86-97) GIT-hash: a798fa7e274428a357657fb52f0ecf40192c1985 build by phil@Build64R5, 2013-09-27 15:48:18 0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----- ns:503808 nr:0 dw:0 dr:504472 al:0 bm:30 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:41437916 [>....................] sync'ed: 1.3% (40464/40956)M finish: 1:06:40 speed: 10,340 (10,280) K/sec '''::::::Installing heartbeat::::::''' [root@node2 ~]# yum install heartbeat Create the following file on node2 servers with the exact same content as on node1: [root@node2 ~]# vim /etc/ha.d/ha.cf keepalive 2 deadtime 30 bcast eth0 node node1.energoindia.com node2.energoindia.com logfile /var/log/ha-log debugfile /var/log/ha-debug The next setp is to create the resource file for heartbeat on node2 servers with exact same content as on node1 again: [root@node2 ~]# vim /etc/ha.d/haresources node1.energoindia.com IPaddr::192.168.10.150/24/eth0 IPaddr::192.168.20.150/24/eth0 IPaddr::192.168.1.150/22/eth0 IPaddr::192.168.30.150/24/eth0 drbddisk::main Filesystem::/dev/drbd0::/home::ext3 ldap httpd spamassassin clamd authdaemond imap imaps squid qmailctl The last thing is to create the authentication file on node2 servers again with the same content as on node1: [root@node2 ~]# vim /etc/ha.d/authkeys auth 3 3 md5 asd1234f This password file should only be readable by the root user: [root@node2 ~]# chmod 600 /etc/ha.d/authkeys [root@node2 ~]# service heartbeat start Again create same directory on node2 as in node1 and make links but before take backup of these directory: [root@node2 ~]# mkdir -p /home/command [root@node2 ~]# ln -s /home/command /command [root@node2 ~]# mkdir -p /home/downloads [root@node2 ~]# ln -s /home/downloads /downloads [root@node2 ~]# mkdir -p /home/packages [root@node2 ~]# ln -s /home/packages /packages [root@node2 ~]# mkdir -p /home/service [root@node2 ~]# ln -s /home/service /service [root@node2 ~]# mkdir -p /home/usr/local [root@node2 ~]# ln -s /home/usr/local /usr/local [root@node2 ~]# mkdir -p /home/var/qmail [root@node2 ~]# ln -s /home/var/qmail /var/qmail [root@node2 ~]# mkdir -p /home/usr/src [root@node2 ~]# ln -s /home/usr/src /usr/src [root@node2 ~]# mkdir -p /home/var/log/qmail [root@node2 ~]# ln -s /home/var/log/qmail /var/log/qmail [root@node2 ~]# touch /home/etc/tcp.smtp [root@node2 ~]# ln -s /home/etc/tcp.smtp /etc/tcp.smtp [root@node2 ~]# touch /home/etc/tcp.smtp.cdb [root@node2 ~]# ln -s /home/etc/tcp.smtp.cdb /etc/tcp.smtp.cdb [root@node2 ~]# mkdir -p /home/qmaildoc [root@node2 ~]# ln -s /home/qmaildoc /qmaildoc [root@node2 ~]# mkdir -p /home/etc/openldap [root@node2 ~]# ln -s /home/etc/openldap /etc/openldap [root@node2 ~]# mkdir -p /home/var/lib/ldap [root@node2 ~]# ln -s /home/var/lib/ldap /var/lib/ldap [root@node2 ~]# mkdir -p /home/var/www/html [root@node2 ~]# ln -s /home/var/www/html /var/www/html [root@node2 ~]# mkdir -p /home/var/www/sarg [root@node2 ~]# ln -s /home/var/www/sarg /var/www/sarg [root@node2 ~]# mkdir -p /home/var/spool/qscan [root@node2 ~]# ln -s /home/var/spool/qscan /var/spool/qscan [root@node2 ~]# mkdir -p /home/etc/mail/spamassassin/ [root@node2 ~]# touch /home/etc/mail/spamassassin/local.cf [root@node2 ~]# ln -s /home/etc/mail/spamassassin/local.cf /etc/mail/spamassassin/local.cf [root@node2 ~]# mkdir -p /home/etc/squid [root@node2 ~]# ln -s /home/etc/squid /etc/squid Make link of below file....... [root@node2 ~]# ln -s /usr/local/sbin/authdaemond /etc/init.d/authdaemond [root@node2 ~]# ln -s /var/qmail/bin/qmailctl /usr/bin/qmailctl [root@node2 ~]# ln -s /usr/bin/qmailctl /etc/init.d/qmailctl == '''### Test the cluster ###''' == 1. Stop heartbeat on node1: [root@node1 ~]# /etc/init.d/heartbeat stop 2. Watch log of heartbeat on node2, cluster will shift on node2. [root@node2 ~]# tailf /var/log/ha-log 3. On node2, check the mails are working and /home is mounted. [root@node2 ~]# telnet localhost 25 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 mail.energoindia.com ESMTP [root@node2 ~]# telnet localhost 110 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. +OK <14050.1436639325@mail.energoindia.com> [root@node2 ~]# telnet localhost 143 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information. [root@node2 ~]# telnet localhost 389 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. [root@node2 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 95G 74G 17G 83% / /dev/sda1 965M 24M 892M 3% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm /dev/drbd0 446G 359G 65G 85% /home 4. now, to shift cluster again on node1. stop heartbeat on node2 and start heartbeat on node1. [root@node2 ~]# /etc/init.d/heartbeat stop [root@node1 ~]# /etc/init.d/heartbeat start 5. Now test the cluster is shifting to node2, if node1 goes down. It will shift. 6. Now start node1, the cluster will shift automatically on node1 from node2.
Summary:
Please note that all contributions to TetraWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TetraWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)