# 安装 glusterfs 组件
yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma glusterfs-geo-replication glusterfs-devel

## 创建 glusterfs 目录
mkdir /data/glusterd

## 修改 glusterd 目录
$ sed -i 's/var\/lib/export/g' /etc/glusterfs/glusterd.vol

# 启动 glusterfs,
设置开机启动,查看状态
systemctl start glusterd.service
systemctl enable glusterd.service
systemctl status glusterd.service

配置 glusterfs

[root@node1 glusterd]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.20.171 master1 etcd1
192.168.20.172 master2 etcd2
192.168.20.173 master3 etcd3
192.168.20.174 node1
192.168.20.175 node2
192.168.20.176 node3
192.168.20.177 node4
192.168.20.178 node5
# 添加节点到 集群, 执行操作的本机不需要probe 本机执行
[root@node1  ~]#
gluster peer probe node2
gluster peer probe node3
gluster peer probe node4
gluster peer probe node5
查看集群状态
[root@node1 glusterd]# gluster peer status
Number of Peers: Hostname: node2
Uuid: 58fe4710--4f18-8ae7-92d0130efbb7
State: Peer in Cluster (Connected) Hostname: node3
Uuid: af0985bd-2f85--9ac6-5712cd35b148
State: Peer in Cluster (Connected) Hostname: node4
Uuid: 917cb471--48b5-95ad-454395f3f1f4
State: Peer in Cluster (Connected) Hostname: node5
Uuid: a73078df-13a5-4b2c-b3bb-9a63f25f77fa
State: Peer in Cluster (Connected)
创建存储目录
mkdir /export/gfs_data

配置 volume

GlusterFS中的volume的模式有很多中,包括以下几种:

  • 分布卷(默认模式):即DHT, 也叫 分布卷: 将文件已hash算法随机分布到 一台服务器节点中存储。
  • 复制模式:即AFR, 创建volume 时带 replica x 数量: 将文件复制到 replica x 个节点中。
  • 条带模式:即Striped, 创建volume 时带 stripe x 数量: 将文件切割成数据块,分别存储到 stripe x 个节点中 ( 类似raid 0 )。
  • 分布式条带模式:最少需要4台服务器才能创建。 创建volume 时 stripe 2 server = 4 个节点: 是DHT 与 Striped 的组合型。
  • 分布式复制模式:最少需要4台服务器才能创建。 创建volume 时 replica 2 server = 4 个节点:是DHT 与 AFR 的组合型。
  • 条带复制卷模式:最少需要4台服务器才能创建。 创建volume 时 stripe 2 replica 2 server = 4 个节点: 是 Striped 与 AFR 的组合型。
  • 三种模式混合: 至少需要8台 服务器才能创建。 stripe 2 replica 2 , 每4个节点 组成一个 组。

创建分布式卷

gluster volume create senyintvolume  stripe  replica  transport tcp node1:/export/gfs_data/ node2:/export/gfs_data/ node3:/export/gfs_data/ node4:/export/gfs_data/  node5:/export/gfs_data/  node1:/data/gfs_data/  node2:/data/gfs_data/ node3:/data/gfs_data/ force

查看卷

[root@node1 glusterd]#  gluster volume info

Volume Name: senyintvolume
Type: Distributed-Striped-Replicate
Volume ID: d11a39c5-65c8-415a-ac28-a698554a2b77
Status: Created
Snapshot Count:
Number of Bricks: x x =
Transport-type: tcp
Bricks:
Brick1: node1:/export/gfs_data
Brick2: node2:/export/gfs_data
Brick3: node3:/export/gfs_data
Brick4: node4:/export/gfs_data
Brick5: node5:/export/gfs_data
Brick6: node1:/data/gfs_data
Brick7: node2:/data/gfs_data
Brick8: node3:/data/gfs_data
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
 启动 分布卷
gluster volume start senyintvolume

再次查看

