This guide is 3rd part of Apache High Availability Cluster Configuration series; you can browse other articles using below links:
- Part 1: Basic Concepts of High Availability Cluster
- Part 2: Apache High Availability LAB Initial Setup & Configuration
- Part 3: iSCSI Storage Server & Initiator Configuration
- Part 4: Configure Apache & Cluster Resources for High Availability
- iSCSI protocol is used to provide Storage Area Network (SAN) over Ethernet connection.
Part 3: iSCSI Storage Server & Initiator Configuration
Storage Server Configuration (iSCSI Target):
A shared storage solution is an important component of high availability cluster. All cluster members must have access to centralized shared storage, it contains running application data so it can ensure all members of cluster are accessing same data. To provide shared storage solution for cluster we will configure iSCSI shared storage (Storage Area Network) on our storage server. Remember storage server is already up in our network. (storage.broexperts.com : 10.0.0.90)
Step 1: Install Required Packages
Install iSCSI shared storage rpm using following command.
yum install targetcli -y
Step 2: Prepare LVMs
I have one separate disk (/dev/sdb) size of 20GB attached with storage server. I will create two LVMs, one for Fencing and second for Apache Server data directory. Using following command and see command output in screen shot below:
fdisk -luc | grep sd
Partitioning
[root@storage ~]# fdisk /dev/sdb
Create physical volume
[root@storage ~]# pvcreate /dev/sdb1 Physical volume "/dev/sdb1" successfully created
Creating volume group named cluster_vg
[root@storage ~]# vgcreate cluster_vg /dev/sdb1 Volume group "cluster_vg" successfully created
Create logical volume for fencing device named fence_lvsize 1GB
[root@storage ~]# lvcreate -L 1G -n fence_lv cluster_vg Logical volume "fence_lv" created.
Finally create logical volume named data_lv for apache server data directory and assign all free space left on (/dev/sdb)
[root@storage ~]# lvcreate -l 100%FREE -n data_lv cluster_vg Logical volume "data_lv" created. [root@storage ~]#
Step 3: Create iSCSI targets
Before we jump into iSCSI configuration, let’s be comfortable with few terms that i will be using for configuring iSCSI target.
- iqn stands for iSCSI Qualified Name, it has mandatory naming format as follows:
Naming Format: iqn.yyyy.mm.com.domain:optional-string - target: Actually a storage resource made available by iSCSI server to iSCSI clients
- LUN: Logical Unit Number, A LUN represents an individually addressable (logical) SCSI device that is part of a physical SCSI device (target).
As earlier in step 1 we installed targetcli package to configure iSCSI target, now let’s use targetcli command to create storage that will be used shared storage for both nodes in cluster.
targetcli
Above command will open command line interface to manage iSCSI targets. Copy and paste below lines in targetcli shell.
cd /backstores/block create ap_dir /dev/mapper/cluster_vg-data_lv create fence_dev /dev/mapper/cluster_vg-fence_lv cd /iscsi create iqn.2016-10.com.broexperts:storage cd iqn.2016-10.com.broexperts:storage/tpg1/acls create iqn.2016-10.com.broexperts:node1 create iqn.2016-10.com.broexperts:node2 create iqn.2016-10.com.broexperts:node3 cd /iscsi/iqn.2016-10.com.broexperts:storage/tpg1/ set attribute authentication=0 cd /iscsi/iqn.2016-10.com.broexperts:storage/tpg1/luns create /backstores/block/ap_dir create /backstores/block/fence_dev cd / saveconfig exit
Step 4: Start and enable the target service on startup.
systemctl start target systemctl enable target
Step 5: Configure the firewall to allow iSCSI traffic.
firewall-cmd --permanent --add-port=3260/tcp firewall-cmd --reload
Configure Initiators
After we set all for storage server now it’s time to prepare all nodes for connecting iSCSI targets over the network.
Step 1: Install Required Package
yum install iscsi-initiator-utils -y
Step 2: Discover Exported Targets by Server
iscsiadm -m discovery -t st -p 10.0.0.90
Step 3: Edit initiator name file and update initiatorname on both nodes accordingly.
Node1:
vi /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2016-10.com.broexperts:node1
Node2:
vi /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2016-10.com.broexperts:node2
Node3:
vi /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2016-10.com.broexperts:node3
Step 4: Restart and enable on startup iscsid daemon on all nodes
systemctl restart iscsid systemctl enable iscsid
Step 5: Add iscsi targets on both nodes
To add iscsi targets on all three nodes enter below command
iscsiadm -m node -T iqn.2016-10.com.broexperts:storage -p 10.0.0.90 -l