Gluster 파일 시스템 설치하기 -VMWare 상에서 테스트

1. 사전 준비

참고자료

http://www.gluster.com/community/documentation/index.php/Storage_Server_Installation_and_Configuration

http://blogs.sourceallies.com/2009/12/glusterfs-replication-for-clustering/

http://www.scribd.com/doc/36963676/Gluster-Install

http://www.davidodwyer.com/2010/07/04/howto-install-glusterfs-304-rhel-54-debian-lenny

http://www.howtoforge.com/high-availability-storage-with-glusterfs-on-centos-5.4-automatic-file-replication-mirror-across-two-storage-servers

http://www.gluster.com/community/documentation/index.php/Main_Page

Setting up a Highly Available Storage Cluster using GlusterFS and UCARP

* 테스트중 3.1의 릴지즈로 마지막 링크만으로 거의 진행

서버 환경 및 기타 준비

– EXSi 위에 5개의 가상머신 준비 – Glusterfs 서버용 4개, Gluster 클라이언트용 1개

– 모두 root 계정으로 작업

EXSi & RHEL5.5 사전 준비

EXSi 4.1에서 가상머신으로 RHEL 설치시 vmtool 설치방법

guest 메뉴에서 install/upgrade vmtool 메뉴 선택하면 rhel vm 에 마운트됨

VMwareTools-~~.tar.gz 를 압축 풀기

>tar -xvzf VMwareTools-~~.tar.gz

>cd vmware-tools-distrib

>su

>./vmware-install.plm

*RHEL yum 리파지토리 변경

>mkdir /repo/Server

>cd /etc/yum.repos.d/

>gedit dvd.repo

  1. [dvd]
  2. name=DVD for RHEL5
  3. baseurl=file:///repo/Server
  4. enabled=1
  5. gpgcheck=0

(RHEL dvd 안의 Server 폴더를 /repo로 복사)

>cd /home/glusterfs/Server/; cp -a * /repo/Server

– 이제 yum 을 사용하면 repo에서 rpm을 읽는다

*네트워크 호스트네임 설정(IP로 사용해도 된다?)

>gedit /etc/hosts

* 모든 서버와 클라이언트에서 공동으로 사용한다, 그냥 모두 아이피를 직접 사용해도 된다..

[...] 
192.168.0.101 server1.example.com server1
192.168.0.102 server2.example.com server2
192.168.0.103 server3.example.com server3
192.168.0.104 server4.example.com server4
192.168.0.2 client1.example.com client1
[...]

2. GlusterFS 3.1 Install

GlusterFS Server Install

의존하는 RPM 설치

>yum -y install wget fuse fuse-libs

RHEL5에 설치 되는 패키지 (wget 은 최신버전임)
fuse-2.7.4-8.el5.x86_64.rpm, fuse-libs-2.7.4-8.el5.i386.rpm
fuse-libs-2.7.4-8.el5.x86_64.rpm
*infiniband의 경우

확인

>ibv_srq_pingpong

Infiniband 인스톨이 안되었다면
a. Download OFED-1.5.2 from http://www.openfabrics.org/downloads/OFED/ofed-1.5.2/
b. Install OFED-1.5.2 and start IB fabric. For more details, see README file in tarball folder.

방화벽 설정

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

아래는 20개의 gluster 서버와 3개의 Brick 이 있을 경우 방화벽 해제 설정 방법

>iptables -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 24007:24011 -j ACCEPT
> iptables -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 111 -j ACCEPT
> iptables -A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 111 -j ACCEPT >$ iptables -A RH->Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 38465:38485 -j ACCEPT
> service iptables save
> service iptables restart

GlusterFS RPM 설치

다운로드

>rpm -Uvh glusterfs-core-3.1.0.x86_64.rpm
> rpm -Uvh glusterfs-fuse-3.1.0.x86_64.rpm

버전 확인

>/usr/sbin/glusterfs -V

서버 시작, 정지 및 자동 시작

시작

>/etc/init.d/glusterd start

정지

>/etc/init.d/glusterd stop

자동시작

>chkconfig glusterd on

NFS, CIFS(SMB) 설치

NFS

3.1 버전부터 Native NFS 를 사용할 수 있으므로 따로 설치할 필요가 없다

CIFS

패키지 설치
>rpm -Uvh perl-Convert-ASN1-0.20-1.1.noarch.rpm
> rpm -Uvh samba-3.0.33-3.28.el5.x86_64.rpm

또는 yum 설치
>yum install samba

>gedit /etc/samba/smb.conf 에 아래 내용 추가