[root@node1 glusterd]#  gluster volume info

Volume Name: senyintvolume
Type: Distributed-Striped-Replicate
Volume ID: d11a39c5-65c8-415a-ac28-a698554a2b77
Status: Started
Snapshot Count:
Number of Bricks: x x =
Transport-type: tcp
Bricks:
Brick1: node1:/export/gfs_data
Brick2: node2:/export/gfs_data
Brick3: node3:/export/gfs_data
Brick4: node4:/export/gfs_data
Brick5: node5:/export/gfs_data
Brick6: node1:/data/gfs_data
Brick7: node2:/data/gfs_data
Brick8: node3:/data/gfs_data
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off

Glusterfs调优

# 设置 cache 大小, 默认32MB
$ gluster volume set senyintvolume performance.cache-size 4GB # 设置 io 线程, 太大会导致进程崩溃
$ gluster volume set senyintvolume performance.io-thread-count # 设置 网络检测时间, 默认42s
$ gluster volume set senyintvolume network.ping-timeout # 设置 写缓冲区的大小, 默认1M
$ gluster volume set senyintvolume performance.write-behind-window-size 1024MB # 开启 指定 volume 的配额,不使用
# gluster volume quota k8s-volume enable
# 限制 指定 volume 的配额,不使用
# gluster volume quota k8s-volume limit-usage / 1TB

挂载使用

master1:

yum  install  glusterfs-client
mount -t glusterfs node1:/senyintvolume /data//

GlusterFS 几种volume 模式说明:

一、 默认模式,既DHT, 也叫 分布卷: 将文件已hash算法随机分布到 一台服务器节点中存储。
gluster volume create test-volume server1:/exp1 server2:/exp2


二、 复制模式,既AFR, 创建volume 时带 replica x 数量: 将文件复制到 replica x 个节点中。
gluster volume create test-volume replica 2 transport tcp server1:/exp1 server2:/exp2


三、 条带模式,既Striped, 创建volume 时带 stripe x 数量: 将文件切割成数据块,分别存储到 stripe x 个节点中 ( 类似raid 0 )。
gluster volume create test-volume stripe 2 transport tcp server1:/exp1 server2:/exp2


四、 分布式条带模式(组合型),最少需要4台服务器才能创建。 创建volume 时 stripe 2 server = 4 个节点: 是DHT 与 Striped 的组合型。
gluster volume create test-volume stripe 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4


五、 分布式复制模式(组合型), 最少需要4台服务器才能创建。 创建volume 时 replica 2 server = 4 个节点:是DHT 与 AFR 的组合型。
gluster volume create test-volume replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4


六、 条带复制卷模式(组合型), 最少需要4台服务器才能创建。 创建volume 时 stripe 2 replica 2 server = 4 个节点: 是 Striped 与 AFR 的组合型。
gluster volume create test-volume stripe 2 replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4

七、 三种模式混合, 至少需要8台 服务器才能创建。 stripe 2 replica 2 , 每4个节点 组成一个 组。
gluster volume create test-volume stripe 2 replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4 server5:/exp5 server6:/exp6 server7:/exp7 server8:/exp8

