Glusterfs 分布式存储安装部署
Glusterfs 分布式存储部署 是存储当中可以选择的一种 现在很多虚拟化 云计算都在用软件存储 例如 ceph
Glusterfs 等等 今天我们部署一下Glusterfs环境
GlusterFs安装
环境信息:
| Glusterfs-01 | 10.20.0.200 |
| Glusterfs-02 | 10.20.0.201 |
| Glusterfs-03 | 10.20.0.202 |
硬盘各一块 8G 测试 /dev/sdb
服务器版本信息
# cat /etc/redhat-release
CentOS release 6.6 (Final)
# uname -r
2.6.32-504.el6.x86_64
软件下载地址
http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.6/CentOS/epel-6.6/x86_64
依赖包安装
直接用Yum安装 每台都需要安装
# yum -y install libibverbs librdmacm xfsprogs nfs-utils rpcbind libaio liblvm2app lvm2-devel
软件安装
安装服务器端软件包
glusterfs-3.4.-.el6.x86_64.rpm
glusterfs-api-3.4.-.el6.x86_64.rpm
glusterfs-cli-3.4.-.el6.x86_64.rpm
glusterfs-fuse-3.4.-.el6.x86_64.rpm
glusterfs-libs-3.4.-.el6.x86_64.rpm
glusterfs-server-3.4.-.el6.x86_64.rpm
安装客户端软件包
glusterfs-3.4.-.el6.x86_64.rpm
glusterfs-fuse-3.4.-.el6.x86_64.rpm
glusterfs-libs-3.4.-.el6.x86_64.rpm
磁盘配置
磁盘分区:
EXT4格式化工具目前最大支持16TB
使用parted进行磁盘分区
分区格式化
每个服务器上面都需要至少添加一块硬盘 我们这边是用的1块8G硬盘 现在每台都格式化
# mkfs.ext4 -L /brick1 /dev/sdb
mke2fs 1.41. (-May-)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=/brick1
OS type: Linux
Block size= (log=)
Fragment size= (log=)
Stride= blocks, Stripe width= blocks
inodes, blocks
blocks (5.00%) reserved for the super user
First data block=
Maximum filesystem blocks=
block groups
blocks per group, fragments per group
inodes per group
Superblock backups stored on blocks:
, , , , , , , Writing inode tables: done
Creating journal ( blocks): done
Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every mounts or
days, whichever comes first. Use tune2fs -c or -i to override.
自动挂载分区
# vim /etc/fstab
LABEL=/brick1 /brick1 ext4 defaults 0 0
mount文件系统
# mkdir /brick1
# mount -L /brick1 /brick1/
# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
47G 759M 44G % /
tmpfs 491M 491M % /dev/shm
/dev/sda1 477M 28M 425M % /boot
/dev/sdb .8G 18M .4G % /brick1
基础测试包安装 性能测试包
工具软件
Atop,iperf,sysstat
dd,lozone,fio,postmark
工具安装
#rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install sysstat
Gcc -o postmark postmark-1.52.c
有些可以用yum安装
安装GlusterFS软件包
每台创建存放软件的目录 我们目前安装的是3.4.6的版本
#mdkir /home/tools/3.4. -p
#cd /home/tools/3.4.6
# ll
total
-rw-r--r-- root root Oct : glusterfs-3.4.-.el6.x86_64.rpm
-rw-r--r-- root root Oct : glusterfs-api-3.4.-.el6.x86_64.rpm
-rw-r--r-- root root Oct : glusterfs-cli-3.4.-.el6.x86_64.rpm
-rw-r--r-- root root Oct : glusterfs-fuse-3.4.-.el6.x86_64.rpm
-rw-r--r-- root root Oct : glusterfs-geo-replication-3.4.-.el6.x86_64.rpm
-rw-r--r-- root root Oct : glusterfs-libs-3.4.-.el6.x86_64.rpm
-rw-r--r-- root root Oct : glusterfs-rdma-3.4.-.el6.x86_64.rpm
-rw-r--r-- root root Oct : glusterfs-server-3.4.-.el6.x86_64.rpm
直接rpm安装
# rpm -ivh *.rpm
warning: glusterfs-3.4.-.el6.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 4ab22bb3: NOKEY
Preparing... ########################################### [%]
:glusterfs-libs ########################################### [ %]
:glusterfs ########################################### [ %]
:glusterfs-fuse ########################################### [ %]
:glusterfs-cli ########################################### [ %]
:glusterfs-server ########################################### [ %]
:glusterfs-geo-replicati########################################### [ %]
:glusterfs-api ########################################### [ %]
:glusterfs-rdma ########################################### [%]
安装成功启动GlusterFS
# service glusterd start
Starting glusterd: [ OK ]
# chkconfig glusterd on
组建集群扩展
在GlusterFS-01服务器上面操作 选择10.20.0.200 作为当前集群节点
添加另外两台服务器
# gluster peer probe 10.20.0.201
peer probe: success
# gluster peer probe 10.20.0.202
peer probe: success
GlusterFS-01服务器查看添加状态
# gluster peer status
Number of Peers: Hostname: 10.20.0.201
Port:
Uuid: c4d9edfd-d6ae--8ab3-5a9fbb5f18fc
State: Peer in Cluster (Connected) Hostname: 10.20.0.202
Port:
Uuid: c0b425bb-a7b4-4dae-bc19-ea6031bf02b9
State: Peer in Cluster (Connected)
GlusterFS-02服务器查看添加状态
# gluster peer status
Number of Peers: Hostname: 10.20.0.200
Port:
Uuid: 7ad4db05-ee75-44e6--e58072b62d33
State: Peer in Cluster (Connected) Hostname: 10.20.0.202
Uuid: c0b425bb-a7b4-4dae-bc19-ea6031bf02b9
State: Peer in Cluster (Connected)
GlusterFS-03服务器查看添加状态
# gluster peer status
Number of Peers: Hostname: 10.20.0.200
Port:
Uuid: 7ad4db05-ee75-44e6--e58072b62d33
State: Peer in Cluster (Connected) Hostname: 10.20.0.201
Uuid: c4d9edfd-d6ae--8ab3-5a9fbb5f18fc
State: Peer in Cluster (Connected)
表示成功
如果添加不成功 排除错误:
1,每台服务器是否能否Ping通
2,防火墙是否关闭iptables selinux
3,glusterd服务是否启动成功
创建卷
- 确定创建卷的类型
- 确定创建卷的brick列表
- 确实创建卷的网络类型(TCP/RDMA)
Gluster volume create创建卷
在GlusterFS-01服务器上面操作 可以任选一台
# gluster volume create dht-vol1 10.20.0.200:/brick1/b1 10.20.0.201:/brick1/b2 10.20.0.202:/brick1/b volume create: dht-vol1: success: please start the volume to access data
(1)distribute volume:分布式卷,文件通过hash算法分布到brick server上,这种卷是glusterfs的基础和最大特点;
(2)stripe volume:条带卷,类似RAID0,条带数=brick server数量,文件分成数据块以Round Robin方式分布到brick server上,并发粒度是数据块,大文件性能高;
(3)replica volume:镜像卷,类似RAID1,镜像数=brick server数量,所以brick server上文件数据相同,构成n-way镜像,可用性高;
(4)distribute stripe volume:分布式条带卷,brick server数量是条带数的倍数,兼具distribute和stripe卷的特点;
(5)distribute replica volume:分布式镜像卷,brick server数量是镜像数的倍数,兼具distribute和replica卷的特点
查看卷状态信息
# gluster volume info Volume Name: dht-vol1
Type: Distribute
Volume ID: 7d947cf1-c743-477e-a28d-7d030572b655
Status: Created
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: 10.20.0.200:/brick1/b1
Brick2: 10.20.0.201:/brick1/b2
Brick3: 10.20.0.202:/brick1/b3
启动卷
# gluster volume start dht-vol1
volume start: dht-vol1: success
客户端挂载卷
# mkdir /data # mount -t glusterfs 10.20.0.200:/dth-vol1 /data/ # df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
47G .1G 44G % /
tmpfs 491M 491M % /dev/shm
/dev/sda1 477M 28M 425M % /boot
/dev/sdb .8G 19M .4G % /brick1
10.20.0.200:/dth-vol1
24G 55M 22G % /data
注:这个默认卷类型 是3块盘 加起来的容量
测试 创建replic 复制卷
#gluster volume create rep1 replica 10.20.0.200:/brick1/b20 10.20.0.201:/brick1/b20 10.20.0.202:/brick1/b20
客户端挂载
# mkdir /data1
# mount -t glusterfs 10.20.0.200:/rep1 /data1
# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
47G .1G 44G % /
tmpfs 491M 491M % /dev/shm
/dev/sda1 477M 28M 425M % /boot
/dev/sdb .8G 19M .4G % /brick1
10.20.0.200:/dth-vol1
24G 55M 22G % /data
10.20.0.200:/rep1 .8G 19M .4G % /data1
注:replic类型 是复制模式 相当于raid1 一块盘的容量
常规命令:
添加磁盘
gluster volume add-brick dht-vol1 10.20.0.200:/brick1/b1 rebalance 同步数据
gluster volume rebalance dht-vol1 start
删除磁盘
gluster volume remove-brick dht-vol1 10.20.0.200:/brick1/b1
gluster volume rebalance dht-vol1 start
删除卷
先停止 在删除
# gluster volume stop dht-vol1
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
volume stop: dht-vol1: success # gluster volume delete dht-vol1
Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y
volume delete: dht-vol1: success # gluster volume info
No volumes present
集群扩展
增加节点
gluster peer probe IP/主机名
删除节点
gluster peer detach IP/主机名
节点状态
gluster peer status
GlusterFS典型故障处理:
1,恢复节点配置信息
故障现象:其中一个节点配置信息不正确
故障模拟:
删除server2部分配置信息
配置信息位置:/var/lib/glusterd/
修复方法
触发自修复:通过Gluster工具同步配置信息
gluster volume sync server1 all
2,复制卷数据不一致
故障现象:双副本卷数据出现不一致
故障模拟:删除其中一个brick数据
修复方法
新mount一下
3 复制卷的目录删除了
如何解决
修复方法:
先替换brick
#gluster volume replace-brick bbs_img 10.20.0.201:/brick1/share2 10.20.0.201:/brick1/share start
#gluster volume replace-brick bbs_img 10.20.0.201:/brick1/share2 10.20.0.201:/brick1/share commit
还原的时候注意会报错
解决办法
rm -rf /data/share2/.glusterfs
setfattr -x trusted.glusterfs.volume-id /data/share2
setfattr -x trusted.gfid /data/share2
Glusterfs 分布式存储安装部署的更多相关文章
- Centos7下GlusterFS分布式存储集群环境部署记录
0)环境准备 GlusterFS至少需要两台服务器搭建,服务器配置最好相同,每个服务器两块磁盘,一块是用于安装系统,一块是用于GlusterFS. 192.168.10.239 GlusterFS-m ...
- GlusterFS分布式存储集群部署记录-相关补充
接着上一篇Centos7下GlusterFS分布式存储集群环境部署记录文档,继续做一些补充记录,希望能加深对GlusterFS存储操作的理解和熟悉度. ======================== ...
- glusterFS分布式存储部署流程
转自:http://bangbangba.blog.51cto.com/3180873/1712061 GlusterFS是一款非常易于使用的分布式文件存储系统,实现了全部标准POSIX接口,并用fu ...
- GlusterFS分布式存储学习笔记
分布式文件系统 分布式文件系统(Distributed File System)是指文件系统管理的物理存储资源并不直接与本地节点相连,而是分布于计算网络中的一个或者多个节点的计算机上.目前意义上的分布 ...
- GlusterFS分布式文件系统部署
GlusterFS是一个可伸缩的网络文件系统,使用常见的现成的硬件,您可以创建大型分布式存储流媒体解决方案.数据分析.和其他数据相关的任务.GlusterFS是自由和开源软件. 详细参考官网:http ...
- 在Ubuntu 12.10 上安装部署Openstack
OpenStack系统有几个关键的项目,它们能够独立地安装但是能够在你的云计算中共同工作.这些项目包括:OpenStack Compute,OpenStack Object Storage,OpenS ...
- glusterfs快速安装
因为公司ES02集群使用的是SSD磁盘做的raid0,为了保证存放文件的可靠性,即在ES02集群上部署了一套分布式文件系统glusterfs. 结构 ES11 含有gfs程序,并挂载gfs在 ...
- Prometheus 和 Grafana 安装部署
Prometheus 是一套开源的系统监控报警框架.Prometheus 作为生态圈 Cloud Native Computing Foundation(简称:CNCF)中的重要一员,其活跃度仅次于 ...
- GlusterFS分布式文件系统部署及基本使用(CentOS 7.6)
GlusterFS分布式文件系统部署及基本使用(CentOS 7.6) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. Gluster File System 是一款自由软件,主要由 ...
随机推荐
- Recover the String
Recover the String 题目链接:http://codeforces.com/contest/709/problem/D 构造 这题乍一看很难构造,但是如果知道了整个字符串中'0'和'1 ...
- HDU 2544 最短路(初涉SPFA算法)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t ...
- ubuntu 禁用快捷键
System Settings > Keyboard > Shortcuts 点击要禁用的快捷键,按键盘"Backspace"键,就可以禁用了
- /tmp 和 /var/tmp 的区别
/tmp is meant as fast (possibly small) storage with a short time to live (TTL). Many systems clean / ...
- PHP 时间与字符串的相互转化
1.求两个日期的差数,例如2007-3-5 ~ 2007-3-6 的日期差数 echo abs(strtotime("2007-3-5") - strtotime("20 ...
- 6、50道JAVA基础编程练习题跟答案
50道JAVA基础编程练习题 [程序1] 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 程序分析 ...
- Chapter 14_2 全局变量声明
Lua中的全局变量不需要声明就可以使用.对于小程序十分方便,但是大型程序中 一处简单的笔误就可能造成难以发现的bug. 不过,这种性能可以改变.由于Lua将全局变量放在一个普通的table中,可以通过 ...
- jq 进度条插件
/***进度条*/var ProgressScrollBar = function (model) { this.defaults = { isCanMove: true,//是否启用拖动 conta ...
- SASL - 简单认证和安全层
转自:http://blog.csdn.net/id19870510/article/details/8232509 SASL - 简单认证和安全层 SASL是一种用来扩充C/S模式验证能力的机制认证 ...
- 与导航栏下控件的frame相关的edgesForExtendedLayout、translucent、extendedLayoutIncludesOpaqueBars、automaticallyAdjustsScrollViewInsets等几个属性的详解
在引入了导航控制器UINavigationController和分栏控制器UITabBarController之后,我们在设置控件的frame的时候就需要注意避开导航栏UINavigationBar ...