Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

HA Cluster under GNU/Linux CentOS 6.5

Leer en espanol
HA Cluster under GNU/Linux CentOS 6.5

Table of contents

A high availability cluster is a set of two or more machines that are characterized by maintaining a series of shared services and being constantly monitored. ===

What is an HA Cluster?

A high availability cluster is a set of two or more machines which are characterized by maintaining a series of shared services and constantly monitoring each other. Can

more information

IP Addressing:

Cluster nodes: 

redorbitaclus01

text
enp0s3:  inet 192.168.1.60  netmask 255.255.255.0
enp0s8: inet 192.168.2.200  netmask 255.255.255.0

redorbitaclus02

text
enp0s3:  inet 192.168.1.61  netmask 255.255.255.0
enp0s8: inet 192.168.2.201  netmask 255.255.255.0

Cluster administration

redorbitaclusma

text
enp0s3:  inet 192.168.2.59  netmask 255.255.255.0

 

Hosts configuration

Bash
[root@redorbitaclus01 ~]# cat /etc/hosts

192.168.1.60 redorbitaclus01.CDP.redorbita.com redorbitaclus01

192.168.2.200 redorbitaclus01.CDP.redorbita.com redorbitaclus01

192.168.1.61 redorbitaclus02.CDP.redorbita.com redorbitaclus02

192.168.2.201 redorbitaclus02.CDP.redorbita.com redorbitaclus02

192.168.1.59 redorbitaclusma.CDP.redorbita.com redorbitaclusma

We copy the configuration from the hosts file to the redorbitaclus02 and redorbitaclusma node

Bash
[root@redorbitaclus01 ~]# scp /etc/hosts root@192.168.2.61:/etc/hosts
[root@redorbitaclus01 ~]# scp /etc/hosts root@192.168.1.59:/etc/hosts

We install in both nodes.

Bash
yum groupinstall «High Availability» «Resilient Storage» «iSCSI Storage Client» gfs2-utils

yum install ricci

We install in Cluster Management

Bash
yum groupinstall «High Availability Management»

yum install ricci

We disable iptables and selinux on all servers

Bash
service iptables stop

sed -i ‘s|SELINUX=enforcing|SELINUX=disabled|g’ /etc/selinux/config

chkconfig iptables off

We configure the shared disk (both nodes)

We establish node.startup  in automatic mode on both nodes

Bash
[root@redorbitaclus01 ~]# vi /etc/iscsi/iscsid.conf
[…]

node.startup = automatic

[…]

using the command iscsiadm we use iSCSI discovery (both nodes)

Bash
[root@redorbitaclus01 ~]# iscsiadm -m discovery -t st -p 192.168.2.20:3260

192.168.2.20:3260,3 iqn.2011-03.org.example.istgt:quorum
192.168.2.20:3260,3 iqn.2011-03.org.example.istgt:clustomcat

We log in (both nodes)

Bash
[root@redorbitaclus01 ~]# iscsiadm -m node –targetname «iqn.2011-03.org.example.istgt:quorum» –portal «192.168.2.20:3260» –login

[root@redorbitaclus01 ~]# iscsiadm -m node –targetname «iqn.2011-03.org.example.istgt:clustomcat» –portal «192.168.2.20:3260» –login

We check that we have a new device added (both nodes)

Bash
[root@redorbitaclus01 ~]# demesg
scsi3 : iSCSI Initiator over TCP/IP

scsi 3:0:0:0: Direct-Access FreeBSD iSCSI Disk 0123 PQ: 0 ANSI: 5

sd 3:0:0:0: Attached scsi generic sg2 type 0

sd 3:0:0:0: [sdb] 55924032 512-byte logical blocks: (28.6 GB/26.6 GiB)

sd 3:0:0:0: [sdb] Write Protect is off

sd 3:0:0:0: [sdb] Mode Sense: 83 00 00 08

sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA

sdb: sdb1

sd 3:0:0:0: [sdb] Attached SCSI disk
sd 3:0:0:0: [sdb] Attached SCSI disk

scsi4 : iSCSI Initiator over TCP/IP

scsi 4:0:0:0: Direct-Access FreeBSD iSCSI Disk 0123 PQ: 0 ANSI: 5

sd 4:0:0:0: Attached scsi generic sg3 type 0

sd 4:0:0:0: [sdc] 10485760 512-byte logical blocks: (5.36 GB/5.00 GiB)

sd 4:0:0:0: [sdc] Write Protect is off

sd 4:0:0:0: [sdc] Mode Sense: 83 00 00 08

sd 4:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA

sdc: unknown partition table

