가상서버에 러스터(lustre) 파일시스템 설치 - bigchameleon/ambari-lustre GitHub Wiki

가상서버에 러스터(lustre) 파일시스템 설치

2018년 2월 5일

[email protected]

본 문서에서는 호스트 OS 로 Fedora1 리눅스 + Virtual Box 5.1 환경에서 CentOS 7 VM 을 이용하여 Lustre 파일시스템을 구성하여 본다.

MDS노드 1노드, OSS 노드 1노드, 클라이언트 노드 1노드로 구성된 가장 단순한 구성을 하여 본다. MDS와 OSS는 lustre 파일시스템을 위해 빌드된 커널을 사용해야 한다.

먼저 가상머신으로 사용할 CentOS 7 VM을 준비한다. Vagrant 를 이용하여 VM 하나를 만들어준다.

1. 가상 머신에 디스크 추가하기

Vagrant base box 인 "centos7"을 이용하여 lustre-server-node-base 를 만들어 준다.

# vagrant box list
centos7             (virtualbox, 0)

# mkdir luster_server_base ; cd luster_server_base
# vi Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.define "lustre-server-node-base" do |node|
    node.vm.box = "centos7"
    node.vm.synced_folder ".", "/vagrant", disabled: true
    node.vm.network "private_network", ip: "192.168.56.100"
    node.vm.hostname = 'lustre-server-node-base'

    node.vm.provider "virtualbox" do |v|
      v.customize ["modifyvm", :id, "--memory", "4096"]
      v.customize ["modifyvm", :id, "--usb", "on"]
      v.customize ["modifyvm", :id, "--usbehci", "off"]
      v.customize ["modifyvm", :id, "--description", "some description"]
      v.customize ["modifyvm", :id, "--name", "lustre-server-node-base"]
    end
  end
end

아이피 주소는 192.168.56.100 으로 주었고, 호스트 명은 VM 이름과 동일하게 lustre-server-node-base 로 하였다. 가상 머신을 시작하면 정상적으로 부팅되어야 한다.

# vagrant up
...wait...
...

# vagrant status
Current machine states:
lustre-server-node-base   running (virtualbox)

# vboxmanage  list runningvms
"lustre-server-node-base" {f23cb7ea-bca3-4f9c-8da1-2dff949c69ac}

가상머신 상태 정보를 조회해 보면 다음과 같이 SATA 디스크가 1개인 것을 알수 있다.

# vboxmanage showvminfo  lustre-server-node-base
....
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      1
Storage Controller Bootable (1):        on
IDE (1, 0): Empty
SATA (0, 0): /root/VM/centos7-base_1517792566214_57208/box-disk002.vmdk (UUID: d1e5146f-413a-49c1-b0ce-dc91bfa25f5c)
....

로그인해서 커널 버전을 확인해 본다.

# ssh -l root 192.168.56.100
[root@lustre-server-node-base ~]# uname -a
Linux lustre-server-node-base 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@lustre-server-node-base ~]# exit

lustre 파일 시스템에서 MDS 와 OSS 파티션으로 별도의 하드디스크를 사용하기 위하여 방금 생성한 VM에 디스크를 추가하도록한다. VM 이 실행중인 상태에서는 디스크 추가가 불가하므로 먼저 실행한 VM을 중지 시킨다.

# vagrant halt
...wait...
==> lustre-server-node-base: Attempting graceful shutdown of VM...

추가할 디스크를 위한 가상 디스크 이미지(VDI) 파일을 만들어 준다. size 단위는 MB이며, 20GB 디스크 생성을 위해 다음 명령을 실행한다.

# vboxmanage createmedium  disk --filename disk.vdi --size 20000 --format VDI
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 2578209d-c432-4962-a413-56fcb845c83c

현재 디렉터리에 vdi 파일이 만들어진다.

# file disk.vdi 
disk.vdi: VirtualBox Disk Image, major 1, minor 1 (<<< Oracle VM VirtualBox Disk Image >>>), 20971520000 bytes

만들어진 VDI 이미지 정보를 확인

# export vdi_uuid=2578209d-c432-4962-a413-56fcb845c83c
# vboxmanage  showmediuminfo disk  $vdi_uuid
UUID:           2578209d-c432-4962-a413-56fcb845c83c
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /home/root/vagrant_boxes/luster_server_base/disk.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       20000 MBytes
Size on disk:   2 MBytes
Encryption:     disabled

만들어진 VDI 이미지를 위에서 만든 VM에 붙이기 위해서는 storageattach 명령을 이용한다. 그 전에 closemedium 을 실행하여 VirtualBox 의 Media manager에 등록 정보를 삭제하고, 파일만 남겨둔 상태여야 한다.

# vboxmanage closemedium  disk $vdi_uuid  
# vboxmanage  storageattach   lustre-server-node-base --storagectl SATA --port 1 --device 0 --type hdd --medium ./disk.vdi

만일 closemedium을 해주지 않으면 다음과 같은 에러가 발생된다.

