【云计算】Ubuntu14.04 搭建GlusterFS集群

1、修改 /etc/hosts

所有服务节点执行(如果集群中没有DNS,可忽略此步骤):

10.5.25.37 glusterfs-1-5-25-37
10.5.25.38 glusterfs-2-5-25-38

2、开始安装

所有服务节点执行:

apt-get install glusterfs-server -y

service glusterfs-server start

3、创建集群节点

37上执行:

gluster peer probe glusterfs-2-5-25-38

gluster peer status

38上执行:

gluster peer probe glusterfs-1-5-25-37   38上执行

gluster peer status

删除/添加节点命令:

gluster peer detach xxx

gluster peer probe xxx

4、创建磁盘分区,挂载目录

所有服务节点执行:

linux磁盘分区fdisk命令详解:http://www.cnblogs.com/wangkangluo1/archive/2012/06/08/2541161.html

mkfs.ext4 /dev/vdb

查看结果:

blkid /dev/vdb
/dev/vdb: UUID="fa4a508f-ca6e-483a-a80a-ad76e9586e82" TYPE="ext4"

挂载:

mkdir -p /opt/gfs

mount /dev/vdb /opt/gfs

df -h 查看挂载情况

设置开机自动挂载:

vi /etc/fstab

/dev/vdb /opt/gfs ext4 default 0 1

Linux fstab自动挂载分区教程:http://blog.sina.com.cn/s/blog_6ce9e88701014jgl.html

5、创建分布式存储卷

创建卷:http://blog.csdn.net/ptmagic/article/details/8782273

http://zhidao.baidu.com/link?url=eqVAuyM7jnEZdu4vQ37UVS6a7E0LMt1gTrfSWAIu_v2HpcOfKsmY9Ws-H4Bi2MTS_tgwZs1V7YF0S3WnpcTsrK

动态调整:http://blog.csdn.net/zonelan/article/details/8476281

基本原理:http://my.oschina.net/hncscwc/blog/225454

gluster volume create gv_ansible replica 2 10.5.25.37:/opt/gfs/ansible 10.5.25.38:/opt/gfs/ansible

查看volume信息:

gluster volume info

启动存储卷:

gluster volume  start gv_ansible

gluster volume info 查看为已经启动状态

6、客户端

apt-get install glusterfs-client -y

mkdir -p /tmp/ansible

mount.glusterfs 10.5.25.37:gv_ansible /tmp/ansible

设置开机自动挂载,vi /etc/fstab,追加:

10.5.25.37:gv_ansible /tmp/ansible glusterfs defaults,_netdev 0 0

OK,搞定!

其他参考资料:http://www.2cto.com/os/201210/160151.html

分布式存储系统GlusterFS初体验:http://my.oschina.net/kisops/blog/151073

GlusterFS集群系统安装与配置方法详解(1/2):http://www.111cn.net/sys/linux/62609.htm

推荐阅读:http://www.linuxidc.com/Linux/2015-11/125106.htm

https://www.digitalocean.com/community/tutorials/how-to-create-a-redundant-storage-pool-using-glusterfs-on-ubuntu-servers

http://www.gluster.org/community/documentation/index.php/Setting_Up_Clients

https://www.digitalocean.com/community/tutorials/how-to-create-a-redundant-storage-pool-using-glusterfs-on-ubuntu-servers

搭建参考:http://www.cnblogs.com/lionelwu-qianqian/archive/2013/12/12/3470555.html

umount:http://unix.stackexchange.com/questions/15024/umount-device-is-busy-why

上一篇:ES查询-term VS match (转)


下一篇:使用 Flask 框架写用户登录功能的Demo时碰到的各种坑(五)——实现注册功能