Before you Begin
Ensure the following:
- If planning to use replicated storage, have an extra volume/partition on both servers that can be used for data replication. A target volume’s size must equal to or larger than the size of its source volume.
- If planning to use shared storage, as in this example, ensure the Shared storage is configured and accessible to your cluster nodes. This can either be Fiber Channel SAN, iSCSI, NAS, etc. In this example we will review configuration of an iSCSI target for use as our PostgreSQL database storage repository.
Configure iSCSI initiator, discover and login to iSCSI target
This Evaluation guide will not cover how to setup an iSCSI Target Server. It is assumed that the shared storage already exists in your environment. If you don’t have shared storage and wish to configure it, a simple solution is to use OpenFiler (http://www.openfiler.com/), an Open Source storage management appliance, which can be run on physical hardware or as a virtual machine.
On both Primary and Secondary servers, perform the following functions:
- If not already installed, ensure that the iscsi-initiator-utils rpm package is installed:
# yum install iscsi-initiator-utils
- Start the iscsid service and enable it to automatically start when the system boots
# service iscsid start
# chkconfig iscsid on
- Configure the iscsi service to automatically start, which logs into iSCSI targets needed at system start up.
# chkconfig iscsi on
- Use the iscsiadm command to discover all available targets on the network storage server (OpenFiler)
# iscsiadm -m discovery -t sendtargets -p <name or IP of iSCSI server>
Example
[root@LinuxPrimary init.d]# iscsiadm -m discovery -t sendtargets -p 192.168.198.201
iqn.2006-01.com.openfiler:tsn.postgres
- Manually Login to the iSCSI Target
# iscsiadm -m node –T iqn.2006-01.com.openfiler:tsn.postgres –p 192.168.198.201 – login
- Configure Automatic Login
# iscsiadm -m node –T iqn.2006-01.com.openfiler:tsn.postgres –p 192.168.198.201 —op update -n node.startup -v automatic
- Use the “gdisk” command to format your iSCSI LUN, if needed
# gdisk /dev/sdc
- Create a filesystem on your new iSCSI LUN Partition, sdc1
# mkfs.ext3 /dev/sdc1
- Mount your iSCSI LUN at /var/lib/pgsql (assuming a default postgres configuration). If data already exists in this directory, make sure to move it into the shared iSCSI LUN
# mount mount /dev/sdc1 /var/lib/pgsql
- At this point you now have an iSCSI shared LUN, /dev/sdc1, mounted at /var/lib/pgsql. Our disk layout now look as follows (example):
Example
[root@LinuxPrimary pgsql]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 25967432 3683016 1976400 66% /
/dev/sda1 101086 24659 71208 26% /boot
tmpfs 517552 0 517552 0% /dev/shm
/dev/sdc1 966644 38944 878596 5% /var/lib/pgsql
Post your comment on this topic.