基于centos初始化
手动修改host文件,添加节点信息。
1 2 3 4
| 192.168.56.2 master 192.168.56.3 slave0 192.168.56.4 slave1 192.168.56.5 slave2
|
执行初始化脚本进行初始化。
格式化磁盘
添加一块新的硬盘,名为/dev/sdb
1 2 3 4 5 6 7
| fdisk /dev/sdb mkfs.xfs -i size=512 /dev/sdb1 mkdir -p /bricks/brick1 vim /etc/fstab
mount -a && mount df -h
|
GlustFS安装和初始化
每个节点都执行以下操作
1 2 3 4 5 6
| yum -y install epel-release yum -y install yum-priorities yum -y install centos-release-gluster yum -y install glusterfs-server systemctl enable glusterd.service systemctl start glusterd.service
|
以下是初始化步骤
在master上执行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| gluster peer probe slave1 gluster peer status gluster volume create k8s-volume replica 3 transport tcp slave0:/bricks/brick1 slave1:/bricks/brick1 slave2:/bricks/brick1 force gluster volume start k8s-volume gluster volume stop k8s-volume gluster volume delete k8s-volume gluster volume info gluster volume info all
gluster volume heal k8s-volume info sudo mount -t glusterfs master:/k8s-volume /data mount.glusterfs slave0:/bricks/brick1 /data
vim /etc/fstab master:/k8s-volume /data glusterfs defaults,_netdev 0 0
|
在分机执行的命令
1 2
| gluster volume add-brick k8s-volume master:/bricks/brick1 gluster volume info all
|
GlustFS常用操作
如果需要停止volume挂载,那么就需要先停止,再删除。
1 2 3 4 5
| gluster volume remove-brick k8s-volume slave1:/bricks/brick1 start gluster volume remove-brick k8s-volume slave1:/bricks/brick1 status gluster volume remove-brick k8s-volume slave1:/bricks/brick1 commit
gluster peer detach slave1
|
参考链接:
GlusterFS Documentation
Mount a GlusterFS volume
Red Hat Storage Volumes
GlusterFS 隐藏参数说明