VBoxManage: error: Cannot register the hard disk '/home/root/vagrant_boxes/luster_vm/./disk.vdi' {3509996e-e902-47fc-8ebe-15ae0611d5ba} because a hard disk '/home/root/vagrant_boxes/luster_vm/disk.vdi' with UUID {3509996e-e902-47fc-8ebe-15ae0611d5ba} already exists

디스크가 추가 되었는지 확인하기위해 showvminfo 명령을 실행한다. SATA 디스크가 추가된 것을 확인할 수 있다.

# vboxmanage showvminfo  lustre-server-node-base
....
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      2
Storage Controller Bootable (1):        on
IDE (1, 0): Empty
SATA (0, 0): /root/VM/centos7-base_1517792566214_57208/box-disk002.vmdk (UUID: d1e5146f-413a-49c1-b0ce-dc91bfa25f5c)
SATA (1, 0): /home/root/vagrant_boxes/luster_server_base/./disk.vdi (UUID: 2578209d-c432-4962-a413-56fcb845c83c)
....

이제 VM을 다시 실행하여 디스크가 인식이 되는지 확인한다.

# vagrant status
Current machine states:
lustre-server-node-base   poweroff (virtualbox)

# vagrant up
...wait...
==> lustre-server-node-base: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> lustre-server-node-base: flag to force provisioning. Provisioners marked to run always will still run.

# vagrant ssh
[vagrant@lustre-server-node-base ~]$ sudo fdisk -l /dev/sdb

Disk /dev/sdb: 21.0 GB, 20971520000 bytes, 40960000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

fdisk 로 두번째 하드디스크인 /dev/sdb 가 인식된것을 확인되었다.

이 VM을 다시 vagrant box로 패키징 하기 위해서는 셧다운 시키기 전에 vagrant 계정에 insecure keypair 를 다시 설치를 해 준다.

insecure keypair 에 대한 정보는 여기 에서 얻을 수 있다.

[vagrant@lustre-server-node-base ~]$
 wget https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub
 cat  vagrant.pub  >> /home/vagrant/.ssh/authorized_keys
 rm -f vagrant.pub

베이그런트 프로비저닝 과정에서 생성된 vboxadd 계정은 삭제시킨다.

$ id vboxadd
uid=988(vboxadd) gid=1(bin) groups=1(bin)
$ sudo userdel vboxadd
userdel: group vboxadd not removed because it is not the primary group of user vboxadd.
$ id vboxadd
id: vboxadd: no such user

셧다운 시킨다.

$ sudo poweroff

패키징 하기 전에 vagrant의해서 추가된 두번째 NIC은 disable 시켜준다.

# vboxmanage modifyvm lustre-server-node-base --nic2 none

여기까지 작업한 후 box 파일로 export 시킨다. 아래에서 알수 있는것 처럼 box 파일안에 추가된 추가된 디스크까지 포함되어 있는 것을 알 수 있다.

# vagrant package --base lustre-server-node-base  --output lustre-server-node-base.box
==> lustre-server-node-base: Clearing any previously set forwarded ports...
==> lustre-server-node-base: Exporting VM...
==> lustre-server-node-base: Compressing package to: /home/root/vagrant_boxes/luster_server_base/lustre-server-node-base.box
...wait...

# file lustre-server-node-base.box
lustre-server-node-base.box: gzip compressed data, last modified: Mon Feb  5 01:18:46 2018, from Unix

# tar tf  lustre-server-node-base.box 
./Vagrantfile
./box.ovf
./box-disk1.vmdk
./box-disk2.vmdk

생성된 box를 등록시켜 둔다. (이미 등록된 것이 있으면 먼저 삭제함)

# vagrant box  remove centos7-add-disk  
# vagrant box  add  --name  centos7-add-disk  lustre-server-node-base.box
# vagrant box  list
centos7             (virtualbox, 0)
centos7-add-disk    (virtualbox, 0)

만들어진 box 파일과 vdi 파일은 삭제해도 무방하다.

# rm -f  lustre-server-node-base.box  disk.vdi

2. 러스터 서버 설치 준비 하기

새로운 디렉터리에 Vagrantfile 을 아래와 같이 만들고 VM을 실행해 준다. MDS와 OSS용으로 VM이 1개씩 생성된다.

# mkdir luster_server ; cd luster_server
# vi Vagrantfile

Vagrant.configure("2") do |config|

  config.vm.define "lustre-server-mds1" do |node|
    node.vm.box = "centos7-add-disk"
    node.vm.synced_folder ".", "/vagrant", disabled: true
    node.vm.network "private_network", ip: "192.168.56.111"
    node.vm.hostname = 'lustre-server-mds1'
    node.vm.provider "virtualbox" do |v|
      v.customize ["modifyvm", :id, "--memory", "4096"]
      v.customize ["modifyvm", :id, "--usb", "on"]
      v.customize ["modifyvm", :id, "--usbehci", "off"]
      v.customize ["modifyvm", :id, "--name", "lustre-server-mds1"]
    end
  end

  config.vm.define "lustre-server-oss1" do |node|
    node.vm.box = "centos7-add-disk"
    node.vm.synced_folder ".", "/vagrant", disabled: true
    node.vm.network "private_network", ip: "192.168.56.112"
    node.vm.hostname = 'lustre-server-oss1'
    node.vm.provider "virtualbox" do |v|
      v.customize ["modifyvm", :id, "--memory", "4096"]
      v.customize ["modifyvm", :id, "--usb", "on"]
      v.customize ["modifyvm", :id, "--usbehci", "off"]
      v.customize ["modifyvm", :id, "--name", "lustre-server-oss1"]
    end
  end

