トップ 一覧 Farm 検索 ヘルプ RSS ログイン

iSCSI+OCFS2で高速共有ディスクの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
{{category PCクラスタ}}
*iSCSI+OCFS2で高速共有ディスク
 Debian squeezeにおいて、mdadmで構築したRAIDボリュームをiSCSI+OCFS2で共有する設定。
*cluster.conf
 Ubuntu 16.04LTSにおいて、mdadmで構築したRAIDボリュームをiSCSI+OCFS2で共有する設定。
*/etc/ocfs2/cluster.conf
 node:
 ip_port = 7777
 ip_address = 127.0.0.1
 number = 0
 name = hostname
 cluster = ocfs2
         ip_port = 7777
         ip_address = 192.168.99.1
         number = 0
         name = blackthunder
         cluster = ocfs2
 
 node:
 ip_port = 7777
 ip_address = 192.168.99.5
 number = 1
 name = node1
 cluster = ocfs2
         ip_port = 7777
         ip_address = 192.168.99.5
         number = 1
         name = minion5
         cluster = ocfs2
 
 node:
 ip_port = 7777
 ip_address = 192.168.99.6
 number = 2
 name = node2
 cluster = ocfs2
         ip_port = 7777
         ip_address = 192.168.99.6
         number = 2
         name = minion6
         cluster = ocfs2
 
 node:
 ip_port = 7777
 ip_address = 192.168.99.7
 number = 3
 name = node3
 cluster = ocfs2
         ip_port = 7777
         ip_address = 192.168.99.7
         number = 3
         name = minion7
         cluster = ocfs2
 
 node:
 ip_port = 7777
 ip_address = 192.168.99.8
 number = 4
 name = node4
 cluster = ocfs2
         ip_port = 7777
         ip_address = 192.168.99.8
         number = 4
         name = minion8
         cluster = ocfs2
 
 node:
         ip_port = 7777
         ip_address = 192.168.99.9
         number = 5
         name = minion9
         cluster = ocfs2
 
 node:
         ip_port = 7777
         ip_address = 192.168.99.10
         number = 6
         name = minion10
         cluster = ocfs2
 
 node:
         ip_port = 7777
         ip_address = 192.168.99.11
         number = 7
         name = minion11
         cluster = ocfs2
 
 node:
         ip_port = 7777
         ip_address = 192.168.99.12
         number = 8
         name = minion12
         cluster = ocfs2
 
 cluster:
 node_count = 5
 name = ocfs2
         node_count = 9
         name = ocfs2
*/etc/iscsi/initiatorname.iscsi
 InitiatorName=iqn.YYYY-MM.hostname.mycluster.home:1
*/etc/iscsi/iscsid.conf(変更点のみ)
 node.startup = automatic
 node.session.auth.authmethod = None
 discovery.sendtargets.auth.authmethod = None
*/etc/hosts
 127.0.0.1       localhost
 外向きNICのIP   hostname.hogehoge.com       hostname
 192.168.99.1    hostname.mycluster.home     hostname
 192.168.99.5    minion5.mycluster.home         minion5
 192.168.99.6    minion6.mycluster.home         minion6
 192.168.99.7    minion7.mycluster.home         minion7
 192.168.99.8    minion8.mycluster.home         minion8
 192.168.99.9    minion9.mycluster.home         minion9
 192.168.99.10   minion10.mycluster.home         minion10
 192.168.99.11   minion11.mycluster.home         minion11
 192.168.99.12   minion12.mycluster.home         minion12
*/etc/fstab(変更点のみ)
 UUID=hogehoge /work ocfs2 _netdev 0 0
*/etc/default/o2cb(変更点のみ)
 O2CB_ENABLED=true
 O2CB_BOOTCLUSTER=ocfs2
*コマンド
 sudo apt-get install \
 libssl-dev iscsitarget-dkms \
 iscsitarget open-iscsi ocfs2-tools
 sudo nano -w /etc/default/iscsitarget
 #ISCSITARGET_ENABLEをtrueに
 sudo nano -w /etc/iet/ietd.conf
 #変更点は以下
 #IncomingUser username password
 #OutgoingUser username password
 #Target targetname:diskid
 #IncomingUser username password
 #OutgoingUser username password
 #Lun 0 Path=/dev/md0,Type=fileio
 sudo /etc/init.d/iscsitarget start
 sudo nano -w /etc/iscsi/iscsid.conf
 #変更点は以下
 #node.startup = automatic
 #node.session.auth.authmethod = CHAP
 #node.session.auth.username = username
 #node.session.auth.password = password
 #discovery.sendtargets.auth.authmethod = CHAP
 #discovery.sendtargets.auth.username = username
 #discovery.sendtargets.auth.password = password
 sudo /etc/init.d/open-iscsi start
 sudo iscsiadm -m discovery -t st -p localhost
 sudo iscsiadm -m node \
 --targetname targetname:diskid \
 --portal 127.0.0.1 --login
 sudo nano -w /etc/default/o2cb
 #変更点は以下
 #O2CB_ENABLED=true
 #O2CB_BOOTCLUSTER=ocfs2
 sudo cp \
 /usr/share/doc/ocfs2-tools/examples/cluster.conf \
 /etc/ocfs2/
 sudo nano -w /etc/ocfs2/cluster.conf
 sudo /etc/init.d/o2cb start
 sudo fdisk
 n
 p
 1
 (そのままEnter)
 (そのままEnter)
 w
 sudo apt-get install libssl-dev targetcli open-iscsi ocfs2-tools
 sudo targetcli /backstores/iblock create name=lun0 dev=/dev/md0
 sudo targetcli /iscsi create iqn.YYYY-MM.hostname.mycluster.home:ocfs2
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/luns create /backstores/iblock/lun0
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/portals create 0.0.0.0
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.hostname.mycluster.home:1
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion5.mycluster.home:5
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion6.mycluster.home:6
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion7.mycluster.home:7
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion8.mycluster.home:8
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion9.mycluster.home:9
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion10.mycluster.home:10
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion11.mycluster.home:11
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1/acls create iqn.YYYY-MM.minion12.mycluster.home:12
 sudo targetcli /iscsi/iqn.YYYY-MM.hostname.mycluster.home:ocfs2/tpg1 set attribute authentication=0
 sudo targetcli saveconfig
 sudo /lib/systemd/systemd-sysv-install enable target
 sudo systemctl enable target
 sudo systemctl start target
 sudo ne /etc/iscsi/initiatorname.iscsi
 sudo ne /etc/iscsi/iscsid.conf
 sudo systemctl restart iscsid open-iscsi
 sudo iscsiadm -m discovery -t st -p 127.0.0.1
 sudo iscsiadm -m node --targetname iqn.YYYY-MM.hostname.mycluster.home:ocfs2 --portal localhost --login
 sudo ne /etc/default/o2cb
 sudo cp /usr/share/doc/ocfs2-tools/examples/cluster.conf /etc/ocfs2/
 sudo ne /etc/ocfs2/cluster.conf
 sudo systemctl enable o2cb
 sudo systemctl start o2cb
 #iSCSIブロックデバイスが/dev/sdgで、そこにパーティションを作成
 parted --script /dev/sdg "mklabel msdos"
 parted --script /dev/sdg "mkpart primary 0% 100%"
 #OCFS2でフォーマット
 sudo mkfs.ocfs2 -L OCFS2 /dev/sdg1
 sudo mkdir -p /work
 sudo mount -L OCFS2 /work
 sudo nano -w /etc/fstab
 #変更点は以下
 #LABEL=OCFS2 /work ocfs2 _netdev 0 0
 sudo ne /etc/fstab