iis服务器助手广告广告
返回顶部
首页 > 资讯 > 精选 >CentOS 6.4怎么安装及设置GlusterFS
  • 474
分享到

CentOS 6.4怎么安装及设置GlusterFS

2023-06-10 08:06:54 474人浏览 八月长安
摘要

本篇内容介绍了“Centos 6.4怎么安装及设置GlusterFS”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!  GlusterFS因有

本篇内容介绍了“Centos 6.4怎么安装及设置GlusterFS”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

  GlusterFS因有很好的扩展性,使用的用户很多,使用GlusterFS能够解决网络存储、冗余备份等问题,那么在linux下要如何安装GlusterFS呢?今天小编以CentOS6.4为例,给大家介绍下CentOS6.4安装配置GlusterFS的方法。

  环境介绍:

  OS: CentOS 6.4 x86_64 Minimal

  Servers: sc2-log1,sc2-log2,sc2-log3,sc2-log4

  Client: sc2-ads15

  具体步骤:

  1. 在sc2-log{1-4}上安装GlusterFS软件包:

  代码如下

  # wget -P /etc/yum.repos.d Http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo

  # yum install -y glusterfs-3.4.2-1.el6 glusterfs-server-3.4.2-1.el6 glusterfs-fuse-3.4.2-1.el6

  # /etc/init.d/glusterd start

  # chkconfig glusterfsd on

  2. 在sc2-log1上配置整个GlusterFS集群:

  代码如下

  [root@sc2-log1 ~]# gluster peer probe sc2-log1

  1 peer probe: success: on localhost not needed

  [root@sc2-log1 ~]# gluster peer probe sc2-log2

  1 peer probe: success

  [root@sc2-log1 ~]# gluster peer probe sc2-log3

  1 peer probe: success

  [root@sc2-log1 ~]# gluster peer probe sc2-log4

  1 peer probe: success

  [root@sc2-log1 ~]# gluster peer status

  01 Number of Peers: 3

  02

  03 Hostname: sc2-log2

  04 Port: 24007

  05 Uuid: 399973af-bae9-4326-9cbd-b5b05e5d2927

  06 State: Peer in Cluster (Connected)

  07

  08 Hostname: sc2-log3

  09 Port: 24007

  10 Uuid: 833a7b8d-e3b3-4099-baf9-416ee7213337

  11 State: Peer in Cluster (Connected)

  12

  13 Hostname: sc2-log4

  14 Port: 24007

  15 Uuid: 54bf115a-0119-4021-af80-7a6bca137fd9

  16 State: Peer in Cluster (Connected)

  3. 在sc2-log{1-4}上创建数据存放目录:

  代码如下

  # mkdir -p /usr/local/share/{models,geoip,wurfl}

  # ls -l /usr/local/share/

  1 total 24

  2 drwxr-xr-x 2 root root 4096 Apr 1 12:19 geoip

  3 drwxr-xr-x 2 root root 4096 Apr 1 12:19 models

  4 drwxr-xr-x 2 root root 4096 Apr 1 12:19 wurfl 

  4. 在sc2-log1上创建GlusterFS磁盘:

  代码如下

  [root@sc2-log1 ~]# gluster volume create models replica 4 sc2-log1:/usr/local/share/models sc2-log2:/usr/local/share/models sc2-log3:/usr/local/share/models sc2-log4:/usr/local/share/models force

  1 volume create: models: success: please start the volume to access data

  [root@sc2-log1 ~]# gluster volume create geoip replica 4 sc2-log1:/usr/local/share/geoip sc2-log2:/usr/local/share/geoip sc2-log3:/usr/local/share/geoip sc2-log4:/usr/local/share/geoip force

  1 volume create: geoip: success: please start the volume to access data

  [root@sc2-log1 ~]# gluster volume create wurfl replica 4 sc2-log1:/usr/local/share/wurfl sc2-log2:/usr/local/share/wurfl sc2-log3:/usr/local/share/wurfl sc2-log4:/usr/local/share/wurfl force

  1 volume create: wurfl: success: please start the volume to access data

  [root@sc2-log1 ~]# gluster volume start models

  1 volume start: models: success

  [root@sc2-log1 ~]# gluster volume start geoip

  1 volume start: geoip: success

  [root@sc2-log1 ~]# gluster volume start wurfl

  1 volume start: wurfl: success

  [root@sc2-log1 ~]# gluster volume info

  01 Volume Name: models

  02 Type: Replicate

  03 Volume ID: b29b22bd-6d8c-45c0-b199-91fa5a76801f

  04 Status: Started

  05 Number of Bricks: 1 x 4 = 4

  06 Transport-type: tcp

  07 Bricks:

  08 Brick1: sc2-log1:/usr/local/share/models

  09 Brick2: sc2-log2:/usr/local/share/models

  10 Brick3: sc2-log3:/usr/local/share/models

  11 Brick4: sc2-log4:/usr/local/share/models

  12

  13 Volume Name: geoip

  14 Type: Replicate

  15 Volume ID: 69b0caa8-7c23-4712-beae-6f536b1cffa3

  16 Status: Started

  17 Number of Bricks: 1 x 4 = 4

  18 Transport-type: tcp

  19 Bricks:

  20 Brick1: sc2-log1:/usr/local/share/geoip

  21 Brick2: sc2-log2:/usr/local/share/geoip

  22 Brick3: sc2-log3:/usr/local/share/geoip

  23 Brick4: sc2-log4:/usr/local/share/geoip

  24

  25 Volume Name: wurfl

  26 Type: Replicate

  27 Volume ID: c723a99d-eeab-4865-819a-c0926cf7b88a

  28 Status: Started

  29 Number of Bricks: 1 x 4 = 4

  30 Transport-type: tcp

  31 Bricks:

  32 Brick1: sc2-log1:/usr/local/share/wurfl

  33 Brick2: sc2-log2:/usr/local/share/wurfl

  34 Brick3: sc2-log3:/usr/local/share/wurfl

  35 Brick4: sc2-log4:/usr/local/share/wurfl

  5. 在sc2-ads15上部署客户端并mount GlusterFS文件系统:

  [sc2-ads15][root@sc2-ads15 ~]# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo

  [sc2-ads15][root@sc2-ads15 ~]# yum install -y glusterfs-3.4.2-1.el6 glusterfs-fuse-3.4.2-1.el6

  [sc2-ads15][root@sc2-ads15 ~]# mkdir -p /mnt/{models,geoip,wurfl}

  [sc2-ads15][root@sc2-ads15 ~]# mount -t glusterfs -o ro sc2-log3:models /mnt/models/

  [sc2-ads15][root@sc2-ads15 ~]# mount -t glusterfs -o ro sc2-log3:geoip /mnt/geoip/

  [sc2-ads15][root@sc2-ads15 ~]# mount -t glusterfs -o ro sc2-log3:wurfl /mnt/wurfl/

  [sc2-ads15][root@sc2-ads15 ~]# df -h

  1 Filesystem Size Used Avail Use% Mounted on

  2 /dev/mapper/vg_t-lv_root

  3 59G 7.7G 48G 14% /

  4 tmpfs 3.9G 0 3.9G 0% /dev/shm

  5 /dev/xvda1 485M 33M 428M 8% /boot

  6 sc2-log3:models 98G 8.6G 85G 10% /mnt/models

  7 sc2-log3:geoip 98G 8.6G 85G 10% /mnt/geoip

  8 sc2-log3:wurfl 98G 8.6G 85G 10% /mnt/wurfl 

  6. 相关数据读写可用性测试:

  在sc2-ads15挂载点上写入数据:

  代码如下

  [sc2-ads15][root@sc2-ads15 ~]# umount /mnt/models

  [sc2-ads15][root@sc2-ads15 ~]# mount -t glusterfs sc2-log3:models /mnt/models/

  [sc2-ads15][root@sc2-ads15 ~]# echo “This is sc2-ads15” 》 /mnt/models/hello.txt

  [sc2-ads15][root@sc2-ads15 ~]# mkdir /mnt/testdir

  在sc2-log1数据目录中进行查看:

  [root@sc2-log1 ~]# ls /usr/local/share/models/

  1 hello.txt testdir

  结果: 数据写入成功

  在sc2-log1数据目录中直接写入数据:

  代码如下

  [root@sc2-log1 ~]# echo “This is sc2-log1” 》 /usr/local/share/models/hello.2.txt

  [root@sc2-log1 ~]# mkdir /usr/local/share/models/test2

  在sc2-ads15挂载点上进行查看:

  [sc2-ads15][root@sc2-ads15 ~]# ls /mnt/models

  [sc2-ads15][root@sc2-ads15 ~]# ls -l /mnt/models

  1 hello.txt testdir

  结果: 数据写入失败

  在sc2-log1挂载点上写入数据:

  代码如下

  [root@sc2-log1 ~]# mount -t glusterfs sc2-log1:models /mnt/models/

  [root@sc2-log1 ~]# echo “This is sc2-log1” 》 /mnt/models/hello.3.txt

  [root@sc2-log1 ~]# mkdir /mnt/models/test3

  在sc2-ads15挂载点上进行查看:

  [sc2-ads15][root@sc2-ads15 models]# ls /mnt/models

  1 hello.2.txt hello.3.txt hello.txt test2 test3 testdir

  结果: 数据写入成功,同时之前写入失败的数据也成功加载了。

  最终结论:

  在数据目录中直接写入数据,会导致其它节点因为得不到通知而使数据同步失败。

  正确的做法是所有的读写操作都通过挂载点来进行。

  7. 其它操作笔记:

  删除GlusterFS磁盘:

  代码如下

  # gluster volume stop models

  # gluster volume delete models

  卸载GlusterFS磁盘:

  代码如下

  sc2-log4

  ACL访问控制:

  代码如下

  # gluster volume set models auth.allow 10.60.1.*,10.70.1.*

  添加GlusterFS节点:

  代码如下

  # gluster peer probe sc2-log5

  # gluster peer probe sc2-log6

  # gluster volume add-brick models sc2-log5:/data/gluster sc2-log6:/data/gluster

  迁移GlusterFS磁盘数据:

  代码如下

  # gluster volume remove-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models start

  # gluster volume remove-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models status

  # gluster volume remove-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models commit

  修复GlusterFS磁盘数据(例如在sc2-log1宕机的情况下):

  代码如下

  # gluster volume replace-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models commit -force

  # gluster volume heal models full