end

IP주소는 192.168.56.111 과 192.168.56.112 로 해 주었다. VM을 실행한다.

# vagrant up
...wait...
==> lustre-server-mds1: Importing base box 'centos7-add-disk'...
...
==> lustre-server-mds1: Setting hostname...
==> lustre-server-mds1: Configuring and enabling network interfaces...
    lustre-server-mds1: SSH address: 127.0.0.1:2200
    lustre-server-mds1: SSH username: vagrant
    lustre-server-mds1: SSH auth method: private key
...
==> lustre-server-oss1: Importing base box 'centos7-add-disk'...
...
==> lustre-server-oss1: Setting hostname...
==> lustre-server-oss1: Configuring and enabling network interfaces...
    lustre-server-oss1: SSH address: 127.0.0.1:2201
    lustre-server-oss1: SSH username: vagrant
    lustre-server-oss1: SSH auth method: private key

실행된 VM으로 각각 로그인이 되는지 확인해보자.

# vagrant ssh lustre-server-mds1
# vagrant ssh lustre-server-oss1
또는 
ssh -l root 192.168.56.111 
ssh -l root 192.168.56.112 

3. 러스터 설치 파일 다운 받기

러스터 설치 파일은 다음 주소에서 다운 받는다.

lustre 최신 버전인 2.10.1 >> el7 >> server 또는 client >> RPMS >> x86_64 으로 차례대로 들어간다. 다운로드 경로 (서버,클라이언트)

e2fsprog 는 리눅스에서 파일시스템을 관리하기위한 툴로 최신 버전을 다운 받아 준다. 1.42.13.wc6 >> sl7 >> RPMS >> x86_64 로 차례대로 들어간다.

받은 파일들을 lustre-2.10.1 폴더에 넣어준다.

# ls lustre-2.10.1
e2fsprogs-1.42.13.wc6-7.el7.x86_64.rpm                  libzfs2-0.7.1-1.el7.x86_64.rpm
e2fsprogs-devel-1.42.13.wc6-7.el7.x86_64.rpm            libzfs2-devel-0.7.1-1.el7.x86_64.rpm
e2fsprogs-libs-1.42.13.wc6-7.el7.x86_64.rpm             libzpool2-0.7.1-1.el7.x86_64.rpm
e2fsprogs-static-1.42.13.wc6-7.el7.x86_64.rpm           lustre-2.10.1-1.el7.x86_64.rpm
kernel-3.10.0-693.2.2.el7_lustre.x86_64.rpm             lustre-client-2.10.1-1.el7.x86_64.rpm
kernel-debuginfo-3.10.0-693.2.2.el7_lustre.x86_64.rpm   lustre-dkms-2.10.1-1.el7.noarch.rpm
kernel-devel-3.10.0-693.2.2.el7_lustre.x86_64.rpm       lustre-iokit-2.10.1-1.el7.x86_64.rpm
kernel-tools-3.10.0-693.2.2.el7_lustre.x86_64.rpm       lustre-osd-ldiskfs-mount-2.10.1-1.el7.x86_64.rpm
kernel-tools-libs-3.10.0-693.2.2.el7_lustre.x86_64.rpm  lustre-osd-zfs-mount-2.10.1-1.el7.x86_64.rpm
kmod-lustre-2.10.1-1.el7.x86_64.rpm                     lustre-resource-agents-2.10.1-1.el7.x86_64.rpm
kmod-lustre-client-2.10.1-1.el7.x86_64.rpm              perf-3.10.0-693.2.2.el7_lustre.x86_64.rpm
kmod-lustre-osd-ldiskfs-2.10.1-1.el7.x86_64.rpm         python-perf-3.10.0-693.2.2.el7_lustre.x86_64.rpm
kmod-lustre-osd-zfs-2.10.1-1.el7.x86_64.rpm             spl-0.7.1-1.el7.x86_64.rpm
kmod-lustre-tests-2.10.1-1.el7.x86_64.rpm               spl-dkms-0.7.1-1.el7.noarch.rpm
libcom_err-1.42.13.wc6-7.el7.x86_64.rpm                 zfs-0.7.1-1.el7.x86_64.rpm
libnvpair1-0.7.1-1.el7.x86_64.rpm                       zfs-dkms-0.7.1-1.el7.noarch.rpm
libss-1.42.13.wc6-7.el7.x86_64.rpm                      zfs-test-0.7.1-1.el7.x86_64.rpm
libuutil1-0.7.1-1.el7.x86_64.rpm

