NAGIOS CLUSTER DOC

                              NAGIOS CLUSTER DOC
===================================================


I have using RHEL6.4 64 Bit Machines
IP 192.168.0.100  Name Node1.example.com
IP 192.168.0.101  Name Node2.example.com
IP 192.168.0.200 (Virtual IP)


#yum install corosync pacemaker pcs resource-agents (Local repo)
# wget -c http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/x86_64/crmsh-2.1-1.6.x86_64.rpm
# wget -c http://pkgs.repoforge.org/pssh/pssh-2.0-1.el6.rf.noarch.rpm
# rpm -ivh pssh-2.0-1.el6.rf.noarch.rpm
# rpm -ivh crmsh-2.1-1.6.x86_64.rpm
# yum  install crmsh-2.1-1.6.x86_64.rpm


2. Configure host file both Node ( Node1 & Node2 )
# vim /etc/hosts ( NODE1 Machine)
192.168.0.100  Node1.example.com  Node1
192.168.0.101  Node2.example.com  Node2

# vim /etc/hosts  ( NODE2 Machine )
192.168.0.100  Node1.example.com  Node1
192.168.0.101  Node2.example.com  Node2


3. Configure httpd for testing  both Node ( Node1 & Node2 )
# vim /etc/httpd/conf/httpd.conf ( NODE1 Machine )
Listen 192.168.4.100:8080
ServerName example.com

# cat /etc/httpd/conf.d/serverstatus.conf
 Listen 127.0.0.1:80
 <Location /server-status>
 SetHandler server-status
 Order deny,allow
 Deny from all
 Allow from 127.0.0.1
 </Location>


# cd /var/www/html/
# vim index.html
haproxy NODE1

# vim /etc/httpd/conf/httpd.conf ( NODE2 Machine )
Listen 192.168.4.101:8080
ServerName example.com

cat /etc/httpd/conf.d/serverstatus.conf
 Listen 127.0.0.1:80
 <Location /server-status>
 SetHandler server-status
 Order deny,allow
 Deny from all
 Allow from 127.0.0.1
 </Location>


# cd /var/www/html/
# vim index.html
haproxy NODE2


# cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf
# corosync-keygen
Corosync Cluster Engine Authentication key generator.
Gathering 1024 bits for key from /dev/random.
Press keys on your keyboard to generate entropy.
Press keys on your keyboard to generate entropy (bits = 128).
Press keys on your keyboard to generate entropy (bits = 192).
Press keys on your keyboard to generate entropy (bits = 256).
Press keys on your keyboard to generate entropy (bits = 320).
Press keys on your keyboard to generate entropy (bits = 384).
Press keys on your keyboard to generate entropy (bits = 456).
Press keys on your keyboard to generate entropy (bits = 520).
Press keys on your keyboard to generate entropy (bits = 584).
Press keys on your keyboard to generate entropy (bits = 648).
Press keys on your keyboard to generate entropy (bits = 712).
Press keys on your keyboard to generate entropy (bits = 776).
Press keys on your keyboard to generate entropy (bits = 840).
Press keys on your keyboard to generate entropy (bits = 904).
Press keys on your keyboard to generate entropy (bits = 968).
Writing corosync key to /etc/corosync/authkey.

# scp /etc/corosync/authkey root@192.168.4.131:/etc/corosync
# vim /etc/corosync/corosync.conf
compatibility: whitetank

totem {
        version: 2

        secauth: on

        threads: 0

        interface {
                ringnumber: 0
                bindnetaddr: 192.168.0.100 (Node1 IP)
                mcastaddr: 239.255.1.1
                mcastport: 5405
                ttl: 1
        }
}

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
        }
}

# vi /etc/corosync/service.d/pcmk
service {
# Load the Pacemaker Cluster Resource Manager
name: pacemaker
ver: 1
}

# scp /etc/corosync/corosync.conf  root@192.168.0.101:/etc/corosync/  (change IP in node2 )
# scp /etc/corosync/service.d/pcmk  root@192.168.0.101:/etc/corosync/service.d/
# service corosync start  (Both Node)
# service pacemaker start (Both Node)
# crm status
Last updated: Mon Jun 15 07:19:50 2015
Last change: Mon Jun 15 07:19:20 2015
Stack: classic openais (with plugin)
Current DC: node1.aap1 - partition WITHOUT quorum
Version: 1.1.11-97629de
2 Nodes configured, 2 expected votes
2 Resources configured


Online: [ Node1.example.com ]
OFFLINE: [ Node2.example.com ]

# pcs property set stonith-enabled=false
# pcs property set no-quorum-policy=ignore
# pcs property
# pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.0.200 cidr_netmask=24 op monitor interval=30s
# pcs status resources
# ping -c3 192.168.0.200
# pcs status|grep virtual_ip
# pcs resource create webserver ocf:heartbeat:apache configfile=/etc/httpd/conf/httpd.conf statusurl="http://102.168.0.200/server-status" op monitor interval=1min
# pcs constraint colocation add webserver virtual_ip INFINITY
# pcs constraint order virtual_ip then webserver
# pcs constraint location webserver prefers Node1.example.com=50
# pcs constraint
# pcs cluster stop --all && sudo pcs cluster start --all
# pcs resource create nagios_test ocf:heartbeat:anything params user="nagios" binfile="/usr/local/nagios/bin/nagios" cmdline_options="-d /usr/local/nagios/etc/nagios.cfg" pidfile="/usr/local/nagios/etc/nagios.pid"
# pcs constraint colocation add nagios_test virtual_ip INFINITY
# pcs constraint order virtual_ip then nagios_test
# pcs constraint location nagios_test prefers Node1.example.com=50
# pcs constraint
# pcs cluster stop --all && sudo pcs cluster start --all
# crm status
Last updated: Mon Jun 15 07:19:50 2015
Last change: Mon Jun 15 07:19:20 2015
Stack: classic openais (with plugin)
Current DC: node1.aap1 - partition WITHOUT quorum
Version: 1.1.11-97629de
2 Nodes configured, 2 expected votes
2 Resources configured


Online: [ Node1.example.com ]
OFFLINE: [ Node2.example.com ]

 virtual_ip     (ocf::heartbeat:IPaddr2):       Started Node1.example.com
 webserver      (ocf::heartbeat:apache):        Started Node1.example.com
 nagios_test    (ocf::heartbeat:anything):      Started Node1.example.com


# chkconfig corosync on
# chkconfig pacemaker on

test if cluster Node1 running fine so Stop pacemaker Server and check Node2 auto ip,http and nagios running in Node2 if both not clister running fine then restart both node
# init 6 ( Both Node)

Comments

Popular posts from this blog

How to install and configure node js and PM2 in rhel7

PCS Corosync Pacemaker Cluster Mariadb using NFS

How to Create or Configure iSCSI Server and Clinet