glusterFS安装维护文档的更多相关文章

  1. C#给PDF文档添加文本和图片页眉

    页眉常用于显示文档的附加信息,我们可以在页眉中插入文本或者图形,例如,页码.日期.公司徽标.文档标题.文件名或作者名等等.那么我们如何以编程的方式添加页眉呢?今天,这篇文章向大家分享如何使用了免费组件 ...

  2. dotNET跨平台相关文档整理

    一直在从事C#开发的相关技术工作,从C# 1.0一路用到现在的C# 6.0, 通常情况下被局限于Windows平台,Mono项目把我们C#程序带到了Windows之外的平台,在工作之余花了很多时间在M ...

  3. ABP文档 - Javascript Api - AJAX

    本节内容: AJAX操作相关问题 ABP的方式 AJAX 返回信息 处理错误 HTTP 状态码 WrapResult和DontWrapResult特性 Asp.net Mvc 控制器 Asp.net ...

  4. ABP文档 - EntityFramework 集成

    文档目录 本节内容: Nuget 包 DbContext 仓储 默认仓储 自定义仓储 特定的仓储基类 自定义仓储示例 仓储最佳实践 ABP可使用任何ORM框架,它已经内置了EntityFrame(以下 ...

  5. ABP文档 - SignalR 集成

    文档目录 本节内容: 简介 安装 服务端 客户端 连接确立 内置功能 通知 在线客户端 帕斯卡 vs 骆峰式 你的SignalR代码 简介 使用Abp.Web.SignalR nuget包,使基于应用 ...

  6. ABP文档 - 通知系统

    文档目录 本节内容: 简介 发送模式 通知类型 通知数据 通知重要性 关于通知持久化 订阅通知 发布通知 用户通知管理器 实时通知 客户端 通知存储 通知定义 简介 通知用来告知用户系统里特定的事件发 ...

  7. ABP文档 - Hangfire 集成

    文档目录 本节内容: 简介 集成 Hangfire 面板授权 简介 Hangfire是一个综合的后台作业管理器,可以在ABP里集成它替代默认的后台作业管理器,你可以为Hangfire使用相同的后台作业 ...

  8. ABP文档 - 后台作业和工作者

    文档目录 本节内容: 简介 后台作业 关于作业持久化 创建一个后台作业 在队列里添加一个新作业 默认的后台作业管理器 后台作业存储 配置 禁用作业执行 Hangfire 集成 后台工作者 创建一个后台 ...

  9. ABP文档 - Javascript Api

    文档目录 本节内容: AJAX Notification Message UI Block & Busy Event Bus Logging Other Utility Functions A ...

随机推荐

  1. 【液晶模块系列基础视频】4.3.X-GUI图形界面库-画box函数简介

    [液晶模块系列基础视频]4.3.X-GUI图形界面库-画box函数简介 ============================== 技术论坛:http://www.eeschool.org 博客地址 ...

  2. HDU 4031 Attack(线段树/树状数组区间更新单点查询+暴力)

    Attack Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) Total Sub ...

  3. css样式重置方案 -解决浏览器差异

    1.http://meyerweb.com/eric/tools/css/reset/ /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 2011 ...

  4. Solr学习笔记之2、集成IK中文分词器

    Solr学习笔记之2.集成IK中文分词器 一.下载IK中文分词器 IK中文分词器 此文IK版本:IK Analyer 2012-FF hotfix 1 完整分发包 二.在Solr中集成IK中文分词器 ...

  5. java-访问权限

    使用以下修饰符来控制对属性和方法的访问: 1.public--公共的,其他任何类均可访问 2.private--私有的,只能在当前类内部被访问,其他都不能访问 3.protected--受保护的,相同 ...

  6. Paging

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Both unequal fixed-si ...

  7. Arrays.toString Arrays.asList

    import java.util.Arrays; public class TestCalc{ public static void main(String[] args) { ,,,,,,,}; / ...

  8. 蓝牙BLE LINK LAYER剖析(二) -- PDU

    DATA FORMAT The Link Layer has only one packet format used for both advertising channel packets and ...

  9. 《linux内核设计与实现》读书笔记第一、二章

    第一章 Linux内核简介 1.1 Unix的历史 1971年,Unix被移植到PDP-11型机中. 1973年,Unix操作系统用C语言改写——为Unix系统的广泛移植铺平了道路. 1977年,伯克 ...

  10. Region的预分区

    1.预分区的方式 共有四种方式 2.帮助信息 help 'create' 3.第一种方式 4.在页面上查看效果(端口号:60010) 5.第二种方式 )创建文件,并在文件中书写分区的值 )创建表 6. ...