티스토리 뷰

linux

install glusterfs on centos7

fendys 2021. 10. 28. 21:46
반응형

glusterfs network interface를 따로 본딩 구성하는 방향으로 해야 네트워크 이슈가 적을 것이다.

- 서버 정보

- glusterfs node info
gluster01 / 192.168.0.19
gluster02 / 192.168.0.20

- client server
reni-ansible / 192.168.0.16 

/etc/hosts
192.168.0.18 reni-ansible
192.168.0.19	gluster01.reni.com	gluster01
192.168.0.20	gluster02.reni.com	gluster02

 

1. yum repository 추가

[root@reni-glusterfs01 ~]# yum install centos-release-gluster

 

2. Gluster 설치

[root@reni-glusterfs01 ~]# yum install glusterfs-server

 

3. 노드 추가 방법 

[root@reni-glusterfs01 ~]# gluster peer probe gluster02
peer probe: success
[root@reni-glusterfs01 ~]# 

[root@reni-glusterfs01 ~]#cat /etc/hosts
192.168.0.19	gluster01.reni.com	gluster01
192.168.0.20	gluster02.reni.com	gluster02

 

4. 피어 상태 확인

[root@reni-glusterfs01 ~]# gluster peer status
Number of Peers: 0
[root@reni-glusterfs01 ~]#

[root@reni-glusterfs01 ~]# gluster peer status
Number of Peers: 1

Hostname: gluster02
Uuid: 17769b84-8f32-4593-81bd-8d553dc32062
State: Peer in Cluster (Connected)
[root@reni-glusterfs01 ~]#

 

5. gluster 볼륨 생성

- 2노드 복제
gluster volume create glusterfs-storage replica 2 gluster01:/glusterfs-storage/brick1 gluster02:/glusterfs-storage/brick1 force

- 2노드 분산
gluster volume create glusterfs-storage gluster01:/glusterfs-storage/brick1 gluster02:/glusterfs-storage/brick1 force



추가 설정 예제)
- 4노드 복제
gluster volume create glusterfs-storage replica 4 gluster01:/glusterfs-storage/brick1 gluster02:/glusterfs-storage/brick1 gluster03:/glusterfs-storage/brick1 gluster04:/glusterfs-storage/brick1 force

- 2노드 분산
gluster volume create glusterfs-storage gluster01:/glusterfs-storage/brick1 gluster02:/glusterfs-storage/brick1 gluster03:/glusterfs-storage/brick1 gluster04:/glusterfs-storage/brick1 force

- 4노드 복제, 분산 (2x2)
gluster volume create test replica 2 gluster01:/glusterfs-storage/brick1 gluster02:/glusterfs-storage/brick1 gluster03:/glusterfs-storage/brick1 gluster04:/glusterfs-storage/brick1 force

 

6. gluster 볼륨 상태 및 정보 확인

[root@reni-glusterfs01 /]# gluster volume list
glusterfs-storage
[root@reni-glusterfs01 /]# gluster volume info
 
Volume Name: glusterfs-storage
Type: Replicate
Volume ID: cc223baf-ff95-4337-bf80-c6309ef022b5
Status: Created
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: gluster01:/glusterfs-storage/brick1
Brick2: gluster02:/glusterfs-storage/brick1
Options Reconfigured:
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
[root@reni-glusterfs01 /]#

 

7. gluster 볼륨 서비스 실행 및 상태 확인

[root@reni-glusterfs01 /]# gluster volume start glusterfs-storage
volume start: glusterfs-storage: success
[root@reni-glusterfs01 /]# gluster volume status
Status of volume: glusterfs-storage
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick gluster01:/glusterfs-storage/brick1   49152     0          Y       1714 
Brick gluster02:/glusterfs-storage/brick1   49152     0          Y       1620 
Self-heal Daemon on localhost               N/A       N/A        Y       1731 
Self-heal Daemon on gluster02               N/A       N/A        Y       1637 
 
Task Status of Volume glusterfs-storage
------------------------------------------------------------------------------
There are no active volume tasks
 
[root@reni-glusterfs01 /]#

 

8. Glusterfs client install & volume mount 

[root@reni-ansible glusterfs]# yum install glusterfs-fuse

### mount
[root@reni-ansible glusterfs]# mount -t glusterfs gluster01:glusterfs-storage /storage-volume

### mount check
[root@reni-ansible storage-volume]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     2.0G     0  2.0G   0% /dev
tmpfs                        2.0G     0  2.0G   0% /dev/shm
tmpfs                        2.0G  9.1M  2.0G   1% /run
tmpfs                        2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/centos-root       46G  2.2G   43G   5% /
/dev/xvda1                  1014M  140M  875M  14% /boot
tmpfs                        393M     0  393M   0% /run/user/0
gluster01:glusterfs-storage   50G  545M   50G   2% /storage-volume
[root@reni-ansible storage-volume]#

 

9. 고정 마운트를 위한 fatab 추가

/etc/fstab

gluster01:glusterfs-storage /storage-volume glusterfs defaults,_netdev 0 0

 

 

- Gluster 간단 용어 설명

- peer
여러대의 노드의 파일시스템을 하나로 묶어서 사용하며 이 노드를 'peer' 라고 합니다.

- cluster
파일 시스템을 구성 할 peer의 모임 

- brick
브릭은 각 노드에서 볼륨으로 사용 할 파일시스템(마운트 포인트)
(ex - glusterfs01:/glusterfs-storage)

- volume 
서비스를 제공 하는 여러개의 브릭들로 구성되어 있는 gluster 볼륨

* 사용자는 기본적으로 glusterfs 파일시스템을 통해 마운트를 하며, 
  NFS나 SMB, CIFS 등을 통해 사용

 

 

 

반응형