2013-01-26

ZFS + HAST + Jail

ZFSボリュームの上にHASTを作り、その上のJailにkamui, gambaを引っ越そう計画。

旧gambaは電源が入らなくなり、更新のため新規購入した二台のうち一台は新gambaになっていて、空きは一台のみ。片肺のHAST上でzpool createができるかどうかがキモだった。

$ uname -n
jailer1.noroi.jp
$ zfs list tank
NAME                       USED  AVAIL  REFER  MOUNTPOINT
tank                      7.66G   102G   436M  /
$ sudo zfs create -V 80G tank/hast1
Password:
$ zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
tank                      90.2G  19.1G   436M  /
$ ls -l /dev/zvol/tank
total 0
crw-r-----  1 root  operator    0, 138 Jan 27 07:35 hast1
crw-r-----  1 root  operator    0, 134 Jan 26 05:42 swap
$ sudo vi /etc/hast.conf 
$ cat /etc/hast.conf 
resource disk1 {
        on jailer1 {
                local /dev/zvol/tank/hast1
                remote jailer2
        }
        on jailer2 {
                local /dev/zvol/tank/hast1
                remote jailer1
        }
}
$ 

jailer2はまだ無いんだが、さて。

$ sed -n '/hastd_enable/s/NO/YES/p' /etc/defaults/rc.conf | sudo sh 'cat - >> /etc/rc.conf'
$ sudo /etc/rc.d/hastd start
Starting hastd.
$ sudo hastctl role init disk1
$ sudo hastctl create disk1
$ sudo hastctl role primary disk1
$ sudo hastctl status
disk1:
  role: primary
  provname: disk1
  localpath: /dev/zvol/tank/hast1
  extentsize: 2097152 (2.0MB)
  keepdirty: 64
  remoteaddr: jailer2
  replication: fullsync
  status: degraded
  dirty: 0 (0B)
  statistics:
    reads: 0
    writes: 0
    deletes: 0
    flushes: 0
    activemap updates: 0
$ 

statusがdegraded。正しくはここがcompletedになってなきゃいけないんじゃが…

$ sudo zpool create zhast hast/disk1
$ zpool status zhast
  pool: zhast
 state: ONLINE
  scan: none requested
config:

       NAME          STATE     READ WRITE CKSUM
       zhast         ONLINE       0     0     0
         hast/disk1  ONLINE       0     0     0

errors: No known data errors
$ zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
tank    111G  3.53G   107G     3%  1.00x  ONLINE  -
zhast  79.5G  89.5K  79.5G     0%  1.00x  ONLINE  -
$ 

おー、できたできた。hastdが10秒おきにエラーを吐くが、jail上でgambaが動き出し、現gambaがjailer2になるまで放置するしかない。

$ tail -4 /var/log/messages
Jan 27 08:08:31 jailer1 hastd[7983]: [disk1] (primary) Unable to connect to jailer2: Host is down.
Jan 27 08:08:31 jailer1 hastd[8000]: [disk1] (primary) Unable to connect to jailer2: Host is down.
Jan 27 08:08:41 jailer1 hastd[7983]: [disk1] (primary) Unable to connect to jailer2: Host is down.
Jan 27 08:08:41 jailer1 hastd[8000]: [disk1] (primary) Unable to connect to jailer2: Host is down.
$ pgrep -lf hastd
8000 hastd: disk1 (primary)
7983 /sbin/hastd
$ 

できたzhastの上でjailを動かすわけだが、今日はもう眠いのでここで中断。

0 件のコメント:

コメントを投稿