[test]
comment = Sample export via SAMBA
valid users = user3
printable = no
writable = yes
public = no
path = /mnt/gluster/user3_data
posix locking = yes
  • smb.conf 의 기본 내용의 주석 (;) 들을 제거하여 이용하거나 인터넷을 검색하여 작성하고 위의내용을 추가
  • [global] 에 아래 옵션을 추가하면 로컬 랜 상에서 최적의 성능을 발휘

    • socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

samba 사용자 추가 (공유폴더를 사용할 수 있는 유져를 smbuser로 만들어야 한다.)

>smbpasswd -a user3

pw입력

user3가 /mnt/gluster/user3_data 의 권한을 가지고 있어야함 따라서

>chmod 757 /mnt/gluster/user3_data

glusterfs 서버는 /mnt/gluster/ 를 마운트 포이트로 self-mount 하고 그 안에 user3_data 폴더를 생성해야 한다.

만약 고유하려는 폴더가 /home 경로 하위에 있다면 아래를 실행

>setsebool -P samba_enable_home_dirs=1

2. Storage Pool 생성

스토리지 서버 노드로 쓸 서버들을 추가한다 server1에서 수행

* EXSi 관리클라이언트에서 서버를 ovf 템플릿 으로 만들어 여러개를 생성하여 각각 ip를 바꾸고 연결하면 2개 서버까지만 붙고 더이상 붙지 않는다.
아마도 Gluster의 해쉬알고리즘에서 복재된 가상머신의 키값이 잘 생성되지 않는 것으로 생각됨
번거롭지만 매번 새로 생성한 가상머신을 사용해서 스토리지 서버를 구축할 것!
* pool 생성 과 volume 생성시 IP 기반으로 입력해야 함 hosts 파일에 설정된 호스트이름 사용하지 말것! (3.1버전)
* 3.1.1부터 pool 생성 과 volume 생성시 호스트 이름 사용가능 IP 기반으로만 할 필요 없음
Trusted storage pool 생성

>gluster peer probe 192.168.0.102

Probe successful
> gluster peer probe 192.168.0.103
Probe successful
> gluster peer probe 192.168.0.104
Probe successful

storage pool 상태 보기

>gluster peer status

Hostname: 192.168.0.102

Uuid: 5e987bda-16dd-43c2-835b-08b7d55e94e5
State: Peer in Cluster (Connected)

Hostname: 192.168.0.103
Uuid: 1e0ca3aa-9ef7-4f66-8f15-cbc348f29ff7
State: Peer in Cluster (Connected)

Hostname: 192.168.0.104
Uuid: 345de43e-4533-4e33-4f77-ed3984da21ae
State: Peer in Cluster (Connected)

storage pool 에서 빼기

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

3. Volume 관리

글러스터에는 서버 노드와 Brick 이라는 개념이 있는데

서버노드는 Trusted Storage Pools 에 들어가 있는 서버를 의미하며

Brick 은 서버노드 내에 볼륨을 구성할 때 포함하는 폴더를 의미한다 따라서 한 서버노드 내에 많은 Brick이 존제할 수 있다.

Brick은 “서버IP:/폴더주소” 로 구성됨

Volume 생성

Distribute – 기본 생성은 분산옵션으로 생성 됨

>gluster volume create dist 192.168.52.101:/dist 192.168.52.102:/dist 192.168.52.103:/dist 192.168.52.104:/dist

Distributed replicate – 분산 복제 생성

>gluster volume create repl replica 2 192.168.52.101:/repl 192.168.52.102:/repl 192.168.52.103:/repl 192.168.52.104:/repl

Distributed stripe – 분산 스프라이핑 생성 (transport tcp or rdma 는 생략 가능 기본은 tcp)

>gluster volume create dist-stri stripe 2 transport tcp 192.168.52.101:/dist-stri 192.168.52.102:/dist-stri 192.168.52.103:/dist-stri 192.168.52.104:/dist-stri

Stripe

>gluster volume create stripe 2 transport tcp 192.168.52.101:/stri 192.168.52.102:/stri 192.168.52.103:/stri 192.168.52.104:/stri

Volume 시작

>gluster volume start test-volume

Volume 정보 보기

>gluster volume info (all or volume name)

Volume 삭제

>gluster volume delete test-volume (volume name)

Volume 생성 옵션

TCP 랜 사용

> gluster volume create test-volume transport tcp192.168.0.101:/exp1 192.168.0.102:/exp2

InfiniBand 사용

> gluster volume create test-volume transport rdma 192.168.0.101:/exp1 192.168.0.102:/exp2

4. Gluster Native Client Install & Mount

설치전 사전확인

>modprobe fuse
*FUSE module 검증
>dmesg | grep -i fuse
출력 -> fuse init (API version 7.13)

의존하는 RPM 설치

>yum -y install openssh-server wget fuse fuse-libs openib libibverbs

방화벽 설정

>iptables -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 24007 -j ACCEPT
> iptables -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 38465:38467 -j ACCEPT