다운로드 폴더를 위에서 만든 VM안으로 복사해 준다.

# scp -r lustre-2.10.1  [email protected]:/root/
# scp -r lustre-2.10.1  [email protected]:/root/

4. MDS와 OSS 서버 설치

러스터 MDS 와 OSS 서버 설치를 위하여 준비 작업은 동일하다.

MDS1 노드로 로그인한다.

# vagrant ssh lustre-server-mds1
# sudo bash

OSS1 노드도 동일하게 작업한다. (터미널을 동시에 띄워 놓고 같이 진행해도 됨)

# vagrant ssh lustre-server-oss1
# sudo bash

firewall 서비스는 중지하여 준다.

# systemctl  stop firewalld ;  systemctl  disable firewalld
# systemctl  status  firewalld

debuginfo 와 devel 패키지를 제외한 나머지를 다 설치함

# cd  /root/lustre-2.10.1
# yum localinstall -y \
   e2fsprogs-1.42.13.wc6-7.el7.x86_64.rpm \
   e2fsprogs-libs-1.42.13.wc6-7.el7.x86_64.rpm \
   e2fsprogs-static-1.42.13.wc6-7.el7.x86_64.rpm \
   kernel-3.10.0-693.2.2.el7_lustre.x86_64.rpm \
   kernel-tools-3.10.0-693.2.2.el7_lustre.x86_64.rpm \
   kernel-tools-libs-3.10.0-693.2.2.el7_lustre.x86_64.rpm \
   kmod-lustre-2.10.1-1.el7.x86_64.rpm \
   kmod-lustre-osd-ldiskfs-2.10.1-1.el7.x86_64.rpm  \
   kmod-lustre-tests-2.10.1-1.el7.x86_64.rpm \
   libcom_err-1.42.13.wc6-7.el7.x86_64.rpm \
   libnvpair1-0.7.1-1.el7.x86_64.rpm \
   libss-1.42.13.wc6-7.el7.x86_64.rpm \
   libuutil1-0.7.1-1.el7.x86_64.rpm  \
   libzpool2-0.7.1-1.el7.x86_64.rpm lustre-2.10.1-1.el7.x86_64.rpm  \
   lustre-iokit-2.10.1-1.el7.x86_64.rpm \
   lustre-osd-ldiskfs-mount-2.10.1-1.el7.x86_64.rpm  \
   lustre-resource-agents-2.10.1-1.el7.x86_64.rpm \
   perf-3.10.0-693.2.2.el7_lustre.x86_64.rpm \
   python-perf-3.10.0-693.2.2.el7_lustre.x86_64.rpm  

...
Install  13 Packages (+4 Dependent packages)
Upgrade   8 Packages (+6 Dependent packages)

Total size: 135 M
Total download size: 39 M
Downloading packages:
(1/11): dracut-network-033-463.el7_033-502.el7_4.1.x86_64.drpm                      |  64 kB  00:00:00     
(2/11): dracut-033-463.el7_033-502.el7_4.1.x86_64.drpm                              | 136 kB  00:00:00     
(3/11): net-snmp-libs-5.7.2-24.el7_2.1_5.7.2-28.el7_4.1.x86_64.drpm                 |  96 kB  00:00:00     
(4/11): dracut-config-rescue-033-502.el7_4.1.x86_64.rpm                             |  56 kB  00:00:00     
(5/11): libyaml-0.1.4-11.el7_0.x86_64.rpm                                           |  55 kB  00:00:00     
(6/11): kexec-tools-2.0.14-17.2.el7.x86_64.rpm                                      | 333 kB  00:00:00     
(7/11): sg3_utils-1.37-12.el7.x86_64.rpm                                            | 644 kB  00:00:00     
(8/11): net-snmp-agent-libs-5.7.2-28.el7_4.1.x86_64.rpm                             | 704 kB  00:00:00     
(9/11): sg3_utils-libs-1.37-12.el7.x86_64.rpm                                       |  64 kB  00:00:00     
(10/11): resource-agents-3.9.5-105.el7_4.6.x86_64.rpm                               | 375 kB  00:00:00     
(11/11): linux-firmware-20170606-58.gitc990aae.el7_4.noarch.rpm                     |  35 MB  00:04:44     
--------------------------------------------------------------------------------------------------------
Total                                                                      135 kB/s |  38 MB  00:04:45     
...
Installed:
  e2fsprogs-static.x86_64 0:1.42.13.wc6-7.el7             kernel.x86_64 0:3.10.0-693.2.2.el7_lustre
  kmod-lustre.x86_64 0:2.10.1-1.el7                       kmod-lustre-osd-ldiskfs.x86_64 0:2.10.1-1.el7
  kmod-lustre-tests.x86_64 0:2.10.1-1.el7                 libnvpair1.x86_64 0:0.7.1-1.el7 
  libuutil1.x86_64 0:0.7.1-1.el7                          libzpool2.x86_64 0:0.7.1-1.el7
  lustre.x86_64 0:2.10.1-1.el7                            lustre-iokit.x86_64 0:2.10.1-1.el7
  lustre-osd-ldiskfs-mount.x86_64 0:2.10.1-1.el7          lustre-resource-agents.x86_64 0:2.10.1-1.el7
  perf.x86_64 0:3.10.0-693.2.2.el7_lustre

