Slave storage

From ISPWiki

Jump to: navigation, search

Contents

Prerequisites

Disk partition for DRBD

Use the procedure for disk partition that is described in the article Master storage. Partitions on both master and slave storages must be of the same size.

Customizing internal network

If the second network interface is not present on the server, jump this step.

Open /etc/network/interfaces

 # nano /etc/network/interfaces

and add the lines

 auto ethX
 iface ethX inet static
     address 10.0.0.3
     netmask 255.0.0.0

where X is a network interface number.

Run the command below to apply the changes:

 # /etc/init.d/networking restart

Installing disk quotas

Install a user utility for disk quotas:

 # apt-get install quota

Installing and customizing libnss-extrausers

Install additional modules for the NSS service, that provides the system with user and group information form additional files: /var/lib/extrausers/passwd, /var/lib/extrausers/shadow and /var/lib/extrausers/groups.

 # apt-get install libnss-extrausers

Open /etc/nsswitch.conf

 # nano /etc/nsswitch.conf

change the passwd, group and shadow options

 ...
 passwd: compat extrausers
 group:  compat extrausers
 shadow: compat extrausers
 ...

Installing and customizing the NFS-server

Install the NFS-server with the command:

 # apt-get install nfs-kernel-server

Open /etc/default/nfs-common

 # nano /etc/default/nfs-common

and change the NEED_STATD and NEED_IDMAPD options

 ...
 NEED_STATD="yes"
 ...
 NEED_IDMAPD="yes"
 ...

Open /etc/idmapd.conf

 # nano /etc/idmapd.conf

and change the Domain option in the General section ad Method in the Translation section

 [General]
 Domain = cluster.lan
 ...
 [Translation]
 Method = nsswitch
 ...

Open /etc/exports

 # nano /etc/exports

and add the line

 /storage 10.0.0.0/8(rw,async,secure,no_root_squash,no_all_squash,no_subtree_check,fsid=root,no_acl)

Restart the NFS-server with the command below:

 # /etc/init.d/nfs-common restart

Installing and customizing DRBD

Install the modules and utilities for DRBD:

 # apt-get install drbd8-utils drbd8-modules-`uname -r`

Create the /root/.ssh directory and copy the authorized_keys file from the master storage:

 # mkdir /root/.ssh && scp root@10.0.0.2:/root/.ssh/authorized_keys /root/.ssh/

Copy the /etc/drbd.conf file from the master storage:

 # scp root@10.0.0.2:/etc/drbd.conf /etc/

Open /etc/drbd.conf

 # nano /etc/drbd.conf

and change "on localhost" into

 on H {
     address 10.0.0.3:7802;
     disk /dev/sdbX;
     flexible-meta-disk /dev/sdbY;
     device /dev/drbdZ;
 }

where H is a local host name, X is a storage device number, Y is a meta data device number, and Z is DRBD device number.

Copy the /etc/drbd.conf file from the master storage:

 # scp /etc/drbd.conf root@10.0.0.2:/etc/

Boot the DRBD module:

 # modprobe drbd

Purge the device for meta data storage:

 # dd if=/dev/zero of=/dev/sdbY bs=1M

where Y id the meta data storage device number.

Create the DRBD device:

 # drbdadm -- --force create-md storage

Connect the DRBD device:

 # drbdadm up storage

Installing and customizing Heartbeat

Install heartbeat with the command:

 # apt-get install heartbeat

Copy the /etc/ha.d/authkeys file from the master storage:

 # scp root@10.0.0.2:/etc/ha.d/authkeys /etc/ha.d/

Create and open the /etc/ha.d/ha.cf file

 # touch /etc/ha.d/ha.cf && nano /etc/ha.d/ha.cf

add the following lines

 logfile /var/log/ha-log
 keepalive 1
 warntime 2
 deadtime 10
 initdead 30
 bcast ethX
 ucast ethX 10.0.0.2
 ucast ethX 10.0.0.3
 auto_failback off
 autojoin none
 node RH LH
 stonith_host RH external/ssh 10.0.0.3
 stonith_host LH external/ssh 10.0.0.2

where X is the network interface number, RH is the main storage host name and LH is a local host name.

Copy the /etc/ha.d/ha.cf file on the master storage:

 # scp /etc/ha.d/ha.cf root@10.0.0.2:/etc/ha.d/

Restart heartbeat on the master storage:

 # ssh root@10.0.0.2 "/etc/init.d/heartbeat restart"

Create and open the /etc/ha.d/haresources file

 # touch /etc/ha.d/haresources && nano /etc/ha.d/haresources

and add the following line

 H IPaddr2::10.0.0.1/32/ethX drbddisk::storage Filesystem::/dev/drbdY::/storage::Z::usrquota,grpquota nfs-kernel-server

where H is a local host name, X is the network interface number, Y is the DRBD device number, and Z is the DRBD file system.

Restart heartbeat:

 # /etc/init.d/heartbeat restart
Was this helpful? Yes | No
Personal tools