sd 4:0:0:0: [sdc] Attached SCSI disk

Configuramos el disco quorum.

Bash
[root@redorbitaclus01 ~]# mkqdisk -c /dev/sdb1 -l quorum

mkqdisk v3.0.12.1
Writing new quorum disk label ‘quorum’ to /dev/sdb1.

WARNING: About to destroy all data on /dev/sdb1; proceed [N/y] ? y

Initializing status block for node 1…

Initializing status block for node 2…

Initializing status block for node 3…

Initializing status block for node 4…

Initializing status block for node 5…

Initializing status block for node 6…

Initializing status block for node 7…

Initializing status block for node 8…

Initializing status block for node 9…

Initializing status block for node 10…

Initializing status block for node 11…

Initializing status block for node 12…

Initializing status block for node 13…

Initializing status block for node 14…

Initializing status block for node 15…

Initializing status block for node 16…

Damos formato al disco compartido.

Bash
[root@redorbitaclus01 ~]# mkfs.gfs2 -p lock_dlm -t cluster1:GFS -j 2 /dev/sdc

This will destroy any data on /dev/sdc.

It appears to contain: data
Are you sure you want to proceed? [y/n] y
Device: /dev/sdc

Blocksize: 4096

Device Size 5,00 GB (1310720 blocks)

Filesystem Size: 5,00 GB (1310718 blocks)

Journals: 2

Resource Groups: 20

Locking Protocol: «lock_dlm»

Lock Table: «cluster1:GFS»

UUID: 9616f032-9fcf-e8c5-efd6-a14fd66dc42d

We create the folder where we are going to mount the disk (both nodes)

[root@redorbitaclus01 ~]# mkdir /GFS

We configure the following services to automatically start:

text
chkconfig iptables off

chkconfig ip6tables off

chkconfig ricci on

chkconfig cman on

chkconfig rgmanager on

chkconfig modclusterd on

We assign a new password for the ricci user (Both nodes)

Bash
[root@redorbitaclus01 ~]# passwd ricci

Iniciamos ricci en both nodes

Bash
[root@redorbitaclus01 ~]# /etc/init.d/ricci start

We start luci in Cluster Management

Bash
[root@redorbitaclus01 ~]# /etc/init.d/luci start

We access Luci through our browser.

Captura de pantalla de 2015-08-05 17:02:14

Captura de pantalla de 2015-08-05 17:02:21

  mamager Clusters > Create

Captura de pantalla de 2015-08-05 17:02:41

We assign a name to the cluster, name and password of the nodes

Captura de pantalla de 2015-08-05 17:12:46

Captura de pantalla de 2015-08-05 17:14:12

Captura de pantalla de 2015-08-05 17:15:30

Under Configure > Qdisk

Captura de pantalla de 2015-08-05 17:16:47

Failover Domain > add

Captura de pantalla de 2015-08-05 17:17:10

Captura de pantalla de 2015-08-05 17:17:38

Resources > add > GFS2

Captura de pantalla de 2015-08-05 17:17:51

Captura de pantalla de 2015-08-05 17:19:17

Service Group > Add

Captura de pantalla de 2015-08-05 17:19:56

Add Recourse > Add GFS2

Captura de pantalla de 2015-08-05 17:21:39

Captura de pantalla de 2015-08-05 17:22:54

When mounting the disk it showed me the following error:

text
Mounting GFS2 filesystem (/GFS: fs is for a different cluster

error mounting lockproto lock_dlm

I managed to solve this error in the following way:

text
gfs2_tool sb /dev/sdc proto lock_nolock

You shouldn’t change any of these values if the filesystem is mounted.
Are you sure? [y/n] y
current lock protocol name = «lock_dlm»

new lock protocol name = «lock_nolock»

Done

We check the resources:

Bash
[root@redorbitaclus02 www]# clustat

Cluster Status for redorbita @ Thu Aug 6 17:38:45 2015

Member Status: Quorate
Member Name ID Status

—— —- —- ——

redorbitaclus01 1 Online, Local, rgmanager

redorbitaclus02 2 Online, rgmanager

/dev/block/8:49 0 Online, Quorum Disk
Service Name Owner (Last) State

——- —- —– —— —–

service:GFS redorbitaclus02 started
root@redorbitaclus02 log]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg_redorbitaclus01-lv_root 14G 2,0G 12G 16% /

tmpfs 499M 26M 474M 6% /dev/shm

/dev/sda1 485M 34M 426M 8% /boot

/dev/sdc 5,0G 259M 4,8G 6% /GFS

Regards, rokitoh

:wq!

Comments