glusterfs

git clone git://git.gluster.com/glusterfs.git

yum install gcc autoconf automake libtool flex openssl* bison

./autogen.sh

./configure

make

make install

mkdir /usr/local/include/glusterfs/

cp glusterfs/libglusterfs/src/*.h /usr/local/include/glusterfs/

cp glusterfs/config.h /usr/local/include/glusterfs/

cp glusterfs/contrib/uuid/uuid.h /usr/local/include/glusterfs/

 

 

 

 qemu

 yum install glib2-devel

 yum install libuuid-devel

 

 ./configure --disable-werror --target-list=x86_64-softmmu --enable-glusterfs --enable-uuid

 ./configure --disable-werror --target-list=x86_64-softmmu --enable-glusterfs

 

 GlusterFS support yes

 

 make

 make install

vim /etc/profile

export QEMU_HOME=/usr/local/qemu

export PATH=${QEMU_HOME}:${PATH}

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

source /etc/profile


ln -s ${QEMU_HOME}/bin/qemu-system-x86_64 /usr/bin/kvm

modprobe kvm

modprobe kvm_intel



qemu-system-x86_64 -enable-kvm -nographic -smp 4 -m 2048 -drive file=gluster://172.21.80.156/testVol/centos.raw,if=virtio,cache=none -vnc :5


돌아다니다가 외국에서 어떤 구루삘 나는 사람이 쓰길래...

일단 기록해놓음.

wget http://brick.kernel.dk/snaps/fio-2.0.10.tar.bz2

bzip2 -d fio-2.0.10.tar.bz2

tar xvf fio-2.0.10.tar

yum install libaio-devel

make && make install


vim random-read-test.fio

[random-read]

rw=randread

size=128m

directory=/data1

fio random-read-test.fio


https://www.linux.com/learn/tutorials/442451-inspecting-disk-io-performance-with-fio/

GlusterFS에서 Volume을 만들었다가 다른 Volume으로 이전 사용했던 Brick을 다시 사용하려고 할 경우,

${brick_path} or a prefix of it is already part of a volume

이와 같은 에러가 뜬다.

해결 방법은,

setfattr -x trusted.glusterfs.volume-id $brick_path
setfattr -x trusted.gfid $brick_path
rm -rf $brick_path/.glusterfs

자세한 내용은 아래 블로그를 참고.

http://joejulian.name/blog/glusterfs-path-or-a-prefix-of-it-is-already-part-of-a-volume/



[root@bharata ~]# qemu-img create gluster://bharata:0/test/F17-new?transport=socket 5G 

[root@bharata ~]# qemu-system-x86_64 --enable-kvm -m 1024 -smp 4 -drive file=gluster://bharata


출처 : http://www.gluster.org/2012/09/using-qemu-to-boot-vm-image-on-glusterfs-volume/


그 동안 Beta 였던 3.3 버전이 드디어 정식버전으로 릴리즈 되었다.

아래는 3.3 버전에서의 새로워 진 점이다.

Hadoop , Openstack의 Swift와 연동과 replicated+striped 볼륨 타입을 지원하는게 눈에 띈다.


New features

    • Unified File & Object access.
    • Hadoop hooks - HDFS compatibility layer

New Volume Type

    • Repstr - replicated + striped (+ distributed) volumes

Enhancements to Distributed volumes (DHT translator)

    • Rebalance can migrate open files
    • Remove-brick can migrate data to remaining bricks

Enhancements to Replicated volumes (AFR translator)

    • Ability to change replica count on an active volume (possibly including ability to add replication to distribute-only volumes)
    • Granular locking - useful for running VM images needing to be healed. Glusterfs will not have to lock & freeze the whole VM disk image, only the parts that need healing.
    • Proactive self-heal - when a brick comes back online the gluster daemon should begin the self-heal process without waiting for the files to be accessed.
    • Round-trip reduction - should improve performance especially for smaller files.
    • Quorum enforcement - should help resolve or avoid split brain scenarios




GlusterFS의 Native Client(FUSE) 로 스토리지를 구성하여 VM을 생성하려 했으나,

아래처럼 Libvirt에서 실패...

Libvirt 로그

qemu: could not open disk image /mnt/gluster/test-vol2: Invalid argument


이유는, FUSE 모듈이 마운트된 FUSE기반 파일시스템상의 디스크 이미지를 열기 위한 O_DIRECT system call을 지원하지 않기 때문이다.

Gluster에서 fuse 모듈을 다운받고 compile / install을 하면 된다.

http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/

qemu-kvm은 raw 디스크 이미지를 열기 위해 O_SYNC (cache=writethough)을 사용할 것이다.  qcow2 이미지는 O_DIRECT (cache=none)을 사용한다.

http://thr3ads.net/gluster-users/2010/09/477455-Failed-on-booting-qcow2-image-files-on-glusterfs



libvirt disk option "cache=none" prevents VM from booting on GlusterFS/FUSE

"cache=none" 을 제거하라.

https://bugs.launchpad.net/nova/+bug/959637




GlusterFS 에는 Replication 기능이 있다. (볼륨 구성시 Replica 옵션)
물론 같은 클러스터에 있는 서버들끼리만이다.

하지만 Geo-Replication 기능은 기존 같은클러스터 뿐만 아니라, LAN 이나 WAN 상에 존재하는 다른 서버에도 Replication을 할 수 있도록 한다.
또한 Replicated Volumes 는 동기적인 Replication(모든 , 각각의 파일 동작이 모든 bricks에게 보내짐) 이지만, Geo-Replication는 비동기적인 Replication(파일들에서의 변경을 정기적으로 체크하고 변화된 것을 체크해서 동기화) 이다.
GlusterFS 최신버전에 포함된 기능이다.(현재 3.2)

기본적으로 Master - Slave 라는 개념으로 메뉴얼에는 설명이 되어있다.
Master (Target) - Slave (Destination)


1. 초기 설정
@ 시간 동기화
@ SSH 암호없이 접속하도록 설정 ( Master -> Slave )
# ssh-keygen -f /etc/glusterd/geo-replication/secret.pem
# (엔터계속)
개인키를 생성해서 이 개인키로 접속을 한다.
ssh 명령은 
# gluster volume geo-replication <MASTER> <SLAVE> config
으로 확인가능하다.

@ FUSE 모듈 로드

2. 시작
# gluster volume geo-replication <MASTER> <SLAVE> start
ex) gluster volume geo-replication tar-volume 172.22.22.3:geo-volume start

# gluster volume geo-replication <MASTER> <SLAVE> status
faulty 가 떴다면 에러가 난 것이다.
# gluster volume geo-replication <MASTER> <SLAVE> config log_file
을 해서 해당 로그 파일을 보면 된다.
 
클라우드 컴퓨팅 환경에서는 데이터를 저장하는 스토리지 선정이 무엇보다 중요하다.
데이터를 분산 복제(Distribute - Replication) 저장해서 안정성을 높이고 저장공간을 확장(Scale-Out)할 수 있는 것이 기본이다.
현재 오픈소스로 나와있는 제품들이 여러가지가 있다.
아직은 살펴보는 단계이니 간단하게나마 기록해놓는다.



 - GlusterFS는 Scale-Out(확장가능)한 NAS(Network Attached Storage) 파일 시스템이다. 다양한 스토리지 서버를 Ethernet이나 Infiniteband RDMA 방식으로 하나의 큰 네트워크 파일시스템으로 모은다. GlusterFS는 성능저하없이 축적가능한 사용자 공간 디자인을 기반으로 한다. 클라우딩 컴퓨팅, 생물의학, 자료저장소등을 포함한 다양한 어플리케이션에서 쓰이고 있다. GlusterFS는 GNU AGPL v3 라이센스에 따라 무료 소프트웨어이다. 

- GlusterFS는 클라이언트와 서버로 구성된다. 서버는 일반적으로 Brick 이라는 형태로 제공이 되고, 각 서버들은 glusterfsd 데몬을 실행을 하여 로컬 파일 시스템을 volume으로 export한다. 클라이언트는 TCP/IP, InfiniBand, SDP를 통해 서버로 연결을 하고 원격서버들로부터 virtual volume을 구성한다. 
(Wiki 정의 참고 http://en.wikipedia.org/wiki/GlusterFS)

- 특징
* metadata server를 필요로 하지 않는다.
 분산 파일 시스템에서  파일정보등을 기억하기 위해 metadata server를 이용하는데 (hadoop 의 경우), 이 경우 metadata server가 문제가 생길경우 장애가 발생하게 된다. GlusterFS의 경우 파일정보등을 각 서버마다 가지고 있으므로 별도의 metadata server를 필요로 하지 않는다.

* 클라이언트 방식 
 volume을 마운트하는 방식으로 NFS, CIFS, Gluster Native(FUSE) 방식을 제공한다.
 
NFS로 마운트
#mount -t nfs [볼륨위치] [마운트위치]
#mount -t nfs 123.12.12.12:/test-volume /mnt/nfs



Gluster Native(FUSE)로 마운트
#mount -t glusterfs [볼륨위치] [마운트위치]
#mount -t glusterfs 1223.12.12.12:/test-volume /mnt/nfs




일반적으로 NFS 보다 FUSE로 마운트시 성능이 잘 나온다고 한다.
단, 작은 파일에서는 NFS의 캐시 영향을 받아서 성능이 더 잘나온다고 한다.
무엇보다,
NFS로 마운트시 마운트한 서버가 죽어버리면 해당 볼륨에 접근할수가 없다.
하지만, FUSE로 마운트시 마운트한 서버가 죽어도 해당 볼륨(나머지 Brick)에 접근할수있다.
이때문에 Relication을 설정이 필요하다.


* 파일기반의 replication, striping, load balancing
 replication 옵션을 주어 volume을 구성하게 되면 파일들을 복제 저장할 수 있다. 이 경우 서버 한곳이 고장나도 다른 곳의 서버에서 데이터를 가지고 오면 되므로 안정성이 높아진다. stripe 옵션을 주면 파일이 분산 저장이 된다. A라는 파일이 1번 서버에만 저장되는것이 아니라 1번 서버에 조금, 2번서버에 조금 이런 식으로 저장이 되게 된다. 일반적으로 stripe 옵션을 주면 속도는 빨라지나 안정성이 떨어진다고 얘기를 한다.
 
* volume failover, scheduling, disk caching

인스톨 가이드를 참고. (http://download.gluster.com/pub/gluster/glusterfs/3.2/3.2.0/Gluster_FS_3.2_Installation_Guide.pdf)

다운로드 : http://download.gluster.com/pub/gluster/glusterfs/LATEST/


1. 편의상 /etc/hosts에 모든 GlusterFS Node들의 host정보 등록
IP주소 GFS1
IP주소 GFS2
...
 이때, 모든 GlusterFS Node 에 위와 같이 해줘야 한다.
 그렇지 않으면 볼륨 생성시 Fail 이 난다. (로그를 보면 호스트를 확인하지 못했다고 뜬다.)

2. Setting
  • iptables off
    • # chkconfig iptables off
    • # service iptables stop
  • portmap on
    • # chkconfig portmap on
    • # service portmap start
  • nfs-server off
    • # chkconfig nfs off
    • # chkconfig nfslock off
    • # service nfs stop
    • # service nfslock stop
  • mount point 생성
    • # mkdir /data /mnt/nfs /mnt/glusterfs
  • fuse 모듈 로딩 처리
    • # modprobe fuse
    • # echo "modprobe fuse" >> /etc/rc.local

  •  @ nfs 로 마운트시 버전을 넣어줘야함. 왜 그런지는 아직..
     mount -t nfs -o vers=3 172.21.19.113:/test-vol /mnt/nfs/

    3. glusterfs로 시작되는 rpm 다운로드
    # wget http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-core-3.2.3-1.x86_64.rpm http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-debuginfo-3.2.3-1.x86_64.rpm http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-fuse-3.2.3-1.x86_64.rpm http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-geo-replication-3.2.3-1.x86_64.rpm http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-rdma-3.2.3-1.x86_64.rpm

    4. rpm 설치
    # rpm -Uvh gluster*
    - 의존성 에러 나는 것은 설치해줌 (python-ctypes, rsync, libibverbs-devel)
    - python-ctypes 경우, epel 설치로 가능 : http://fedoraproject.org/wiki/EPEL
    - rsync 경우, 직접 설치 : http://pkgs.repoforge.org/rsync/
    - CentOS 6 인경우 perl 설치, ssh클라이언트가 없을경우 openssh-clients 설치(의존성에러 compat-readline5* 도 설치)
    5. gluster 시작
    -  service glusterd start

    + Recent posts