gluster 安装配置基本指南
基于网络上的多篇文章,做了一些调整。
gluster安装
### Installing Gluster
wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/glusterfs-epel.repo
yum install glusterfs{-fuse,-server}
启动服务
service glusterd start
chkconfig glusterd on
add rule into iptables file on each gluster server:
vi /etc/sysconfig/iptables:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 24007:24008 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 49152:49162 -j ACCEPT
service iptables restart
建立peer关系
gluster peer probe bluejoe6
gluster peer probe bluejoe7
gluster peer status
创建并启动volume
gluster volume create gv0 bluejoe6:/data/gfs bluejoe7:/data/gfs force
# 启动卷
gluster volume start gv0
# 查看卷
gluster volume info gv0
客户端挂载
mount -t glusterfs bluejoe0:/gv0 /mnt/gfs
===================================
部分命令
volume create <NEW-VOLNAME> [stripe <COUNT>] [replica <COUNT>] [transport <tcp|rdma|tcp,rdma>] <NEW-BRICK>?<vg_name>... [force]
# 五种类型的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 gv0 fs-server-1:/data/gfs fs-server-2:/data/gfs
# 创建复制卷
gluster volume create gv0 replica 2 fs-server-1:/data/gfs fs-server-2:/data/gfs
# 创建条带卷
gluster volume create gv0 stripe 2 fs-server-1:/data/gfs fs-server-2:/data/gfs
gluster volume create volume2 stripe 3 replica 2 bluejoe6:/data/gfs-rep1 bluejoe6:/data/gfs-rep2 bluejoe7:/data/gfs-rep1 bluejoe7:/data/gfs-rep2 bluejoe8:/data/gfs-rep1 bluejoe8:/data/gfs-rep2 force
# gluster volume info gluster-volume1 Volume Name: gluster-volume1
Type: Distributed-Replicate
Volume ID: 7bed32e1-3ec1-4d67-975e-5ac07f99f481
Status: Created
Number of Bricks: 3 x 2 = 6
Transport-type: tcp
Bricks:
Brick1: bluejoe6:/data/brick1
Brick2: bluejoe7:/data/brick1
Brick3: bluejoe6:/data/brick2
Brick4: bluejoe8:/data/brick1
Brick5: bluejoe7:/data/brick2
Brick6: bluejoe8:/data/brick2
查看volume列表
gluster volume list
查看volume的具体信息(包含bricks的信息)
# gluster volume info
Volume Name: gv0
Type: Distribute
Volume ID: 8bde2ba4-7777-49ff-8b2b-763089017759
Status: Started
Number of Bricks: 3
Transport-type: tcp
Bricks:
Brick1: bluejoe6:/data/gfs
Brick2: bluejoe7:/data/gfs
Brick3: bluejoe8:/data/gfs
#如果以后要添加服务器,可以使用add-brick命令:
gluster volume add-brick gv0 fs-server-3:/data/gfs fs-server-4:/data/gfs
gluster volume remove-brick VOLNAME BRICK
注意:当你给分布式复制卷和分布式条带卷中增加bricks时,你增加的bricks的数目必须是复制或者条带数目的倍数,例如:你给一个分布式复制卷的replica为2,你在增加bricks的时候数量必须为2、4、6、8等。
当移除分布式复制卷或者分布式条带卷的时候,移除的bricks数目必须是replica或者stripe的倍数。例如:一个分布式条带卷的stripe是2,当你移除bricks的时候必须是2、4、6、8等。
============================
常见故障解决方案
问题1
[root@localhost ~]# gluster peer status
Connection failed. Please check if gluster daemon is operational.
原因:未开启glusterd服务
解决方法:开启glusterd服务
/etc/init.d/glusterd start
问题2
[root@localhost ~]# gluster peer probe 192.168.230.130
peer probe: failed: Probe returned with unknown errno 107
原因:日志中打印[2014-05-15 15:55:25.929461] I [glusterd-handler.c:2836:glusterd_probe_begin] 0-glusterd:Unable to find peerinfo for host: 192.168.230.130 (24007)
防火墙没开启24007端口
解决方法:开启24007端口或者关掉防火墙
/sbin/iptables -I INPUT -p tcp --dport 24007 -j ACCEPT # 开启24007端口
/etc/init.d/iptables stop # 关掉防火墙
注:
也可以使用主机名来代替IP,修改/etc/hosts文件实现
gluster peer probe server-130
问题3
volume create volume1 192.168.230.135:/tmp/brick1
volume create: volume2: failed
不能只使用一个server上的brick创建volume,需要至少两个brick,或者在client主机(这里为192.168.230.134)上使用一个brick创建volume。
- gluster> volume create volume1 192.168.230.134:/tmp/brick1 force
- volume create: volume1: success: please start the volume to access data
- gluster> volume info
- Volume Name: volume1
- Type: Distribute
- Volume ID: b01a2c29-09a6-41fd-a94e-ea834173a6a3
- Status: Created
- Number of Bricks: 1
- Transport-type: tcp
- Bricks:
- Brick1: 192.168.230.134:/tmp/brick1
- gluster>
- gluster> volume create volume2 192.168.230.134:/tmp/brick2 192.168.230.135:/tmp/brick2 force
- volume create: volume2: success: please start the volume to access data
- gluster> volume info
- Volume Name: volume1
- Type: Distribute
- Volume ID: b01a2c29-09a6-41fd-a94e-ea834173a6a3
- Status: Created
- Number of Bricks: 1
- Transport-type: tcp
- Bricks:
- Brick1: 192.168.230.134:/tmp/brick1
- Volume Name: volume2
- Type: Distribute
- Volume ID: 4af2e260-70ce-49f5-9663-9c831c5cf831
- Status: Created
- Number of Bricks: 2
- Transport-type: tcp
- Bricks:
- Brick1: 192.168.230.134:/tmp/brick2
- Brick2: 192.168.230.135:/tmp/brick2
问题4
创建一个volume后删除,再使用同名的brick创建volume失败。
gluster> volume create test 192.168.230.134:/tmp/brick1 force
volume create: test: success: please start the volume to access data
gluster> volume info Volume Name: test
Type: Distribute
Volume ID: c29f75d2-c9f5-4d6f-90c5-c562139ab9cd
Status: Created
Number of Bricks: 1
Transport-type: tcp
Bricks:
Brick1: 192.168.230.134:/tmp/brick1
gluster> volume delete test force
Usage: volume delete <VOLNAME>
gluster> volume delete test
Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y
volume delete: test: success
gluster> volume create test 192.168.230.134:/tmp/brick1 force
volume create: test: failed: /tmp/brick1 or a prefix of it is already part of a volume
因为volume delete时并未删掉create时创建的目录,需要手动删除后再使用。
gluster 安装配置基本指南的更多相关文章
- 【转】Windows平台下的Subversion安装配置新手指南
原文地址:http://developer.51cto.com/art/201005/199628.htm 本文介绍Subversion安装配置快速指南,首先讲Subversion的安装和配置,Uni ...
- [转载]SharePoint 2013测试环境安装配置指南
软件版本 Windows Server 2012 标准版 SQL Server 2012 标准版 SharePoint Server 2013 企业版 Office Web Apps 2013 备注: ...
- 高手指南PHP安装配置
高手指南PHP安装配置 2014-11-05 12:57:13 来源: 评论:0 次 点击:12 次 | 发布人:登陆查看 PHP的快速发展,它的功能越来越强大,运用它也变得很方便,下面我 ...
- 【转】服务器证书安装配置指南(Weblogic)
服务器证书安装配置指南(Weblogic) 详情请点击: http://verisign.itrus.com.cn/html/fuwuyuzhichi/fuwuqizhengshuanzhuangpe ...
- Gitolite v3安装配置指南
使用gitolite对git仓储进行权限配置 gitolite在近期做了很多代码改动,升级到了v3版本,而我使用的是v3.5.2.在<Git权威指南>中所提及的是v2版本,有很多东西已经不 ...
- 大数据应用日志采集之Scribe 安装配置指南
大数据应用日志采集之Scribe 安装配置指南 大数据应用日志采集之Scribe 安装配置指南 1.概述 Scribe是Facebook开源的日志收集系统,在Facebook内部已经得到大量的应用.它 ...
- 【转】Syncthing – 数据同步利器---自己的网盘,详细安装配置指南,内网使用,发现服务器配置
Syncthing – 数据同步利器---自己的网盘,详细安装配置指南,内网使用,发现服务器配置 原贴:https://www.cnblogs.com/jackadam/p/8568833.html ...
- 高可用,完全分布式Hadoop集群HDFS和MapReduce安装配置指南
原文:http://my.oschina.net/wstone/blog/365010#OSC_h3_13 (WJW)高可用,完全分布式Hadoop集群HDFS和MapReduce安装配置指南 [X] ...
- vSphere Web Client使用指南之安装配置
vSphere Web Client使用指南之安装配置 vSphere Web Client是为忙碌的管理员提供的一款通用的.基于浏览器的VMware管理工具,能够监控并管理VMware基础设施.在摆 ...
随机推荐
- 【转载】va_list 可变参数 简介 va_copy vprintf
[说明]本文转载自 smart 的文章 http://blog.sina.com.cn/s/blog_590be5290100qhxr.html 及百度百科 va_list是一个宏,由va_star ...
- C 头文件阅读理解
__BEGIN_DECLS ..... ..... __END_DECLS 很多时候,为了使 C 代码和 C++ 代码保持互相兼容的过程调用接口,需要在 C++ 代码里加上 extern " ...
- Java流操作之转换流
流的操作规律: 1.明确流和目的. 数据源(源头):就是需要读取,可以使用两个体系:InputStream.Reader 数据汇(目的地):就是需要写入,可以使用两个体系:OutputStream.W ...
- 多个分布式系统如何共享使用一个固定公网IP
传统的做法,一个分布式业务系统就有一个中间件,一个中间件需要使用至少一个固定公网IP,这样的话,多个业务系统就需要使用多个固定公网IP. 大家知道,固定公网IP价格可是不菲的.能不能让多个分布式业务系 ...
- C++中实现从std::string类型到bool型的转换
利用输入字符串流:std::istringstream bool b; std::string s = "true"; std::istringstream(s) >> ...
- Arrays 类操作 Java 的数组排序
使用 Arrays 类操作 Java 中的数组 Arrays 类是 Java 中提供的一个工具类,在 java.util 包中.该类中包含了一些方法用来直接操作数组,比如可直接实现数组的排序.搜索等( ...
- HTML5要点(一)
一.标签: <!-- -->:注释:cmd +/ <!DOCTYPE html><!--HTML5 专属版本声明标签(表明该页面使用HTML编写),代码最上层--> ...
- IDF实验室-简单编程-字符统计 writeup
题目地址:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=37 网站:http://ctf.idf.cn/gam ...
- C++ “读取位置 0x****** 时发生访问冲突”的可能原因
转自:http://shansun123.iteye.com/blog/680066 这种错误的意思一般是指访问了不属于自己的内存空间,出现这种错误有几种原因: 1.给一个数组分配了比较小的内存空间, ...
- coffeeScript demo
#能够直接在浏览器嵌入coffee-script.js 解析xx.coffee脚本,但真正正式使用时不建议这样使用,coffee-script.js下载地址:http://coffeescript.o ...