Dependency Installed:
  libyaml.x86_64 0:0.1.4-11.el7_0                       net-snmp-agent-libs.x86_64 1:5.7.2-28.el7_4.1
  resource-agents.x86_64 0:3.9.5-105.el7_4.6            sg3_utils.x86_64 0:1.37-12.el7

Updated:
  e2fsprogs.x86_64 0:1.42.13.wc6-7.el7                 e2fsprogs-libs.x86_64 0:1.42.13.wc6-7.el7 
  kernel-tools.x86_64 0:3.10.0-693.2.2.el7_lustre      kernel-tools-libs.x86_64 0:3.10.0-693.2.2.el7_lustre
  kexec-tools.x86_64 0:2.0.14-17.2.el7                 libcom_err.x86_64 0:1.42.13.wc6-7.el7
  libss.x86_64 0:1.42.13.wc6-7.el7                     python-perf.x86_64 0:3.10.0-693.2.2.el7_lustre

Dependency Updated:
  dracut.x86_64 0:033-502.el7_4.1                  dracut-config-rescue.x86_64 0:033-502.el7_4.1
  dracut-network.x86_64 0:033-502.el7_4.1          linux-firmware.noarch 0:20170606-58.gitc990aae.el7_4
  net-snmp-libs.x86_64 1:5.7.2-28.el7_4.1          sg3_utils-libs.x86_64 0:1.37-12.el7

Complete!
# rpm -qa 'e2fs*'
e2fsprogs-static-1.42.13.wc6-7.el7.x86_64
e2fsprogs-libs-1.42.13.wc6-7.el7.x86_64
e2fsprogs-1.42.13.wc6-7.el7.x86_64

재부팅전 커널 버전 확인

# uname -r
3.10.0-514.el7.x86_64

서버를 재부팅한다.

# reboot

재부팅후 커널 버전을 확인한다. 러스터용으로 빌드된 커널이 확인되어야 한다.

# uname -r
3.10.0-693.2.2.el7_lustre.x86_64

커널이 자동 업데이트 되지 않도록 yum.conf 에 exclude 규칙을 넣어준다.

# echo "exclude=kernel*" >> /etc/yum.conf
4.1. LNET 설정

상세한 설정 방법은 다음 사이트를 참고

lnet 커널 모듈을 올려준다.

# modprobe -v lnet
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/net/libcfs.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/net/lnet.ko 

# lsmod | grep lnet
lnet                  484580  0 
libcfs                415815  1 lnet

커널에서 LNet 서비스를 초기화 한다.

# lctl network configure
LNET configured

러스터 버전 확인 방법

# lctl  lustre_build_version
Lustre version: 2.10.1

참고 : lctl --list-commands

다음과 같이 네트워크 현재 상태를 조회해 보면 tcp 로 VM의 첫번째 NIC인 10.0.2.15가 설정된 것을 알 수 있다.

VirtualBox에서 사용하는 첫번째 NIC은 NAT용으로 내부 네트워크간 연결이 안되므로, 두번째 NIC을 사용하도록 변경해 주어야 한다.

# lnetctl net show
net:
    - net type: lo
      local NI(s):
        - nid: 0@lo
          status: up
    - net type: tcp
      local NI(s):
        - nid: 10.0.2.15@tcp
          status: up

# lctl list_nids
10.0.2.15@tcp

tcp net만 조회하려면 다음과 같이 한다. 아래 두 명령은 동일하다. (tcp 와 tcp0는 동일)

# lnetctl net show --net tcp
# lnetctl net show --net tcp0
net:
    - net type: tcp
      local NI(s):
        - nid: 10.0.2.15@tcp
          status: up

상세한 내용을 보고 싶다면 --verbose 옵션을 이용한다.

# lnetctl net show --net tcp0 --verbose
net:
    - net type: tcp
      local NI(s):
        - nid: 10.0.2.15@tcp
          status: up
          statistics:
              send_count: 0
              recv_count: 0
              drop_count: 0
          tunables:
              peer_timeout: 180
              peer_credits: 8
              peer_buffer_credits: 0
              credits: 256
          lnd tunables:
          tcp bonding: 0
          dev cpt: -1
          CPT: "[0]"

NID를 바꾸기 위해 먼저 해당 NID를 삭제한다.

# lnetctl net del --net tcp

# lnetctl net show
net:
    - net type: lo
      local NI(s):
        - nid: 0@lo
          status: up

두번째 NIC 인 enp0s8을 추가한다.

# lnetctl net add --net tcp0 --if enp0s8 --peer-timeout 180 --peer-credits 8