GlusterFS RPM 설치

You can download the software here

>rpm -Uvh glusterfs-core-3.1.0.x86_64.rpm
> rpm -Uvh glusterfs-fuse-3.1.0.x86_64.rpm

>rpm -Uvh glusterfs-rdma-3.1.0.x86_64.rpm

클라이언트에서 native 마운트

>mkdir /mnt/dist

>mount -t glusterfs server1:/dist /mnt/dist

*다른 포트를 사용하여 glusterfs volume을 마운트할 경우

>mount -t glusterfs server1:7997:/dist /mnt/dist

클라이언트에서 native 자동 마운트

>mkdir /mnt/dist

>gedit /etc/fstab

추가내용
server1:7997:/dist /mnt/dist glusterfs defaults,_netdev 0 0

* 여러 볼륨을 마운트 할경우 반복해서 추가

이후 비슷하게 나옴 (맨아래 glusterfs에 대해 나옴)

>mount

[root@client1 ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
glusterfs#server2:/dist on /mnt/dist type fuse (rw,allow_other,default_permissions,max_read=131072)

마운트 스토리지 정보

> df -h

[root@client1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
29G 2.2G 25G 9% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 187M 0 187M 0% /dev/shm
glusterfs#/etc/glusterfs/glusterfs.vol
28G 2.3G 25G 9% /mnt/dist

클라이언트에서 NFS 마운트

>mkdir /mnt/dist

>mount -t nfs server1:/dist /mnt/dist

*다른 포트를 사용하여 glusterfs volume을 마운트할 경우

>mount -t nfs server1:7997:/dist /mnt/dist

클라이언트에서 NFS 자동 마운트

>mkdir /mnt/dist

>gedit /etc/fstab

추가내용
server1:7997:/dist /mnt/dist nfs defaults,_netdev 0 0

* 여러 볼륨을 마운트 할경우 반복해서 추가

클라이언트 NFS 마운트 에러시 확인

관련 주소

http://europe.gluster.org/community/documentation/index.php/Gluster_3.1:_NFS_Frequently_Asked_Questions

마운트시 아래와 같은 메시지가 나오면

mount: mount to NFS server ‘10.1.10.11’ failed: timed out (retrying).

클라이언트에서 Gluster 서버에 NFS 마운트시 NFS서버(Gluster 서버)는 DHCP를 참조하여 호스트네임을 얻어서 인증을 해준다. DHCP 서버로 관리되지 않는 경우에는 서버의 /etc/hosts 파일에 포함을 시켜둔 서버만이 접속이 가능하다.

클라이언트에서 CIFS 마운트

>mkdir /mnt/glusterfs-cifs

>mount -t cifs -o username=root //192.168.52.105/public /mnt/glustrfs-cifs

클라이언트에서 CIFS 마운트 에러시 확인
  • 서버가 GlusterFS 볼륨을 self-mount 했는지 확인

  • mount error 13 일 경우 계정이 smbpasswd -a user3 로 로그인 계정이 추가 되었는지 확인,

  • mount error 6 일 경우 공유하는 GlusterFS 볼륨 경로 디랙토리에 존재하는지, 계정이 권한을 가지고 있는 지 확인

5. Volume 확장, 줄임 및 노드 추가 삭제

서버 추가

클라이언트에서 마운트 상태 확인

>df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 7.8G 8.8G 48% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 502M 0 502M 0% /dev/shm
glusterfs#server4:/dist
70G 45G 22G 68% /mnt/dist
glusterfs#server4:/repl
35G 24G 11G 70% /mnt/repl

서버 5를 추가

>gluster peer probe 192.168.0.105

볼륨 추가

>gluster volume add-brick dist 192.168.0.105:/dist

*추가시 문제가 있다면 서버를 detach 후 다시 해볼 것

클라이언트에서 상태 확인

>df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 7.8G 8.8G 48% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 502M 0 502M 0% /dev/shm
glusterfs#server4:/dist
87G 52G 32G 62% /mnt/dist
glusterfs#server4:/repl
35G 24G 11G 70% /mnt/repl

볼륨 추가후 리벨런싱

*자동으로 데이터가 리벨런싱 되지 않는 것으로 보임 10분쯤 후에 봐도 변화 없음

>gluster volume rebalance dist start

이후 상태확인

>gluster volume rebalance dist status

완료가 되었다고 나옴

볼륨 줄임

>gluster volume remove-brick 192.168.0.102:/dist

클라이언트에서 상태 확인

>df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 7.8G 8.8G 48% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 502M 0 502M 0% /dev/shm
glusterfs#server4:/dist
70G 39G 27G 60% /mnt/dist
glusterfs#server4:/repl
35G 24G 9.0G 73% /mnt/repl

*분산에서 brick을 빼서 볼륨을 줄이면 데이터가 날아간다.

각종 테스트

생성한 volume 마운트는 누가?

Native 마운트시 Volume에 속하지 않는 gluster trusted pool 에 속한 서버 아무곳에나 마운트 하면 된다.

분산 볼륨에서 노드 고장시 상황

볼륨에 장애가 잠시 있다가 볼륨을 줄인 것과 같이 된다.

노드를 다시 살리면 다시 복귀된다.

미러 분산에서 노드 고장시 상황

노드가 실패도 잘된고 첫번째 두번째, 세번째 네번째 쌍으로 묶인다.

클라이언트에서 마운트시 특정 서버를 지정하는데 미러의 경우에도 그 서버가 죽으면 마운트가 깨진다
물론, 다시 살리면 된다. 즉 클라이언트에서 Mount Fail Over를 지원하지 않는다.

다른 Gluster Server Pool에 속해있는 Server를 Pool에 포함하면

~ is already part of another cluster 이라고 나오면서 추가 안됨

GlusterFS 서버 초기화 하려면

/etc/glusterd 폴더 내 데이터들을 삭제하고

>/etc/int.d/glusterd restart

그래도 안되면 /etc/glusterd 폴더 내 데이터들을 삭제하고 다시 설치 (아래 rpm 제거 할 것)

>rpm -e glusterfs-core-3.1.0-1

>rpm -e gusterfs-fust-3.1.0-1

분산, 미러, 스트라이핑 옵션별 테스트 및 파일 저장 형태

서버 노드 4대 를 사용해 동일한 환경에서 테스트

584MB 용량의 파일 15 개 (대용량 580.9MB파일 포함)

* 걸린시간 확인

>time cp -r /root/test/ /mnt/dist

서진우

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

You may also like...

31 Responses

  1. 2023년 6월 13일

    … [Trackback]

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

  2. 2023년 6월 13일

    … [Trackback]

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

  3. 2023년 7월 5일

    … [Trackback]

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

  4. 2023년 7월 19일

    … [Trackback]

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

  5. 2023년 7월 21일

    … [Trackback]

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

  6. 2023년 7월 21일

    … [Trackback]

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

  7. 2023년 7월 28일

    … [Trackback]

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

  8. 2023년 8월 13일

    … [Trackback]

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

  9. 2023년 8월 14일

    … [Trackback]

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

  10. 2023년 8월 18일

    … [Trackback]

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

  11. 2023년 9월 1일

    … [Trackback]

    […] There you can find 83612 additional Information to that Topic: nblog.syszone.co.kr/archives/4262 […]

  12. 2023년 9월 18일

    … [Trackback]

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

  13. 2023년 10월 23일

    … [Trackback]

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

  14. 2023년 11월 8일

    … [Trackback]

    […] Find More to that Topic: nblog.syszone.co.kr/archives/4262 […]

  15. 2023년 11월 13일

    … [Trackback]

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

  16. 2023년 11월 14일

    … [Trackback]

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

  17. 2023년 11월 14일

    … [Trackback]

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

  18. 2023년 11월 17일

    … [Trackback]

    […] Find More to that Topic: nblog.syszone.co.kr/archives/4262 […]

  19. 2023년 12월 3일

    … [Trackback]

    […] Info to that Topic: nblog.syszone.co.kr/archives/4262 […]

  20. 2023년 12월 11일

    … [Trackback]

    […] Here you can find 10392 more Information to that Topic: nblog.syszone.co.kr/archives/4262 […]

  21. 2024년 1월 24일

    … [Trackback]

    […] Find More to that Topic: nblog.syszone.co.kr/archives/4262 […]

  22. 2024년 2월 3일

    … [Trackback]

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

  23. 2024년 2월 14일

    … [Trackback]

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

  24. 2024년 2월 29일

    … [Trackback]

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

  25. 2024년 3월 1일

    … [Trackback]

    […] There you can find 41350 additional Information to that Topic: nblog.syszone.co.kr/archives/4262 […]

  26. 2024년 3월 4일

    … [Trackback]

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

  27. 2024년 3월 13일

    … [Trackback]

    […] Find More to that Topic: nblog.syszone.co.kr/archives/4262 […]

  28. 2024년 3월 23일

    … [Trackback]

    […] There you will find 78924 more Information to that Topic: nblog.syszone.co.kr/archives/4262 […]

  29. 2024년 4월 6일

    … [Trackback]

    […] Info to that Topic: nblog.syszone.co.kr/archives/4262 […]

  30. 2024년 4월 13일

    … [Trackback]

    […] There you will find 56142 additional Information to that Topic: nblog.syszone.co.kr/archives/4262 […]

  31. 2024년 4월 19일

    … [Trackback]

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

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