IT/LINUX

rocky8 Glusterfs 구성

ssung85 2023. 11. 7. 18:33
728x90

GlusterFS는 확장성이 가능한 NAS 파일 시스템이다. 다수의 스토리지를 이더넷 또는 인피니밴드를 통하여 하나의 커다란 병렬 네트워크 파일 시스템으로 통합한다. 클라우드 컴퓨팅 및 스트리밍 미디어 서비스 그리고 콘텐츠 전송 네트워크와 같은 서비스 등에 사용된다

 

간단하게, 다수의 서버를 하나의 NAS로 통합시켜주는 오픈소스이다.

구성환경

OS : rocky8.8

 - node1 : 192.168.0.31/24 , 77TB , 10G NIC * 2ea

 - node2 : 192.168.0.32/24  , 77TB  , 10G NIC * 2ea

 - node3 : 192.168.0.33/24  , 77TB  , 10G NIC * 2ea

 - node4 : 192.168.0.34/24  , 77TB  , 10G NIC * 2ea

 - node5 : 192.168.0.35/24  , 77TB  , 10G NIC * 2ea

 

5개의 노드를 1개의 NAS로 구성하고, 10G NIC LACP 구성하여, 20G NIC 만들기

 

OS 설치 세팅

OS 설치하면서 bonding 구성 또는 설치 후 bonding 구성

bond Mode : 802.3ad 

LACP는 스위치에서 LAG 설정이 같이 돼야 20G 사용 가능

Gluster 구성 시작 

- 모든 노드 동일 하게 실행

vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.31 node1
192.168.0.32 node2
192.168.0.33 node3
192.168.0.34 node4
192.168.0.35 node5

 

볼륨 생성

Disk /dev/sdb: 76.4 TiB, 84008486567936 bytes, 164079075328 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes

 

LVM 생성, mount point 생성

 

pvcreate /dev/sdb
vgcreate vg_data /dev/sdb
vcreate -l 100%FREE -n lv_data vg_data
mkfs.xfs /dev/vg_data/lv_data
mkdir -p /data/glusterfs/volume1
mkdir /data/glusterfs/volume1/brick0

 

 

fdisk -l 생성 확인

Disk /dev/mapper/vg_data-lv_data: 76.4 TiB, 84008482373632 bytes, 164079067136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
LVM 생성이 안 될 경우
wipefs --all --backup /dev/sdb
파티션 테이블 서명 삭제 후 생성


vi /etc/fstab 등록

/dev/mapper/vg_data-lv_data /data/glusterfs/volume1        xfs     defaults        1 2
mount -a

 

mount 확인

[root@node1 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                      32G     0   32G   0% /dev
tmpfs                         32G     0   32G   0% /dev/shm
tmpfs                         32G   11M   32G   1% /run
tmpfs                         32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/rl-root          170G  8.3G  162G   5% /
/dev/sda3                   1006M  355M  652M  36% /boot
/dev/mapper/vg_data-lv_data   77T  565G   76T   1% /data/glusterfs/volume1
tmpfs                        6.3G     0  6.3G   0% /run/user/0
tmpfs                        6.3G   32K  6.3G   1% /run/user/1000

 

 

gluster9 패키지 다운로드

dnf install centos-release-gluster9

 

gluster9 repo 신규생성
기존 파일 있다면 삭제 후 새로 생성

vi /etc/yum.repos.d/CentOS-Gluster-9.repo

 

 [centos-gluster9]
name=CentOS-$releasever - Gluster 9
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=$releasever&repo=storage-gluster-9
baseurl=https://dl.rockylinux.org/vault/centos/8.5.2111/storage/x86_64/gluster-9/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage


glusterfs 패키지 다운로드 설치

dnf install glusterfs glusterfs-libs glusterfs-server
systemctl enable glusterfsd.service glusterd.service
systemctl start glusterfsd.service glusterd.service
systemctl status glusterfsd.service glusterd.service


firewall allow

firewall-cmd --zone=public --add-port=24007-24008/tcp --permanent
firewall-cmd --zone=public --add-port=49152/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all


node1 에서 실행

gluster peer probe node2
gluster peer probe node3
gluster peer probe node4
gluster peer probe node5

 

peer status 확인

[root@node1 ~]# gluster peer status
Number of Peers: 4

Hostname: node2
Uuid: 8c572c67-xxxx-xxxx-xxxx-c20f99bea0b3
State: Peer in Cluster (Connected)

Hostname: node3
Uuid: f77eaadd-xxxx-xxxx-xxxx-af4f5c078c18
State: Peer in Cluster (Connected)

Hostname: node4
Uuid: 952dbb23-xxxx-xxxx-xxxx-f5b67d17d077
State: Peer in Cluster (Connected)

Hostname: node5
Uuid: 08e09d01-xxxx-xxxx-xxxx-04bceacfe8a0
State: Peer in Cluster (Connected)


볼륨 생성
볼륨 생성은 복제, 분산이 있다.

하나로 묶는 목적이기 때문에 분산으로 볼륨을 생성한다.

gluster volume create volume1 node1:/data/glusterfs/volume1/brick0/ node2:/data/glusterfs/volume1/brick0/ node3:/data/glusterfs/volume1/brick0/ node4:/data/glusterfs/volume1/brick0/ node5:/data/glusterfs/volume1/brick0/
gluster volume start volume1

 

볼륨 상태 확인

[root@node1 ~]# gluster volume status
Status of volume: volume1
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick node1:/data/glusterfs/volume1/brick0  49152     0          Y       2273
Brick node2:/data/glusterfs/volume1/brick0  49152     0          Y       2266
Brick node3:/data/glusterfs/volume1/brick0  49152     0          Y       2295
Brick node4:/data/glusterfs/volume1/brick0  49152     0          Y       2263
Brick node5:/data/glusterfs/volume1/brick0  49152     0          Y       2269

Task Status of Volume volume1
------------------------------------------------------------------------------
There are no active volume tasks


볼륨 mount

node1 mount 하면 5대의 서버 중에 node1에서만 접속하기 때문에 DNS 활용하여, 분산해줄 필요가 있다.

mkdir /test-vol
mount.glusterfs node1:/volume1 /test-vol
[root@node1 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                      32G     0   32G   0% /dev
tmpfs                         32G     0   32G   0% /dev/shm
tmpfs                         32G   11M   32G   1% /run
tmpfs                         32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/rl-root          170G  8.3G  162G   5% /
/dev/sda3                   1006M  355M  652M  36% /boot
/dev/mapper/vg_data-lv_data   77T  570G   76T   1% /data/glusterfs/volume1
node1:/volume1.tcp  383T  6.6T  376T   2% /test-vol
tmpfs                        6.3G     0  6.3G   0% /run/user/0
tmpfs                        6.3G   32K  6.3G   1% /run/user/1000


볼륨 삭제

gluster volume stop volume1
gluster volume delete volume1
setfattr -x trusted.glusterfs.volume-id /data/glusterfs/volume1/brick0
setfattr -x trusted.gfid /data/glusterfs/volume1/brick0
rm -rf /data/glusterfs/volume1/brick0
728x90