# lnetctl net show
net:
    - net type: lo
      local NI(s):
        - nid: 0@lo
          status: up
    - net type: tcp
      local NI(s):
        - nid: 192.168.56.111@tcp
          status: up
          interfaces:
              0: enp0s8

NID 리스트를 조회하면 IP가 변경된 것을 알 수 있다.

# lctl list_nids
192.168.56.111@tcp

네트워크의 통계 정보 조회하기

# lnetctl stats show
statistics:
    msgs_alloc: 0
    msgs_max: 0
    errors: 0
    send_count: 0
    recv_count: 0
    route_count: 0
    drop_count: 0
    send_length: 0
    recv_length: 0
    route_length: 0
    drop_length: 0

여기까지 OSS1 노드도 동일하게 작업한다.

4.2. MDS 파일 시스템 만들어 주기

커널 모듈 올려주기

# modprobe -v lustre
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/obdclass.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/ptlrpc.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/fld.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/fid.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/lov.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/mdc.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/lmv.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/lustre.ko 

러스터용 파일시스템 만들기

# mkfs.lustre --fsname=mylustre --mdt --mgs --index=0 /dev/sdb
   Permanent disk data:
Target:     mylustre:MDT0000
Index:      0
Lustre FS:  mylustre
Mount type: ldiskfs
Flags:      0x65
              (MDT MGS first_time update )
Persistent mount opts: user_xattr,errors=remount-ro
Parameters:

checking for existing Lustre data: not found
device size = 20000MB
formatting backing filesystem ldiskfs on /dev/sdb
	target name   mylustre:MDT0000
	4k blocks     5120000
	options        -J size=800 -I 1024 -i 2560 -q -O dirdata,uninit_bg,^extents,dir_nlink,quota,huge_file,flex_bg -E lazy_journal_init -F
mkfs_cmd = mke2fs -j -b 4096 -L mylustre:MDT0000  -J size=800 -I 1024 -i 2560 -q -O dirdata,uninit_bg,^extents,dir_nlink,quota,huge_file,flex_bg -E lazy_journal_init -F /dev/sdb 5120000
Writing CONFIGS/mountdata

마운트 하기

# mkdir /mnt/mdt1
# mount -t lustre /dev/sdb /mnt/mdt1
mount.lustre: increased /sys/block/sdb/queue/max_sectors_kb from 512 to 16384
mount.lustre: change scheduler of /sys/block/sdb/queue/scheduler from cfq to deadline

마운트 확인하기

# df -hT /mnt/mdt1
Filesystem     Type    Size  Used Avail Use% Mounted on
/dev/sdb       lustre   11G   51M  9.9G   1% /mnt/mdt1

988 포트가 리슨상태임을 확인한다.

# netstat -ant | grep 988
tcp        0      0 0.0.0.0:988             0.0.0.0:*               LISTEN   
4.3. OST 파일 시스템 만들어 주기

커널 모듈 올려주기

# modprobe -v lustre
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/obdclass.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/ptlrpc.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/fld.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/fid.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/lov.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/mdc.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/lmv.ko 
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/lustre.ko 

OST 커널 모듈 올려주기

# modprobe -v ost
insmod /lib/modules/3.10.0-693.2.2.el7_lustre.x86_64/extra/lustre/fs/ost.ko 
4.4. OST 파일 시스템 만들기
# export MDS_NODE_IP=192.168.56.111
# mkfs.lustre --fsname=mylustre --ost  --mgsnode=$MDS_NODE_IP@tcp --index=0 --reformat /dev/sdb
   Permanent disk data:
Target:     mylustre:OST0000
Index:      0
Lustre FS:  mylustre
Mount type: ldiskfs
Flags:      0x62
              (OST first_time update )
Persistent mount opts: ,errors=remount-ro
Parameters: mgsnode=192.168.56.111@tcp

device size = 20000MB
formatting backing filesystem ldiskfs on /dev/sdb
	target name   mylustre:OST0000
	4k blocks     5120000
	options        -J size=400 -I 512 -i 69905 -q -O extents,uninit_bg,dir_nlink,quota,huge_file,flex_bg -G 256 -E resize="4290772992",lazy_journal_init -F
mkfs_cmd = mke2fs -j -b 4096 -L mylustre:OST0000  -J size=400 -I 512 -i 69905 -q -O extents,uninit_bg,dir_nlink,quota,huge_file,flex_bg -G 256 -E resize="4290772992",lazy_journal_init -F /dev/sdb 5120000
Writing CONFIGS/mountdata

마운트 하기

# mkdir /mnt/ost1
# mount -t lustre  /dev/sdb /mnt/ost1
mount.lustre: increased /sys/block/sdb/queue/max_sectors_kb from 512 to 16384
mount.lustre: change scheduler of /sys/block/sdb/queue/scheduler from cfq to deadline

마운트 확인하기

# df -hT /mnt/ost1
Filesystem     Type    Size  Used Avail Use% Mounted on
/dev/sdb       lustre   19G   46M   18G   1% /mnt/ost1

이때 mds1 에서 988 포트 상태 조회

