GlusterFS部署命令
安装部署前服务器端和客户端编辑/etc/hosts配置好IP和计算机名,其实GlusterFS提供的是一个服务器端同步机制,如果客户端需要SMB或NFS访问还需要相应的服务支持,Linux客户端支持rpcbind方式访问,这也是为什么需要安装rpcbind服务。
GlusterFS服务器端都需要安装以下包,客户端需要glusterfs,glusterfs-fuse,rpcbind
yum -y install centos-release-gluster samba rpcbind
yum -y install glusterfs glusterfs-server glusterfs-fuse
服务器端启用GlusterFS服务、rpc服务并设置自动启动
systemctl start glusterd.service
systemctl enable glusterd.service
systemctl start rpcbind
systemctl enable rpcbind
查看服务状态
systemctl status glusterd.service
systemctl status rpcbind
创建集群(任意节点上执行一次操作,向集群中添加节点):
gluster peer probe drbd1
gluster peer probe drbd2
查看集群状态
gluster peer status
每台服务器用于GlusterFS的盘需要预先创建文件系统并挂载到服务器上,另外需要编辑/etc/fstab以便服务器启动时自动挂载
vgcreate localvg /dev/sdb
lvcreate -n localvol -l 100%FREE localvg
mkfs.xfs /dev/localvg/localvol
mkdir /localvol
mount /dev/localvg/localvol /localvol
df -hT
创建分布式卷,因为drbd1:/localvol/为硬盘直接的挂载点,后面需要加入force命令
gluster volume create glusterfsvol replica 2 drbd1:/localvol/ drbd2:/localvol/ force
gluster volume start glusterfsvol
查看这个卷的信息
gluster volume info glusterfsvol
gluster pool list
Client挂载
systemctl start rpcbind
systemctl enable rpcbind
mkdir /glusterfsvol
mount -t glusterfs drbd1:glusterfsvol /glusterfsvol