欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

glusterfs安装及使用

程序员文章站 2024-03-08 12:44:16
...

Glusterfs的安装及后续使用<持续更新>

前言

第一次写这个,其他的就不要太讲究了,直接上干货。
glusterfs的安装及使用,我也是在前辈的基础上学到的。后面会贴出相应链接。

glusterfs的安装
1.部署环境
CentOs7
每个Centos7得有两个硬盘,不然玩不转
这是我个人的centos7
输入fdisk -l 获得下列信息
我个人的CENTOS7好像有问题,反正不太懂,没有sdb这块磁盘,信息出现的sdb磁盘是我加上去的glusterfs安装及使用
没有sdb这块磁盘可以百度添加(个人发现没用,就不贴了)
对此可以手动添加磁盘,
智商在线的老哥应该知道怎么做了,将添加的磁盘名改为sdb就行了
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001d009

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1419b856

Device Boot Start End Blocks Id System
/dev/sdb1 2048 8390655 4194304 83 Linux

Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

如果各位磁盘信息有sdb那么直接开始吧
1.2 格式化并挂载存储块(bricks)

我们假定每个主机的/dev/sdb1分区,是用于GlusterFS使用的存储块brick

1,fdisk /dev/sdb //将sdb分出一个磁盘

	执行此命令后先执行  h   进入到帮助界面
	再执行   n   创建新的
	再根据默认属性输入相应模板数据  
	最后就完成啦  具体参照顶部数据
	分配sdb磁盘后默认名字为sdb1 分磁盘过程中,最后记得输出 w 这个相当于保存退出命令 		  不然会无效

2,mkfs.xfs -i size=512 /dev/sdb1 //进行此步骤之前需要进行磁盘分区,将此先创建的sdb分出一个来 (第一步)

3,mkdir -p /data/brick1

4,mount /dev/sdb1 /data/brick1

5,echo ‘/dev/sdb1 /data/brick1 xfs defaults 1 2’ >> /etc/fstab

6,mount -a && mount

2、安装GlusterFS
方式多多,我只贴我成功的方式
先安装wget
sudo yum -y install wget
执行
wget -p /etc/yum.repos.d https://download.gluster.org/pub/gluster/glusterfs/LATEST/RHEL/glusterfs-rhel8.repo
大家可以参照路径选择需要的版本
走到这一步,以前的资料可能直接就yum install glusterfs-server了
没用,信息更新快的要死,不行了
得 先查看能够下载的版本,根据需要下载
yum search centos-release-gluster
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    ================================================== N/S matched: centos-release-gluster ===================================================
    centos-release-gluster-legacy.noarch : Disable unmaintained Gluster repositories from the CentOS Storage SIG
    centos-release-gluster40.x86_64 : Gluster 4.0 (Short Term Stable) packages from the CentOS Storage SIG repository
    centos-release-gluster41.noarch : Gluster 4.1 (Long Term Stable) packages from the CentOS Storage SIG repository
    centos-release-gluster5.noarch : Gluster 5 packages from the CentOS Storage SIG repository
    centos-release-gluster6.noarch : Gluster 6 packages from the CentOS Storage SIG repository

按需下载
yum -y install centos-release-gluster6.noarch
安装gluster软件:
yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-cli glusterfs-geo-replication
查看版本信息:
glusterfs -V
启动:
service glusterfs start
查看:
service glusterfs status

glusterd.service - GlusterFS, a clustered file-system server
Loaded: loaded (/usr/lib/systemd/system/glusterd.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2019-04-12 03:29:14 EDT; 10s ago
先写到这儿, 大哥们有啥不对尽管批评.
由于其他原因,后续内容等个人总结妥当了再发出来给大家参考
参照博客:
https://www.cnblogs.com/sellsa/p/6051333.html
https://www.jianshu.com/p/608774eb8665
https://blog.csdn.net/gzliudan/article/details/70941532