고가용성 스토리지 · 5 min read · Jan 12, 2026
Debian Squeeze에서 GlusterFS 3.0.x로 고가용성 스토리지 설정하기 - 두 스토리지 서버 간의 자동 파일 복제
이 튜토리얼에서는 GlusterFS를 사용하는 두 개의 스토리지 서버(Debian Squeeze)로 고가용성 스토리지를 설정하는 방법을 보여줍니다. 각 스토리지 서버는 다른 스토리지 서버의 미러가 되며, 파일은 두 스토리지 서버 간에 자동으로 복제됩니다. 클라이언트 시스템(Debian Squeeze)도 로컬 파일 시스템처럼 스토리지에 접근할 수 있습니다. GlusterFS는 여러 페타바이트로 확장할 수 있는 클러스터 파일 시스템입니다. Infiniband RDMA 또는 TCP/IP 상의 다양한 스토리지 브릭을 하나의 대규모 병렬 네트워크 파일 시스템으로 집계합니다. 스토리지 브릭은 SATA-II RAID 및 Infiniband HBA가 장착된 x86_64 서버와 같은 일반 하드웨어로 구성될 수 있습니다.
이것이 당신에게 작동할 것이라는 보장은 하지 않습니다!
1 사전 참고
이 튜토리얼에서는 세 개의 시스템, 두 개의 서버와 하나의 클라이언트를 사용합니다:
- server1.example.com: IP 주소 192.168.0.100 (서버)
- server2.example.com: IP 주소 192.168.0.101 (서버)
- client1.example.com: IP 주소 192.168.0.102 (클라이언트)
세 시스템 모두 서로의 호스트 이름을 해석할 수 있어야 합니다. DNS를 통해 이를 수행할 수 없다면, /etc/hosts 파일을 편집하여 세 시스템 모두 다음과 같이 보이도록 해야 합니다:
vi /etc/hosts| 127.0.0.1 localhost.localdomain localhost 192.168.0.100 server1.example.com server1 192.168.0.101 server2.example.com server2 192.168.0.102 client1.example.com client1 # 다음 줄은 IPv6 지원 호스트에 대해 바람직합니다 ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts |
(다음 설정에서 호스트 이름 대신 IP 주소를 사용하는 것도 가능합니다. IP 주소를 사용하려면 호스트 이름이 해석될 수 있는지 여부에 대해 걱정할 필요가 없습니다.)
2 GlusterFS 서버 설정
server1.example.com/server2.example.com:
GlusterFS는 Debian Squeeze용 패키지로 제공되므로, 다음과 같이 설치할 수 있습니다:
apt-get install glusterfs-server명령어
glusterfs --version이제 방금 설치한 GlusterFS 버전(이 경우 3.0.5)이 표시되어야 합니다:
root@server1:~# glusterfs --version
glusterfs 3.0.5 built on Jul 13 2010 16:44:21
Repository revision: v3.0.5
Copyright (c) 2006-2009 Gluster Inc.
GlusterFS는 전혀 보증이 없습니다.
GNU 일반 공공 라이센스의 조건에 따라 GlusterFS의 복사본을 재배포할 수 있습니다.
root@server1:~# 다음으로 몇 개의 디렉토리를 생성합니다:
mkdir /data/
mkdir /data/export
mkdir /data/export-ns이제 GlusterFS 서버 구성 파일 /etc/glusterfs/glusterfsd.vol를 생성합니다(먼저 원본 /etc/glusterfs/glusterfsd.vol 파일의 백업을 만듭니다) 이 파일은 어떤 디렉토리가 내보내질 것인지(/data/export)와 어떤 클라이언트가 연결할 수 있는지를 정의합니다(192.168.0.102 = client1.example.com):
cp /etc/glusterfs/glusterfsd.vol /etc/glusterfs/glusterfsd.vol_orig
cat /dev/null > /etc/glusterfs/glusterfsd.vol
vi /etc/glusterfs/glusterfsd.vol| volume posix type storage/posix option directory /data/export end-volume volume locks type features/locks subvolumes posix end-volume volume brick type performance/io-threads option thread-count 8 subvolumes locks end-volume volume server type protocol/server option transport-type tcp option auth.addr.brick.allow 192.168.0.102 subvolumes brick end-volume |
IP 주소에 와일드카드를 사용할 수 있으며(예: 192.168.*) 여러 IP 주소를 쉼표로 구분하여 지정할 수 있습니다(예: 192.168.0.102,192.168.0.103).
그 후 GlusterFS 서버를 시작합니다:
/etc/init.d/glusterfs-server start3 GlusterFS 클라이언트 설정
client1.example.com:
클라이언트에서 GlusterFS 클라이언트를 다음과 같이 설치할 수 있습니다:
apt-get install glusterfs-client그런 다음 다음 디렉토리를 생성합니다:
mkdir /mnt/glusterfs다음으로 파일 /etc/glusterfs/glusterfs.vol를 생성합니다(먼저 원본 /etc/glusterfs/glusterfs.vol 파일의 백업을 만듭니다):
cp /etc/glusterfs/glusterfs.vol /etc/glusterfs/glusterfs.vol_orig
cat /dev/null > /etc/glusterfs/glusterfs.vol
vi /etc/glusterfs/glusterfs.vol| volume remote1 type protocol/client option transport-type tcp option remote-host server1.example.com option remote-subvolume brick end-volume volume remote2 type protocol/client option transport-type tcp option remote-host server2.example.com option remote-subvolume brick end-volume volume replicate type cluster/replicate subvolumes remote1 remote2 end-volume volume writebehind type performance/write-behind option window-size 1MB subvolumes replicate end-volume volume cache type performance/io-cache option cache-size 512MB subvolumes writebehind end-volume |
옵션 remote-host 줄에 올바른 서버 호스트 이름이나 IP 주소를 사용해야 합니다!
그게 다입니다! 이제 다음 두 명령 중 하나를 사용하여 GlusterFS 파일 시스템을 /mnt/glusterfs에 마운트할 수 있습니다:
glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs또는
mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs이제 다음의 출력에서 새로운 공유를 볼 수 있어야 합니다…
mountroot@client1:~# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/etc/glusterfs/glusterfs.vol on /mnt/glusterfs type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)
root@client1:~#… 그리고…
df -hroot@client1:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 29G 778M 27G 3% /
tmpfs 249M 0 249M 0% /lib/init/rw
udev 244M 100K 244M 1% /dev
tmpfs 249M 0 249M 0% /dev/shm
/etc/glusterfs/glusterfs.vol
18G 848M 16G 5% /mnt/glusterfs
root@client1:~#( server1.example.com과 server2.example.com 각각 GlusterFS 파일 시스템을 위한 18GB의 공간을 가지고 있지만, 데이터가 미러링되기 때문에 클라이언트는 36GB(2 x 18GB)가 아닌 18GB만 볼 수 있습니다.)
클라이언트에서 GlusterFS 공유를 수동으로 마운트하는 대신, /etc/fstab을 수정하여 클라이언트가 부팅할 때 공유가 자동으로 마운트되도록 할 수 있습니다.
/etc/fstab을 열고 다음 줄을 추가합니다:
vi /etc/fstab| [...] /etc/glusterfs/glusterfs.vol /mnt/glusterfs glusterfs defaults,_netdev 0 0 |
수정된 /etc/fstab이 작동하는지 테스트하려면 클라이언트를 재부팅합니다:
reboot재부팅 후, 다음의 출력에서 공유를 찾을 수 있어야 합니다…
df -h… 그리고…
mount/etc/fstab을 수정해도 도움이 되지 않으면, /etc/fstab의 변경 사항을 되돌리고 대신 /etc/rc.local에 이 줄을 추가합니다(0으로 종료하기 전에):
vi /etc/rc.local| [...] /bin/mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs [...] |
이렇게 하면 네트워크가 활성화된 후 공유가 마운트됩니다.
4 테스트
이제 GlusterFS 공유에 테스트 파일을 생성해 보겠습니다:
client1.example.com:
touch /mnt/glusterfs/test1
touch /mnt/glusterfs/test2이제 server1.example.com 및 server2.example.com의 /data/export 디렉토리를 확인해 보겠습니다. test1 및 test2 파일이 각 노드에 존재해야 합니다:
server1.example.com/server2.example.com:
ls -l /data/exportroot@server1:~# ls -l /data/export
total 0
-rw-r--r-- 1 root root 0 2012-03-29 14:51 test1
-rw-r--r-- 1 root root 0 2012-03-29 14:51 test2
root@server1:~#이제 server1.example.com을 종료하고 client1.example.com의 GlusterFS 공유에서 파일을 추가/삭제합니다.
server1.example.com:
shutdown -h nowclient1.example.com:
touch /mnt/glusterfs/test3
touch /mnt/glusterfs/test4
rm -f /mnt/glusterfs/test2변경 사항은 server2.example.com의 /data/export 디렉토리에서 확인할 수 있어야 합니다:
server2.example.com:
ls -l /data/exportroot@server2:~# ls -l /data/export
total 0
-rw-r--r-- 1 root root 0 2012-03-29 14:51 test1
-rw-r--r-- 1 root root 0 2012-03-29 14:52 test3
-rw-r--r-- 1 root root 0 2012-03-29 14:52 test4
root@server2:~#server1.example.com을 다시 부팅하고 /data/export 디렉토리를 확인해 보겠습니다:
server1.example.com:
ls -l /data/exportroot@server1:~# ls -l /data/export
total 0
-rw-r--r-- 1 root root 0 2012-03-29 14:51 test1
-rw-r--r-- 1 root root 0 2012-03-29 14:51 test2
root@server1:~#보시다시피, server1.example.com은 다운되어 있는 동안 발생한 변경 사항을 인식하지 못했습니다. 이를 쉽게 수정할 수 있으며, 클라이언트에서 GlusterFS 공유에 대한 읽기 명령을 호출하기만 하면 됩니다. 예:
client1.example.com:
ls -l /mnt/glusterfs/root@client1:~# ls -l /mnt/glusterfs/
total 8
-rw-r--r-- 1 root root 0 2012-03-29 14:51 test1
-rw-r--r-- 1 root root 0 2012-03-29 14:52 test3
-rw-r--r-- 1 root root 0 2012-03-29 14:52 test4
root@client1:~#이제 다시 server1.example.com의 /data/export 디렉토리를 확인해 보세요. 변경 사항이 해당 노드에 복제되었음을 확인할 수 있습니다:
server1.example.com:
ls -l /data/exportroot@server1:~# ls -l /data/export
total 8
-rw-r--r-- 1 root root 0 2012-03-29 14:51 test1
-rw-r--r-- 1 root root 0 2012-03-29 14:52 test3
-rw-r--r-- 1 root root 0 2012-03-29 14:52 test4
root@server1:~#5 링크
- GlusterFS: http://www.gluster.org/
- Debian: http://www.debian.org/
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.