mds1# netstat -ant | grep 988
tcp        0      0 0.0.0.0:988             0.0.0.0:*               LISTEN     
tcp        0      0 192.168.56.111:988      192.168.56.112:1022     ESTABLISHED
tcp        0      0 192.168.56.111:988      192.168.56.112:1023     ESTABLISHED
tcp        0      0 192.168.56.111:988      192.168.56.112:1021     ESTABLISHED

5. 클라이언트 설치하기

러스터 서버는 준비가 되었으므로 이제 클라이언트를 설치해 보자.

centos7 VM으로 다음과 같이 만들어 준다.

# mkdir luster_client ; cd luster_client
# vi Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.define "lustre-client1" do |node|
    node.vm.box = "centos7"
    node.vm.synced_folder ".", "/vagrant", disabled: true
    node.vm.network "private_network", ip: "192.168.56.115"
    node.vm.hostname = 'lustre-client1'

    node.vm.provider "virtualbox" do |v|
      v.customize ["modifyvm", :id, "--memory", "4096"]
      v.customize ["modifyvm", :id, "--usb", "on"]
      v.customize ["modifyvm", :id, "--usbehci", "off"]
      v.customize ["modifyvm", :id, "--description", "some description"]
      v.customize ["modifyvm", :id, "--name", "lustre-client1"]
    end
  end
end

# vagrant up
...wait...

다운로드 받은 폴더를 VM으로 복사함

# scp -r lustre-2.10.1  [email protected]:/root/

클라이언트 머신으로 로그인 하여 필요한 rpm 을 설치해 준다.

# vagrant ssh lustre-client1
# sudo bash
# cd /root/lustre-2.10.1   
# yum localinstall -y    \
    lustre-client-2.10.1-1.el7.x86_64.rpm \
    kmod-lustre-client-2.10.1-1.el7.x86_64.rpm 

설치된 러스터 클라이언트용 커널 모듈과 현재 커널 버전을 비교해 보면 다음과 같이 일치하지 않음을 알 수 있다.

# rpm -ql kmod-lustre-client 
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/fid.ko
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/fld.ko
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/lmv.ko
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/lov.ko
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/lustre.ko
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/mdc.ko
/lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/mgc.ko
......
# uname -r
3.10.0-514.el7.x86_64

# ( cd /lib/modules ; ls  )
3.10.0-514.el7.x86_64  3.10.0-693.17.1.el7.x86_64  3.10.0-693.2.2.el7.x86_64

이 상태에서는 다음과 같이 modprobe 명령이 실패하므로, 러스터에 맞게 커널을 수정해 주어야 한다.

# depmod -a
# modprobe -v lustre
insmod /lib/modules/3.10.0-514.el7.x86_64/extra/lustre-client/net/libcfs.ko 
modprobe: ERROR: could not insert 'lustre': Unknown symbol in module, or unknown parameter (see dmesg)

kmod-lustre-client 패키지와 매치되는 커널은 3.10.0-693.2.2.el7.x86_64 이나 현재 커널 버전은 3.10.0-514.el7.x86_64 으로 맞지 않음

  • 러스터 커널 3.10.0-693.2.2.el7.x86_64
  • 현재 커널 3.10.0-514.el7.x86_64

따라서, 인터넷에서 해당 버전의 커널을 찾아 다운로드 받는다.

다운로드 받은곳: https://centos.pkgs.org/7/centos-updates-x86_64/kernel-3.10.0-693.2.2.el7.x86_64.rpm.html

wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/kernel-3.10.0-693.2.2.el7.x86_64.rpm

커널 설치 및 재부팅후 커널 버전을 확인

# rpm -Uvh --force kernel-3.10.0-693.2.2.el7.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:kernel-3.10.0-693.2.2.el7        ################################# [ 33%]
Cleaning up / removing...
   2:kernel-3.10.0-693.17.1.el7       ################################# [ 67%]
   3:kernel-3.10.0-514.el7            ################################# [100%]

# reboot

# uname -r
3.10.0-693.2.2.el7.x86_64
# modprobe -v lustre
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/net/libcfs.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/net/lnet.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/obdclass.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/ptlrpc.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/lov.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/fid.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/mdc.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/fld.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/lmv.ko 
insmod /lib/modules/3.10.0-693.2.2.el7.x86_64/extra/lustre-client/fs/lustre.ko 
# lsmod | egrep "lustre|lnet"
lustre                829888  0 
lmv                   217543  1 lustre
mdc                   187889  1 lustre
lov                   300850  1 lustre
ptlrpc               1347880  6 fid,fld,lmv,mdc,lov,lustre
obdclass             1722769  7 fid,fld,lmv,mdc,lov,lustre,ptlrpc
lnet                  484580  4 lustre,obdclass,ptlrpc,ksocklnd
libcfs                415815  10 fid,fld,lmv,mdc,lov,lnet,lustre,obdclass,ptlrpc,ksocklnd

마운트하기

