GFS安装

 

 

GlusterFS 搭建

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1、环境要求

IP地址

主机名称

系统

172.16.2.201

test01

Centos 6.4

172.16.2.202

test02

Centos 6.4

172.16.2.203

test03

Centos 6.4

2、搭建准备

2.1 ip与主机名称映射

编辑hosts文件

vi /etc/hosts ,将ip地址和机器的名称对应

 

2.2 关闭防火墙

关闭服务器的防火墙

service iptables stop

chkconfig iptables off

2.3 时间同步

编辑vi /etc/ntp.conf

 

其他两台服务器 同步 172.16.2.201 这台服务器的时间。

启动时钟同步

service ntpd start

3、GlusterFS搭建

3.1 添加软件源

yum install centos-release-gluster

3.2 安装server

yum install glusterfs glusterfs-fuse glusterfs-server

3.3 启动glusterfsd 

service glusterd start

glusterd 是管理连接状态的进程。

3.4 将节点加入gluster,并创建存储卷

添加节点:

gluster peer probe 172.16.2.202

gluster peer probe 172.16.2.203

创建存储卷:

gluster volume create Mian stripe 2 172.16.2.202:/storage 172.16.2.203:/storage force

Mian 是逻辑卷名称

stripe :是volume类型

storage 数据存储位置

# 五种类型的volume可以被创建:
    Distributed:分布式卷,文件通过hash算法随机的分布到由bricks组成的卷上。
    Replicated:复制式卷,类似raid1,replica数必须等于volume中brick所包含的存储服务器数,可用性高。
    Striped:条带式卷,类似与raid0,stripe数必须等于volume中brick所包含的存储服务器数,文件被分成数据块,以Round Robin的方式存储在bricks中,并发粒度是数据块,大文件性能好。
    Distributed Striped:分布式的条带卷,volume中brick所包含的存储服务器数必须是stripe的倍数(>=2倍),兼顾分布式和条带式的功能。
    Distributed Replicated:分布式的复制卷,volume中brick所包含的存储服务器数必须是 replica 的倍数(>=2倍),兼顾分布式和复制式的功能。

其他创建命令:

gluster volume create test6 replica  4 test02:/storage03 test02:/storage04  test03:/storage03 test03:/storage04 force

 

注意:上面是一条命令

3.5 启动服务

启动服务

gluster volume start Mian

3.6查看状态

查看建立卷组

gluster volume status

查看卷组的连接状态

gluster peer status

查看逻辑卷的信息。

Volume Name: Mian #是逻辑卷的名称

gluster volume info

3.7 将创建的存储卷挂载到节点

创建挂载路径

mkdir data01

挂载存储卷

mount -t glusterfs 172.16.2.202:Mian  /data01

卸载命令

umount /data01/  #**卸载的时候不在在/data01路径下卸载**

Mian  是gluster volume info 查询出的逻辑卷的名称

查看挂载后的状态

 

4、各种逻辑卷的优缺点

5、常见的问题

问题一:

glusterfsd 进程停止后启动不了。

解决办法:

将glusterd 进程停止,然后启动,然后再次启动glusterfsd 进程。

猜你喜欢

转载自www.cnblogs.com/chuangcc/p/10515635.html
GFS