glusterfs 快速安裝配置

安裝的機器爲兩臺 centOS 6.4 X86_64的機器。


首先安裝gluster
分佈在兩臺機器做如下操作:

創建一個glusterfs.repo 文件在 /etc/yum.repo.d/下
[glusterfs]
name=glusterfs
baseurl=http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.2/RHEL/epel-6/x86_64/
enable=1
gpgcheck=0

修改 /etc/resolv.conf 爲
; generated by /sbin/dhclient-script
search openstacklocal
nameserver 8.8.8.8

注: 8.8.8.8 爲google的dsn服務器地址 (霸氣的ip。。。)

yum安裝
yum install glusterfs-server

配置glusterfs;
配置的目標是在 glusterfs文件系統中有兩個文件夾掛載點

首先是讓glusterfs的兩臺機器建立通信:
[root@host-10-0-32-16 ~]# gluster peer probe 10.0.32.15
Probe successful
然後是創建本地文件夾,分佈在兩臺機器上執行
shell>mkdir /root/glusterfs-folder1
shell>mkdir /root/glusterfs-folder2
注:文件夾位置和名稱任意
之後是創建卷
[root@host-10-0-32-16 ~]# gluster volume create vol1 10.0.32.16:/root/gluster-folder1 10.0.32.15:/root/gluster-folder1
Creation of volume vol1 has been successful. Please start the volume to access data.
[root@host-10-0-32-16 ~]# gluster volume start vol1
Starting volume vol1 has been successful
[root@host-10-0-32-16 ~]# gluster volume create replic 2 vol2 10.0.32.16:/root/gluster-folder2 10.0.32.15:/root/gluster-folder2
Creation of volume vol2 has been successful. Please start the volume to access data.
[root@host-10-0-32-16 ~]# gluster volume start vol2
Starting volume vol2 has been successful
[root@host-10-0-32-16 ~]# gluster volume list
vol1
vol2


掛載glusterfs文件夾
最後通過fstab來mount
shell> vi /etc/fstab
添加如下兩行
10.0.32.16:/vol1  /root/test    glusterfs    auto 0 0
10.0.32.16:/vol2  /root/test2    glusterfs    auto 0 0

shell> mkdir /root/test
shell>mkdir /root/test2
shell> mount /root/test
shell> mount /root/test2

shell>df
10.0.32.16:/vol1     123852672   4464128 113097216   4% /root/test
10.0.32.16:/vol2     123852672   4464128 113097216   4% /root/test2


轉載請註明轉自高孝鑫的博客
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章