# export MDS_NODE_IP=192.168.56.111
# mkdir /lustre
# mount -t lustre  $MDS_NODE_IP@tcp:/mylustre  /lustre
# df -hT /lustre
Filesystem                   Type    Size  Used Avail Use% Mounted on
192.168.56.111@tcp:/mylustre lustre   19G   46M   18G   1% /lustre

이때 mds1 의 988 포트를 보면 oss1 와 client1 과 각각 3개의 커넥션으로 연결

mds1# netstat -ant | grep 988
tcp        0      0 0.0.0.0:988             0.0.0.0:*               LISTEN     
tcp        0      0 192.168.56.111:988      192.168.56.112:1022     ESTABLISHED
tcp        0      0 192.168.56.111:988      192.168.56.115:1021     ESTABLISHED
tcp        0      0 192.168.56.111:988      192.168.56.115:1023     ESTABLISHED
tcp        0      0 192.168.56.111:988      192.168.56.112:1023     ESTABLISHED
tcp        0      0 192.168.56.111:988      192.168.56.115:1022     ESTABLISHED
tcp        0      0 192.168.56.111:988      192.168.56.112:1021     ESTABLISHED

이때 oss1 의 988 포트를 보면 mds1 과 client1 과 각각 3개의 커넥션으로 연결

oss1# netstat -ant | grep 988
tcp        0      0 0.0.0.0:988             0.0.0.0:*               LISTEN     
tcp        0      0 192.168.56.112:1023     192.168.56.111:988      ESTABLISHED
tcp        0      0 192.168.56.112:988      192.168.56.115:1022     ESTABLISHED
tcp        0      0 192.168.56.112:988      192.168.56.115:1021     ESTABLISHED
tcp        0      0 192.168.56.112:1021     192.168.56.111:988      ESTABLISHED
tcp        0      0 192.168.56.112:1022     192.168.56.111:988      ESTABLISHED
tcp        0      0 192.168.56.112:988      192.168.56.115:1023     ESTABLISHED

client1는 mds1과 oss1 과 각각 3개의 커넥션이 연결됨

client1# netstat -ant | grep 988
tcp        0      0 0.0.0.0:988             0.0.0.0:*               LISTEN     
tcp        0      0 192.168.56.115:1023     192.168.56.112:988      ESTABLISHED
tcp        0      0 192.168.56.115:1022     192.168.56.112:988      ESTABLISHED
tcp        0      0 192.168.56.115:1022     192.168.56.111:988      ESTABLISHED
tcp        0      0 192.168.56.115:1021     192.168.56.111:988      ESTABLISHED
tcp        0      0 192.168.56.115:1023     192.168.56.111:988      ESTABLISHED
tcp        0      0 192.168.56.115:1021     192.168.56.112:988      ESTABLISHED

마운트된 /lustre 폴더로 이동하여 파일을 생성해 보자.

# cd /lustre/
# dd if=/dev/zero of=1G bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 5.33741 s, 201 MB/s
client # df -h /lustre/
Filesystem                    Size  Used Avail Use% Mounted on
192.168.56.111@tcp:/mylustre   19G  1.1G   17G   6% /lustre

oss1 # df -h /mnt/ost1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb         19G  1.1G   17G   6% /mnt/ost1
# lnetctl stats show
statistics:
    msgs_alloc: 0
    msgs_max: 32
    errors: 0
    send_count: 1413
    recv_count: 1412
    route_count: 0
    drop_count: 0
    send_length: 1073932032
    recv_length: 156560
    route_length: 0
    drop_length: 0

6. 시스템을 재부팅한 후

시스템을 재부팅한 후에 다시 마운트를 하려면 mds1, oss1, client 에서 다음과 같이 작업한다.

mds1#
/sbin/modprobe -v lnet
/sbin/lctl network configure
/sbin/lnetctl net del --net tcp
/sbin/lnetctl net add --net tcp0 --if enp0s8 --peer-timeout 180 --peer-credits 8
/sbin/lnetctl net show
mount -t lustre -v /dev/sdb /mnt/mdt1
oss1#
/sbin/modprobe -v lnet
/sbin/modprobe -v ost
/sbin/modprobe -v lustre
/sbin/lctl network configure
/sbin/lnetctl net del --net tcp
/sbin/lnetctl net add --net tcp0 --if enp0s8 --peer-timeout 180 --peer-credits 8
/sbin/lnetctl net show
mount -t lustre -v /dev/sdb /mnt/ost1
client1#
/sbin/modprobe -v lustre
export MDS_NODE_IP=192.168.56.111
mount -t lustre  $MDS_NODE_IP@tcp:/mylustre  /lustre

유틸리티 사용법 (참고만)

MDT, OST 사용량 보기

#lfs df
UUID                   1K-blocks        Used   Available Use% Mounted on
mylustre-MDT0000_UUID    11377076       51484    10302900   0% /lustre[MDT:0]
mylustre-OST0000_UUID    19763304     1094744    17628176   6% /lustre[OST:0]

filesystem_summary:     19763304     1094744    17628176   6% /lustre

참고 사이트