glusterfs 快速安装配置

来源:互联网 发布:上海家博会数据 编辑:程序博客网 时间:2024/05/20 11:25
安装的机器为两台 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 vol110.0.32.16:/root/gluster-folder110.0.32.15:/root/gluster-folder1
Creation of volume vol1 has been successful. Please start thevolume 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 vol210.0.32.16:/root/gluster-folder210.0.32.15:/root/gluster-folder2
Creation of volume vol2 has been successful. Please start thevolume 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   4464128113097216   4% /root/test
10.0.32.16:/vol2   123852672   4464128113097216   4% /root/test2


转载请注明转自高孝鑫的博客
0 0
原创粉丝点击