GlusterFS快速安装
GlusterFS快速安装
安装前准备这边最少需要三台机器,所有机器关闭防火墙和Selinux,所有机器需要两块硬盘, systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config 添加hosts文件,其实通过IP地址也能做集群,但是不建议这种方式,因为我们通过域名你就是替换节点ip地址只要是域名不变,我们的glusterfs集群还能使用 cat >> /etc/hosts<<‘EOF‘ 192.168.1.253 glusterfs01 192.168.1.238 glusterfs02 192.168.1.244 glusterfs03 EOF 格式化硬盘,我们这边采用/dev/sdb 这个硬盘 fdisk /dev/sdb Command (m for help): n Partition type: p primary (1 primary,0 extended,3 free) e extended Select (default p): p 然后一路回车,创建磁盘分区 mkfs.xfs /dev/sdb1 创建挂载点: mkdir -p /guiji mount -t auto /dev/sdb1 /guiji 服务端和客户端最好有个ntp时间服务器,确保机器时间一致搭建ntp时间服务器的教程,请移动到这里 添加安装源,如果不添加无法安装glusterfs-server yum install centos-release-gluster 安装glusterfs服务 yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma glusterfs-geo-replication glusterfs-devel 启动glusterfs服务 systemctl start glusterd systemctl enable glusterd 初始化集群将节点加入到glusterfs集群中,需要到三台机器节点上都执行下面命令 gluster peer probe gluster01 gluster peer probe gluster02 gluster peer probe gluster03 注意如果没有配置hosts主机名这个地方是不能进行解析的, [[email?protected] gv0]# gluster peer status Number of Peers: 2 Hostname: glusterfs02 Uuid: 2ff8038e-bd5b-4dbe-a33e-6eb756314a50 State: Peer in Cluster (Connected) Hostname: glusterfs03 Uuid: b77cd401-a8c3-4c5d-8ab7-e2a1ab72aac3 State: Peer in Cluster (Connected) 创建设置glusterfs volume在三台机器上都创建如下目录 mkdir -p /guiji/pv1 然后在其中任何一台机器上执行下面这个命令 gluster volume create gv0 replica 3 glusterfs01:/guiji/pv1 glusterfs02:/guiji/pv1 glusterfs03:/guiji/pv1 gluster volume start gv0 注意: 这个地方默认是不可以直接使用挂载点开创建的,需要在挂载点下面创建子目录 查看确认卷已经启动 [[email?protected] ~]# gluster volume info Volume Name: gv0 Type: Replicate Volume ID: 24650e7b-e14a-416d-a151-c2588a26e795 Status: Started Snapshot Count: 0 Number of Bricks: 1 x 3 = 3 Transport-type: tcp Bricks: Brick1: glusterfs01:/guiji/gv0 Brick2: glusterfs02:/guiji/gv0 Brick3: glusterfs03:/guiji/gv0 Options Reconfigured: transport.address-family: inet nfs.disable: on performance.client-io-threads: off 字段解读: Volume Name: 创建的这个glusterfs卷的名称,客户端挂在的时候回使用到这个内容 Type: Replicate 存储的类型,这个为副本类型 status: 当前这个卷的状态 Number of Bricks: 存储的状态 查看状态 [[email?protected] ~]# gluster volume status Status of volume: gv0 Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick glusterfs01:/guiji/gv0 49152 0 Y 20554 Brick glusterfs02:/guiji/gv0 49152 0 Y 19241 Brick glusterfs03:/guiji/gv0 49152 0 Y 19278 Self-heal Daemon on localhost N/A N/A Y 20577 Self-heal Daemon on glusterfs03 N/A N/A Y 19301 Self-heal Daemon on glusterfs02 N/A N/A Y 19264 Task Status of Volume gv0 ------------------------------------------------------------------------------ There are no active volume tasks 客户端挂在写入数据安装软件,支持挂在glusterfs格式的文件 yum install centos-release-gluster -y yum install -y glusterfs-6.0-1* glusterfs-fuse-6.0-1* 在客户端也需要配置hosts解析 cat >> /etc/hosts<<‘EOF‘ 192.168.1.253 glusterfs01 192.168.1.238 glusterfs02 192.168.1.244 glusterfs03 EOF 挂在glusterfs提供的目录 mount -t glusterfs glusterfs01:/gv0 /mnt 然后写入数据测试 touch /mnt/{1..10} 然后去glusterfs上面检查文件存不存在,因该是存在的 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 解决若依linux启动ERROR - unregister mbean error javax.m
- 流量控制--5.Classless Queuing Disciplines (qdiscs)
- linux – 如何让sec正确忽略时间戳
- 调用远程主机上的 RMI 服务时抛出 java.rmi.ConnectExcepti
- 估计Linux中的FLOPS?
- DECLSPEC和SDLCALL在Linux上的头文件中的函数定义中意味着什
- 在linux上,如何在不尝试连接的情况下检查端口是否处于侦听状
- linux-Centos7安装python3并与python2共存
- linux – 使用备用SMTP端口的邮件命令?
- 终端 – 运行ssh时更改oh-my-zsh主题