스토리지 설정 · 6 min read · Jan 10, 2026
Debian Wheezy에서 GlusterFS 3.2.x로 고가용성 스토리지 설정 - 두 스토리지 서버 간의 자동 파일 복제(미러)
이 튜토리얼에서는 GlusterFS를 사용하는 두 개의 스토리지 서버(Debian Wheezy)로 고가용성 스토리지를 설정하는 방법을 보여줍니다. 각 스토리지 서버는 다른 스토리지 서버의 미러가 되며, 파일은 두 스토리지 서버 간에 자동으로 복제됩니다. 클라이언트 시스템(Debian Wheezy 또한)은 로컬 파일 시스템처럼 스토리지에 접근할 수 있습니다. 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 Wheezy의 패키지로 제공되므로 다음과 같이 설치할 수 있습니다:
apt-get install glusterfs-server명령어
glusterfsd --version이제 방금 설치한 GlusterFS 버전이 표시되어야 합니다(이 경우 3.2.7):
root@server1:~# glusterfsd --version
glusterfs 3.2.7 built on Nov 12 2012 19:30:08
Repository revision: git://git.gluster.com/glusterfs.git
Copyright (c) 2006-2011 Gluster Inc.
GlusterFS는 전혀 보증이 없습니다.
GNU 일반 공중 라이센스 조건에 따라 GlusterFS의 복사본을 재배포할 수 있습니다.
root@server1:~# 방화벽을 사용하는 경우, server1.example.com 및 server2.example.com에서 TCP 포트 111, 24007, 24008, 24009-(모든 볼륨에 걸쳐 있는 브릭 수) 가 열려 있는지 확인하십시오.
다음으로 server2.example.com을 신뢰할 수 있는 스토리지 풀에 추가해야 합니다(모든 GlusterFS 구성 명령을 server1.example.com에서 실행하고 있지만, server2.example.com에서도 실행할 수 있습니다. 구성은 GlusterFS 노드 간에 복제되므로 올바른 호스트 이름이나 IP 주소를 사용해야 합니다):
server1.example.com:
server1.example.com에서 다음을 실행합니다:
gluster peer probe server2.example.comroot@server1:~# gluster peer probe server2.example.com
Probe successful
root@server1:~#신뢰할 수 있는 스토리지 풀의 상태는 이제 다음과 유사해야 합니다:
gluster peer statusroot@server1:~# gluster peer status
Number of Peers: 1Hostname: server2.example.com
Uuid: d19cb707-7b23-4d11-8e9c-183cd0a18d96
State: Peer in Cluster (Connected)
root@server1:~#다음으로 /data 디렉토리에서 두 개의 복제본을 가진 testvol이라는 공유를 생성합니다(이 경우 복제본 수는 서버 수와 같아야 합니다. 왜냐하면 미러링을 설정하고 싶기 때문입니다):
gluster volume create testvol replica 2 transport tcp server1.example.com:/data server2.example.com:/dataroot@server1:~# gluster volume create testvol replica 2 transport tcp server1.example.com:/data server2.example.com:/data
Creation of volume testvol has been successful. Please start the volume to access data.
root@server1:~#볼륨을 시작합니다:
gluster volume start testvol위의 명령이 성공하지 못했다고 알려줄 수 있습니다:
root@server1:~# gluster volume start testvol
Starting volume testvol has been unsuccessful
root@server1:~#이 경우…
server1.example.com/server2.example.com:
netstat -tap | grep glusterfsd두 서버에서 확인하십시오.
이와 같은 출력이 나타나면…
root@server1:~# netstat -tap | grep glusterfsd
tcp 0 0 *:24009 *:* LISTEN 1548/glusterfsd
tcp 0 0 localhost.localdom:1019 localhost.localdo:24007 ESTABLISHED 1548/glusterfsd
root@server1:~#… 모든 것이 정상입니다. 그러나 출력이 없으면…
root@server2:~# netstat -tap | grep glusterfsd
root@server2:~#… 해당 서버(server2.example.com)에서 GlusterFS 데몬을 재시작하십시오:
server2.example.com:
/etc/init.d/glusterfs-server restart그런 다음…
netstat -tap | grep glusterfsd… 해당 서버에서 다시 확인하십시오 - 이제 다음과 같아야 합니다:
root@server2:~# netstat -tap | grep glusterfsd
tcp 0 0 *:24010 *:* LISTEN 1458/glusterfsd
tcp 0 0 localhost.localdom:1021 localhost.localdo:24007 ESTABLISHED 1458/glusterfsd
root@server2:~#이제 server1.example.com으로 돌아갑니다:
server1.example.com:
다음 명령으로 볼륨의 상태를 확인할 수 있습니다:
gluster volume inforoot@server1:~# gluster volume infoVolume Name: testvol
Type: Replicate
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: server1.example.com:/data
Brick2: server2.example.com:/data
root@server1:~#기본적으로 모든 클라이언트가 볼륨에 연결할 수 있습니다. client1.example.com(= 192.168.0.102)만 접근할 수 있도록 하려면 다음을 실행하십시오:
gluster volume set testvol auth.allow 192.168.0.102IP 주소에 대해 와일드카드를 사용할 수 있으며(예: 192.168.*) 여러 IP 주소를 쉼표로 구분하여 지정할 수 있습니다(예: 192.168.0.102,192.168.0.103).
이제 볼륨 정보는 업데이트된 상태를 보여야 합니다:
gluster volume inforoot@server1:~# gluster volume infoVolume Name: testvol
Type: Replicate
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: server1.example.com:/data
Brick2: server2.example.com:/data
Options Reconfigured:
auth.allow: 192.168.0.102
root@server1:~#3 GlusterFS 클라이언트 설정
client1.example.com:
클라이언트에서 GlusterFS 클라이언트를 다음과 같이 설치할 수 있습니다:
apt-get install glusterfs-client그런 다음 다음 디렉토리를 생성합니다:
mkdir /mnt/glusterfs그게 전부입니다! 이제 다음 명령으로 GlusterFS 파일 시스템을 /mnt/glusterfs에 마운트할 수 있습니다:
mount.glusterfs server1.example.com:/testvol /mnt/glusterfs(위의 명령에서 server1.example.com 대신 server2.example.com을 사용할 수도 있습니다!)
이제 다음의 출력에서 새로운 공유를 확인할 수 있어야 합니다…
mountroot@client1:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
odev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=126813,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=102704k,mode=755)
/dev/mapper/server1-root on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=205400k)
/dev/sda1 on /boot type ext2 (rw,relatime,errors=continue)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
server1.example.com:/testvol on /mnt/glusterfs type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
root@client1:~#… 그리고…
df -hroot@client1:~# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 29G 1.2G 26G 5% /
udev 10M 0 10M 0% /dev
tmpfs 101M 240K 101M 1% /run
/dev/mapper/server1-root 29G 1.2G 26G 5% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 201M 0 201M 0% /run/shm
/dev/sda1 228M 18M 199M 9% /boot
server1.example.com:/testvol 29G 1.2G 26G 5% /mnt/glusterfs
root@client1:~#수동으로 클라이언트에서 GlusterFS 공유를 마운트하는 대신, /etc/fstab을 수정하여 클라이언트 부팅 시 공유가 자동으로 마운트되도록 할 수 있습니다.
/etc/fstab을 열고 다음 줄을 추가합니다:
vi /etc/fstab| [...] server1.example.com:/testvol /mnt/glusterfs glusterfs defaults,_netdev 0 0 |
(다시 말하지만, server1.example.com 대신 server2.example.com을 사용할 수도 있습니다!)
수정된 /etc/fstab이 작동하는지 테스트하려면 클라이언트를 재부팅하십시오:
reboot재부팅 후, 다음의 출력에서 공유를 찾을 수 있어야 합니다…
df -h… 그리고…
mount4 테스트
이제 GlusterFS 공유에서 몇 개의 테스트 파일을 생성해 보겠습니다:
client1.example.com:
touch /mnt/glusterfs/test1
touch /mnt/glusterfs/test2이제 server1.example.com 및 server2.example.com의 /data 디렉토리를 확인해 보겠습니다. test1 및 test2 파일이 각 노드에 존재해야 합니다:
server1.example.com/server2.example.com:
ls -l /dataroot@server1:~# ls -l /data
total 0
-rw-r--r-- 1 root root 0 Sep 30 17:53 test1
-rw-r--r-- 1 root root 0 Sep 30 17:53 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 디렉토리에서 확인할 수 있어야 합니다:
server2.example.com:
ls -l /dataroot@server2:~# ls -l /data
total 8
-rw-r--r-- 1 root root 0 Sep 30 17:53 test1
-rw-r--r-- 1 root root 0 Sep 30 17:54 test3
-rw-r--r-- 1 root root 0 Sep 30 17:54 test4
root@server2:~#이제 server1.example.com을 다시 부팅하고 /data 디렉토리를 확인해 보겠습니다:
server1.example.com:
ls -l /dataroot@server1:~# ls -l /data
total 0
-rw-r--r-- 1 root root 0 Sep 30 17:53 test1
-rw-r--r-- 1 root root 0 Sep 30 17:53 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 Sep 30 17:53 test1
-rw-r--r-- 1 root root 0 Sep 30 17:54 test3
-rw-r--r-- 1 root root 0 Sep 30 17:54 test4
root@client1:~#이제 server1.example.com의 /data 디렉토리를 다시 확인하면 변경 사항이 해당 노드에 복제된 것을 볼 수 있습니다:
server1.example.com:
ls -l /dataroot@server1:~# ls -l /data
total 0
-rw-r--r-- 1 root root 0 Sep 30 17:53 test1
-rw-r--r-- 1 root root 0 Sep 30 17:54 test3
-rw-r--r-- 1 root root 0 Sep 30 17:54 test4
root@server1:~#5 링크
- GlusterFS: http://www.gluster.org/
- GlusterFS 3.2 문서: http://download.gluster.com/pub/gluster/glusterfs/3.2/Documentation/AG/html/index.html
- Debian: http://www.debian.org/
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.