본문 바로가기

리눅스

GlusterFS를 구축하는 방법

반응형

GlusterFS를 구축하는 방법

GlusterFS는 분산 파일 시스템으로, 여러 서버를 클러스터로 구성하여 데이터를 분산 및 복제하는데 사용됩니다. 이를 통해 확장성과 가용성을 높일 수 있습니다.

  • Storage Node List
vm001 vm001.scbyun.com
vm002 vm002.scbyun.com
vm003 vm003.scbyun.com
vm004 vm004.scbyun.com
  • 전제조건
    • GlusterFS 클러스터를 구성할 서버(노드)가 필요합니다. 이 예제에서는 3개의 서버를 사용합니다. (node1, node2, node3)
    • 각 노드에는 GlusterFS 패키지가 설치되어 있어야 합니다.
  • 모듈 설치
yum install -y python-cytpes flex bison openssl
  • GlusterFS 패키지 설치
wget -l 1 -nd -nc -r -A.rpm http://download.gluster.org/pub/gluster/glusterfs/LATEST/RHEL/epel-6/x86_64/
yum install -y glusterfs-*
  • fuse 모듈 적용 및 확인
modprobe fuse
echo "modprobe fuse" >> /etc/rc.local
dmesg | grep -i fuse
$ dmesg | grep -i fuse
fuse init (API version 7.13)

or

echo "modprobe fuse" > /etc/sysconfig/modules/fuse.modules
chmod +x /etc/sysconfig/modules/fuse.modules
  • GlusterFS 서비스 시작
chkconfig glusterd on
service glusterd start

* 방화벽 Open 24007 port

-A INPUT -m state --state NEW -m tcp -p tcp --dport 24007 -j ACCEPT
  • GlusterFS pool 등록 확인
gluster peer status
$ gluster peer status
Number of Peers: 0
  • GlusterFS pool 등록
gluster peer probe vm002.scbyun.com
$ gluster peer probe vm002.scbyun.com
peer probe: success.
gluster peer probe vm003.scbyun.com
gluster peer probe vm004.scbyun.com
  • GlusterFS pool 등록 확인
gluster peer status
$ gluster peer status
Number of Peers: 3
 
Hostname: vm002.scbyun.com
Uuid: 7181c145-709a-4b01-a771-81505c617195
State: Peer in Cluster (Connected)
 
Hostname: vm003.scbyun.com
Uuid: 0cc05771-2bca-49dd-b77f-32dd3e9491ee
State: Peer in Cluster (Connected)
 
Hostname: vm004.scbyun.com
Uuid: f5d38e0d-7f2c-40b2-ba7c-ddee271bdd10
State: Peer in Cluster (Connected)
  • GlusterFS Volume 생성
Usage:
volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT>] [transport <tcp|rdma|tcp,rdma>] <NEW-BRICK>?<vg_name>... [force]
gluster volume create cloud-vol stripe 4 transport tcp vm001.scbyun.com:/data vm002.scbyun.com:/data vm003.scbyun.com:/data vm004.scbyun.com:/data force
$ gluster volume create cloud-vol stripe 4 transport tcp vm001.scbyun.com:/data vm002.scbyun.com:/data vm003.scbyun.com:/data vm004.scbyun.com:/data force
volume create: cloud-vol: success: please start the volume to access data
728x90
  • GlusterFS Volume 생성 확인
gluster volume info all
$ gluster volume info all
 
Volume Name: cloud-vol
Type: Stripe
Volume ID: 211b8b6b-3e8d-4957-8eb1-fac8434bf4dc
Status: Created
Number of Bricks: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: vm001.scbyun.com:/data
Brick2: vm002.scbyun.com:/data
Brick3: vm003.scbyun.com:/data
Brick4: vm004.scbyun.com:/data
  • GlusterFS Volume 시작/상태 확인
gluster volume start cloud-vol
$ gluster volume start cloud-vol
volume start: cloud-vol: success
 
# gluster volume status cloud-vol
Status of volume: cloud-vol
Gluster process                                         Port    Online  Pid
------------------------------------------------------------------------------
Brick vm001.scbyun.com:/data                            49152   Y       2610
Brick vm002.scbyun.com:/data                            49152   Y       4167
Brick vm003.scbyun.com:/data                            49152   Y       28517
Brick vm004.scbyun.com:/data                            49152   Y       28211
NFS Server on localhost                                 N/A     N       N/A
NFS Server on vm003.scbyun.com                          N/A     N       N/A
NFS Server on vm002.scbyun.com                          N/A     N       N/A
NFS Server on vm004.scbyun.com                          N/A     N       N/A
 
Task Status of Volume cloud-vol
------------------------------------------------------------------------------
There are no active volume tasks
  • GlusterFS Volume 확인
gluster volume info
$ gluster volume info
 
Volume Name: cloud-vol
Type: Stripe
Volume ID: 211b8b6b-3e8d-4957-8eb1-fac8434bf4dc
Status: Started
Number of Bricks: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: vm001.scbyun.com:/data
Brick2: vm002.scbyun.com:/data
Brick3: vm003.scbyun.com:/data
Brick4: vm004.scbyun.com:/data

Client에서 Gluster Volume 마운트

  • GlusterFS 패키지 설치
wget http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo -O /etc/yum.repos.d/glusterfs-epel.repo
yum -y install glusterfs glusterfs-fuse
  • GlusterFS Volume 마운트
mkdir /mnt/cloud-vol
mount -t glusterfs vm001.scbyun.com:/cloud-vol /mnt/cloud-vol
  • GlusterFS Volume 마운트 확인
df -h
$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/xvda3                    75G  1.7G   70G   3% /
tmpfs                        936M     0  936M   0% /dev/shm
/dev/xvda1                   194M   29M  155M  16% /boot
vm001.scbyun.com:/cloud-vol  299G  7.9G  276G   3% /mnt/cloud-vol
tail -n 2 /etc/fstab
$ tail -n 2 /etc/fstab
### glusterfs
vm001.scbyun.com:/cloud-vol     /mnt/cloud-vol  glusterfs       defaults,_netdev 0 0

 

참고URL

- Gluster Docs : http://www.gluster.org/community/documentation/index.php/Getting_started_install

- GlusterFS 구축하기 http://vozlt.com/GlusterFS

 

728x90
반응형