Before you Begin
Ensure the following:
- You have an extra disk/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 disk/partition.
- Shared storage is available. 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 MySQL database storage repository.
Partition local storage for use with SIOS DataKeeper for Linux
Primary Server
On your Primary server, perform the following actions:
- Identify an existing free, unused disk partition to use as our Apache repository. Alternatively, create a new partition. Use the “gdisk” utility to partition your disk appropriately. In this example /dev/sdb is an unused disk where we will create a single partition
a. gdisk /dev/sdb
b. Press “n” to create a new partition
c. Press “p” to create a primary partition
d. This example uses a new disk, so we will use all default values (Partition 1, entire disk) Hit Enter twice to confirm these parameters
e. Press “w” to write the partition table and exit gdisks
Example
[root@LinuxPrimary ~]# gdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-256, default 1): <enter>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-256, default 256): <enter>
Using default value 256
Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
[root@LinuxPrimary ~]#
[root@LinuxPrimary ~]# df /var/www
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 253855 11083 229666 5% /var/www
[root@LinuxPrimary ~]# ls /var/www
cgi-bin error html icons lost+found manual usage
- Format the newly created disk partition
# mkfs.ext3 /dev/sdb1
- Mount the partition temporarily at /mnt
# mount /dev/sdb1 /mnt
- Move any existing data from /var/www/ into this new disk partition (assumes a default apache configuration)
# cd /var/www
# mv * /mnt
- Remount /dev/sdb1 at /var/www
# cd /root
# umount /mnt
# mount /dev/sdb1 /var/www
- Note: there is no need to add this partition to /etc/fstab. Lifekeeper will take care of mounting this automatically.
Result
[root@LinuxPrimary ~]# df /var/www
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 253855 11083 229666 5% /var/www
[root@LinuxPrimary ~]# ls /var/www
cgi-bin error html icons lost+found manual usage
Secondary Server
- On your Secondary server, only perform Step #1 above, where you partition the disk. The size of
the Target volume needs to be the same size, or greater, than our Source volume.
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.mysql
- Manually Login to the iSCSI Target
# iscsiadm -m node –T iqn.2006-01.com.openfiler:tsn.mysql –p 192.168.198.201 –login
- Configure Automatic Login
# iscsiadm -m node –T iqn.2006-01.com.openfiler:tsn.mysql –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/mysql (assuming a default mysql configuration). If data already exists in this directory, make sure to move it into the shared iSCSI LUN
# mount /dev/sdc1 /var/lib/mysql
- At this point you now have a local partition, /dev/sdb1 mounted at /var/www and an iSCSI shared LUN, /dev/sdc1, mounted at /var/lib/mysql. Our disk layout now look as follows (example):
Example
[root@LinuxPrimary mysql]# 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/sdb1 253855 11132 229617 5% /var/www
/dev/sdc1 966644 38944 878596 5% /var/lib/mysql
このトピックへフィードバック