“CentOS 6.4怎么安装及设置GlusterFS”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程网网站,小编将为大家输出更多高质量的实用文章!

--结束END--

本文标题: CentOS 6.4怎么安装及设置GlusterFS

本文链接: https://www.lsjlt.com/news/259852.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • C++ 生态系统中流行库和框架的贡献指南
    作为 c++++ 开发人员,通过遵循以下步骤即可为流行库和框架做出贡献:选择一个项目并熟悉其代码库。在 issue 跟踪器中寻找适合初学者的问题。创建一个新分支,实现修复并添加测试。提交...
    99+
    2024-05-15
    框架 c++ 流行库 git
  • C++ 生态系统中流行库和框架的社区支持情况
    c++++生态系统中流行库和框架的社区支持情况:boost:活跃的社区提供广泛的文档、教程和讨论区,确保持续的维护和更新。qt:庞大的社区提供丰富的文档、示例和论坛,积极参与开发和维护。...
    99+
    2024-05-15
    生态系统 社区支持 c++ overflow 标准库
  • c++中if elseif使用规则
    c++ 中 if-else if 语句的使用规则为:语法:if (条件1) { // 执行代码块 1} else if (条件 2) { // 执行代码块 2}// ...else ...
    99+
    2024-05-15
    c++
  • c++中的继承怎么写
    继承是一种允许类从现有类派生并访问其成员的强大机制。在 c++ 中,继承类型包括:单继承:一个子类从一个基类继承。多继承:一个子类从多个基类继承。层次继承:多个子类从同一个基类继承。多层...
    99+
    2024-05-15
    c++
  • c++中如何使用类和对象掌握目标
    在 c++ 中创建类和对象:使用 class 关键字定义类,包含数据成员和方法。使用对象名称和类名称创建对象。访问权限包括:公有、受保护和私有。数据成员是类的变量,每个对象拥有自己的副本...
    99+
    2024-05-15
    c++
  • c++中优先级是什么意思
    c++ 中的优先级规则:优先级高的操作符先执行,相同优先级的从左到右执行,括号可改变执行顺序。操作符优先级表包含从最高到最低的优先级列表,其中赋值运算符具有最低优先级。通过了解优先级,可...
    99+
    2024-05-15
    c++
  • c++中a+是什么意思
    c++ 中的 a+ 运算符表示自增运算符,用于将变量递增 1 并将结果存储在同一变量中。语法为 a++,用法包括循环和计数器。它可与后置递增运算符 ++a 交换使用,后者在表达式求值后递...
    99+
    2024-05-15
    c++
  • c++中a.b什么意思
    c++kquote>“a.b”表示对象“a”的成员“b”,用于访问对象成员,可用“对象名.成员名”的语法。它还可以用于访问嵌套成员,如“对象名.嵌套成员名.成员名”的语法。 c++...
    99+
    2024-05-15
    c++
  • C++ 并发编程库的优缺点
    c++++ 提供了多种并发编程库,满足不同场景下的需求。线程库 (std::thread) 易于使用但开销大;异步库 (std::async) 可异步执行任务,但 api 复杂;协程库 ...
    99+
    2024-05-15
    c++ 并发编程
  • 如何在 Golang 中备份数据库?
    在 golang 中备份数据库对于保护数据至关重要。可以使用标准库中的 database/sql 包,或第三方包如 github.com/go-sql-driver/mysql。具体步骤...
    99+
    2024-05-15
    golang 数据库备份 mysql git 标准库
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作