[CFS] GlusterFS 스토리지 환경 구축하기

GlusterFS로 분산 스토리지 환경 구현하기

작성자 : 서진우
작성일 : 2011-08-06

1. GlusterFS 소개

Gluster 파일 시스템은 수천 PetaByte 용량(actually, 72 brontobyte)에 수천 개의
Client host가 접속하여 사용 가능한 scale-out 방식의 분산 파일 시스템이다.
기존의 분산형 파일 시스템과 비교하여, 간단한 아키텍처 구성에, 안정성, 대용량
대규모 I/O 처리 성능, 응용 호환성 등이 우수하여, 근래 클라우드 인프라 구성에
많이 이용 되고 있다.

 

2. GlusterFS 설치환경 준비

7대의 서버 시스템을 준비한다. (VM을 이용해서 해도 무방. 본 테스트는 Redhat KVM 상에서
테스트 실시함.

– os info

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

– hosts info

# cat /etc/hosts
192.168.123.61  vmlnx001
192.168.123.62  vmlnx002
192.168.123.63  vmlnx003
192.168.123.64  vmlnx004
192.168.123.65  vmlnx005
192.168.123.66  vmlnx006
192.168.123.67  vmlnx007

vmlnx001~vmlnx004 까지 storage pool server 로 사용하고 vmlnx005~007
까지는 gluster client node 로 사용한다.

이후 storage pool 추가 테스트에서 vmlnx005~vmlnx007까지 서버의 디스크를
이용하여 storage pool을 확장할것이다.

– pre-install pkg

wget, fuse, fuse-libs, fuse-devel

– security configure
firewall off, selinux off

모든 Gluster 서버의 TCP ports 111, 24007,24008, 24009-(24009 + 전체 볼륨수) 해제
NFS 사용시에는 ports 38465-(38465 + Gluster 서버수) 추가로 해제

– download to gluster package

http://www.gluster.org/download

glusterfs-core-3.2.2-1.x86_64.rpm
glusterfs-fuse-3.2.2-1.x86_64.rpm

3. GlusterFS 설치 및 기본 설정

– install package

모든 노드에 pre package 와 glusterfs 관련 package를 설치한다.

# psh rpm -Uvh glusterfs-core-3.2.2-1.x86_64.rpm glusterfs-fuse-3.2.2-1.x86_64.rpm

모든 노드에 gluster 데몬을 시작한다.

# psh  /etc/rc.d/init.d/glusterd start
# psh /sbin/chkconfig –level 345 glusterd on

– storage pool 구성

vmlnx001 서버에서 아래 명령을 수행한다. 해당 명령을 수행하는 서버에서는 자신의 호스트를
추가하는 명령을 수행할 필요가 없다.

# gluster peer probe vmlnx002
# gluster peer probe vmlnx003
# gluster peer probe vmlnx004

– pool 구성 확인

# gluster peer status
Number of Peers: 3

Hostname: vmlnx004
Uuid: 37d37621-e1e3-4f51-bf54-fa42a8425125
State: Peer in Cluster (Connected)

Hostname: vmlnx002
Uuid: 544ef065-ce1e-459d-a400-1ad7f92f55f9
State: Peer in Cluster (Connected)

Hostname: vmlnx003
Uuid: 6a954cf5-d2d1-4850-9cd5-19b8d0b77583
State: Peer in Cluster (Connected)

– pool 구성 제거

# gluster peer detach 호스트명(or 서버주소)

– volume 구성

Glusterfs 에는 서버 노드와 Brick 이라는 개념이 있는데,
서버노드는 Trusted Storage Pools 에 들어가 있는 서버를 의미하며,
Brick 은 서버노드 내에 볼륨을 구성할 때 포함하는 폴더를 의미한다.
따라서 한 서버노드 내에 많은 Brick이 존제할 수 있다.
Brick은 “서버IP:/폴더주소” 로 구성된다.

gluster의 volume 생성 방법은 크게 4가지가 존재한다.

distributed volume
-> 파일을 gluster 서버 노드의 각 Brick으로 분산해서 저장함. (기본)
replicated volume
-> 파일을 gluster 서버 노드의 각 Brick으로 분산해서 저장함.  지정된 replication 수 만큼의복제 파일을 생성함.
stripe volume
-> 여러 서버의 여러 Brick에 파일을 stripe 수로  만큼 나누어 저장함. 단 volume 생성 시 정의한 brick의 수와
Stripe 수가 일치해야 한다.
distributed stripe volume
-> 여러 gluster 서버 노드의 각 Brick 으로 파일을 stripe 수만큼 나누어 저장함.
distributed replicated volme :
-> multiple 한 replicated volume 구성을 형성할때 사용할 수 있다.

일단 모든 storage pool server에 brick으로 사용할 디렉토리를 생성한다.

# psh mkdir /data  -> /data 디렉토리를 brick 으로 사용할 것이다.

– dist 볼륨 구성 방법

gluster volume create <volume_name> server1:/directory server2:/directory …

# gluster volume create vol_dist vmlnx001:/data vmlnx002:/data vmlnx003:/data vmlnx004:/data
Creation of volume vol_dist has been successful. Please start the volume to access data.

# gluster volume info all : volume 정보 확인

Volume Name: vol_dist
Type: Distribute
Status: Created
Number of Bricks: 4
Transport-type: tcp
Bricks:
Brick1: vmlnx001:/data
Brick2: vmlnx002:/data
Brick3: vmlnx003:/data
Brick4: vmlnx004:/data

# gluster volume start vol_dist : volume 시작
Starting volume vol_dist has been successful

– replica volume 생성

gluster volume create <volume_name> replica <repli_number> server1:/directory server2:/directory …

# gluster volume create vol_repl replica 2  vmlnx001:/data vmlnx002:/data vmlnx003:/data vmlnx004:/data

위와 같이 <repli_number>을 2로 지정해 주면, vmlnx001과 002, 003과 004 서버가 pair 로 파일을 서로
복제하게 된다. 즉 dist 방식의 볼륨에 파일을 저장하다가 storage pool 서버 하나가 죽으면, 해당 서버에 저장된
파일은 보이지 않는다. (해당 서버가 복구 되면, 다시 자동으로 파일이 나타남) replica 방식에서는 서버가
1대 죽어도 다른 서버에 복제된 파일로 서비스가 가능한 장점이 있다. 단 이 경우 디스크 용량은 replica 수와
비례해서 줄어들게 된다.

– stripe volume 생성

gluster volume create <volume_name> stripe <stripe_number> transport <tcp,ib>  server1:/directory server2:/directory …

# gluster volume create vol_stripe stripe 2 transport tcp vmlnx001:/data vmlnx002:/data

– dist stripe volume 생성

gluster volume create <volume_name> stripe <stripe_number> transport <tcp,ib>  server1:/directory server2:/directory …

# gluster volume create vol_stripe stripe 4 transport tcp vmlnx001:/data vmlnx002:/data vmlnx003:/data vmlnx004:/data

– client 접근 허가 대역 지정

gluster volume set <volume_name> auth.allow <허가IP대역>

# gluster volume set vol_stripe auth.allow 192.168.123.*

– volume 삭제 방법

# gluster volume stop <volume_name>
# gluster volume delete <volume_name>

4. GlusterFS Native Client 환경 구현하기

gluster-core, gluster-fuse package install

먼저 fuse 모듈을 로딩한다.

# modprobe fuse

fuse 모듈 로딩 상태 확인

# dmesg | grep -i fuse
fuse init (API version 7.10)

적절한 Mount point를 만들어 놓고, mount 실시.

– glusterfs 방식으로 mount

# mount -t glusterfs <server_name>:<volume_name> <mount point>

# mount -t glusterfs vmlnx001:/vol_dist /glusterfs/
# mount
.
.
glusterfs#vmlnx001:/vol_dist on /glusterfs type fuse (rw,allow_other,default_permissions,max_read=131072)

– nfs 방식으로 mount

# mount -t nfs vmlnx001:/vol_dist /glusterfs/
# mount
.
.
vmlnx001:/vol_dist on /glusterfs type nfs (rw,addr=192.168.123.61)

– glusterfs 자동 mount

# vi /etc/fstab

server1:/vol_dist /glusterfs glusterfs defaults,_netdev 0 0

5. gluster volume 관리하기

– 현재 volume 및 brick 구성 확인

# gluster volume info all

Volume Name: vol_dist
Type: Distribute
Status: Started
Number of Bricks: 4
Transport-type: tcp
Bricks:
Brick1: vmlnx001:/data
Brick2: vmlnx002:/data
Brick3: vmlnx003:/data
Brick4: vmlnx004:/data

– clinet 에서의 mount 상태 확인

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
16G  6.0G  8.4G  42% /
/dev/vda1              99M   13M   82M  14% /boot
tmpfs                 982M     0  982M   0% /dev/shm
/dev/vdb1             9.7G  151M  9.0G   2% /data
glusterfs#vmlnx001:/vol_dist
39G  601M   36G   2% /glusterfs

위와 같이 4개의 brick 으로 구성된 distribute volume 에 1개의 신규 trusted storage node를 추가하고,
vol_dist volume 에 추가하여 용량을 확장 시키는 방법이다.

– add server to trusted storage pool

vmlnx001(gluster master) 서버에서 아래 명령 수행

# gluster peer probe vmlnx005
Probe successful

– add volume

gluster volume add-brick <volume_name> <add_server>:<add_directory>
gluster volume info all

– 추가된 volume 및 brick 확인

Volume Name: vol_dist
Type: Distribute
Status: Started
Number of Bricks: 5
Transport-type: tcp
Bricks:
Brick1: vmlnx001:/data
Brick2: vmlnx002:/data
Brick3: vmlnx003:/data
Brick4: vmlnx004:/data
Brick5: vmlnx005:/data

– clinet 에서 추가된 Mount 상태 확인

Clinet 에서 gluster storage와 mount 상태에서 추가된 brick 용량 만큼 증가되는 것을 확인할 수 있다.

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
16G  6.0G  8.4G  42% /
/dev/vda1              99M   13M   82M  14% /boot
tmpfs                 982M     0  982M   0% /dev/shm
/dev/vdb1             9.7G  151M  9.0G   2% /data
glusterfs#vmlnx001:/vol_dist
49G  751M   45G   2% /glusterfs

– 볼륨 추가 후 용량 재 균배

# gluster volume rebalance <vol_name> start
# gluster volume rebalance <vol_name> status

– 볼륨 Migration

Volume에 속해 있는 특정 brick을 새로운 brick으로 교체가 필요할때 수행하는 방법이다.
아래 명령은 server3:/exp3 의 brick 으로 server5:/exp5 로 대체할때 사용하는 명령이다.

gluster volume replace-brick <volume_name> server3:/exp3 server5:/exp5 start

이밖에 migration 관련  operation에 해당하는 명령은 다음과 같다.

To pause the migration operation, if needed, use the following command:
# gluster volume replace-brick VOLNAME BRICK NEW-BRICK pause

To abort the migration operation, if needed, use the following command:
# gluster volume replace-brick VOLNAME BRICK NEW-BRICK abort

Check the status of the migration operation using the following command:
# gluster volume replace-brick VOLNAME BRICK NEW-BRICK status

Commit the migration of data from one brick to another using the following command:
# gluster volume replace-brick VOLNAME BRICK NEW-BRICK commit

Verify the migration of brick by viewing the volume info using the following command:
# gluster volume info VOLNAME

– 볼륨에 추가된 brick 제거

gluster volume remove-brick <vol_name> <server>:<directory>
# gluster volume remove-brick vol_dist vmlnx005:/data

 

6. gluster file system tuning

glusterfs 의 성능튜닝 및 속성 변경을 위해서는 아래 명령을 사용한다.

# gluster volume set <volume_name> <option> <parameter>

예를 들어 cache size 성능을 튜닝하기 위한 설정 방법이다.

# gluster volume set vol_dist performance.cache-size 256MB
Set volume successful

이밖에 성능에 관련된 옵션은 아래와 같다.

7. gluster file system performance

지금까지의 기능 테스트는 VM 서버 상에서 실행하였다. 분산 디스크 성능에 영향을 주는 것은
“Disk 자체 성능/네트워크 성능/메모리 캐쉬 영향” 등이 해당된다.

VM 상에서는 실제 1대의 물리적인 서버를 여러대로 가상화하여 생성한 환경이여서 위 성능 요소
들에 모두 영향을 미치게 된다. 객관적인 성능을 확인하기 위해서는 실제 분산 시스템 환경에서
테스트를 수행하도록 한다.

또한 명확한 테스트를 위해서는 클라이언트의 부하 유발 용량에도 신경을 써야 한다.

테스트에 사용할 disk 성능 측정 프로그램은 iozone 으로 수행한다.
iozone 는 다양한 single과 multiple clinet 환경을 구현하는대 용이하다.

자세한 성능 비교 결과는 아래 내용을 참고 바란다.

http://blog.syszone.co.kr/3089

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

28 Responses

  1. 김동욱 말해보세요:

    6.2에서 구성해보았는대 잘 됩니다.

  2. 서진우 말해보세요:

    GlusterFS는 RedHat에서 올초에 Redhat에서 인수했습니다. 아마도 곧 RHEL 배포 버전에 GlusterFS
    가 포함되지 않을까 합니다.

  3. gluster 말해보세요:

    문의좀 하나 드려도 될런지요?

    ubuntu에 3.2.0 의 gluster를 사용중인데

    이걸 최신버전에 –> 3.5.0 버전으로 update하면 이게 될까요?

    만약 된다면 –> 기존 gluster stop시키고–> package만 update하면 될런지요?

    • alang@clunix.com 말해보세요:

      해당버전으로 해본적은 없지만 업그레이드 문제는 없었습니다.
      그래도 다른 시스템에서 테스트를 해보시거나 백업후 시도하세요.

  1. 2022년 6월 20일

    3resting-place

  2. 2023년 1월 26일

    3immature

  3. 2023년 6월 12일

    … [Trackback]

    […] Find More here on that Topic: nblog.syszone.co.kr/archives/4295 […]

  4. 2023년 7월 21일

    … [Trackback]

    […] Read More on to that Topic: nblog.syszone.co.kr/archives/4295 […]

  5. 2023년 8월 20일

    … [Trackback]

    […] Read More here to that Topic: nblog.syszone.co.kr/archives/4295 […]

  6. 2023년 8월 22일

    … [Trackback]

    […] Here you will find 22242 more Information to that Topic: nblog.syszone.co.kr/archives/4295 […]

  7. 2023년 8월 26일

    … [Trackback]

    […] Find More Info here on that Topic: nblog.syszone.co.kr/archives/4295 […]

  8. 2023년 9월 1일

    … [Trackback]

    […] Information on that Topic: nblog.syszone.co.kr/archives/4295 […]

  9. 2023년 9월 9일

    … [Trackback]

    […] Information to that Topic: nblog.syszone.co.kr/archives/4295 […]

  10. 2023년 9월 11일

    … [Trackback]

    […] There you will find 30790 additional Info on that Topic: nblog.syszone.co.kr/archives/4295 […]

  11. 2023년 10월 13일

    … [Trackback]

    […] Info on that Topic: nblog.syszone.co.kr/archives/4295 […]

  12. 2023년 11월 2일

    … [Trackback]

    […] Info on that Topic: nblog.syszone.co.kr/archives/4295 […]

  13. 2023년 11월 12일

    … [Trackback]

    […] There you can find 21413 more Information to that Topic: nblog.syszone.co.kr/archives/4295 […]

  14. 2023년 11월 16일

    … [Trackback]

    […] Read More Information here to that Topic: nblog.syszone.co.kr/archives/4295 […]

  15. 2023년 12월 3일

    … [Trackback]

    […] Find More Info here on that Topic: nblog.syszone.co.kr/archives/4295 […]

  16. 2023년 12월 6일

    … [Trackback]

    […] Read More on that Topic: nblog.syszone.co.kr/archives/4295 […]

  17. 2023년 12월 20일

    … [Trackback]

    […] Find More Info here on that Topic: nblog.syszone.co.kr/archives/4295 […]

  18. 2023년 12월 25일

    … [Trackback]

    […] Read More Information here on that Topic: nblog.syszone.co.kr/archives/4295 […]

  19. 2023년 12월 28일

    … [Trackback]

    […] Read More here to that Topic: nblog.syszone.co.kr/archives/4295 […]

  20. 2024년 2월 14일

    … [Trackback]

    […] Read More Info here to that Topic: nblog.syszone.co.kr/archives/4295 […]

  21. 2024년 2월 16일

    … [Trackback]

    […] Read More here on that Topic: nblog.syszone.co.kr/archives/4295 […]

  22. 2024년 2월 17일

    … [Trackback]

    […] Find More here on that Topic: nblog.syszone.co.kr/archives/4295 […]

  23. 2024년 3월 1일

    … [Trackback]

    […] Information on that Topic: nblog.syszone.co.kr/archives/4295 […]

  24. 2024년 3월 21일

    … [Trackback]

    […] Find More on on that Topic: nblog.syszone.co.kr/archives/4295 […]

페이스북/트위트/구글 계정으로 댓글 가능합니다.