admin 管理员组文章数量: 1087678
CentOs 安装GlusterFs
1、所有节点都需要配置存储节点hostname解析
# gfs01节点更新hostname
hostname glusterfs-1
echo "glusterfs-1" > /etc/hostname
# gfs02节点更新hostname
hostname glusterfs-2
echo "glusterfs-2" > /etc/hostname
# 配置hosts解析
[root@gfs01 ~]# cat /etc/hosts
192.168.62.162 glusterfs-1
192.168.62.163 glusterfs-2
2、格式化磁盘、创建挂载目录(glusterfs-1和glusterfs-2节点都需要执行如下操作)
# 查看可用磁盘
fdisk -l
# 格式化
mkfs.xfs /dev/vdb
mkdir -p /data
#开机挂载
echo "UUID=0e739ec0-a6f0-41af-92d6-b692dded9692 /data xfs defaults 1 2" >>/etc/fstab
mount -a
# 查看挂载状态
df -h
3、安装glusterfs服务
yum -y install centos-release-gluster
yum -y install glusterfs-server
4、启动gluster服务
systemctl start glusterd.service
systemctl enable glusterd.service
systemctl status glusterd.service
5、配置信任池
[root@glusterfs-1 ~]# gluster peer probe glusterfs-2
peer probe: success.
6、前往glusterfs-2上验证
[root@glusterfs-2 ~]# gluster peer status
Number of Peers: 1 Hostname: glusterfs-1
Uuid: 0e739ec0-a6f0-41af-92d6-b692dded9692
State: Peer in Cluster (Connected)
7、创建卷
# 节点glusterfs-1,glusterfs-2都需执行
mkdir -p /data/glusterfs
# 在glusterfs-1执行创建卷操作
gluster volume create data replica 2 gfs02:/data/glusterfs gfs01:/data/glusterfs
Replica 2 volumes are prone to split-brain. Use Arbiter or Replica 3 to avoid this. See: /Split%20brain%20and%20ways%20to%20deal%2 0with%20it/. Do you still want to continue? (y/n) y
volume create: data: success: please start the volume to access data
# 在glusterfs-2 查看卷信息
[root@glusterfs-2 ~]# gluster volume info
Volume Name: data
Type: Replicate
Volume ID: 34d30f49-b788-4d1b-b179-af9aeeb431bd
Status: Created Snapshot
Count: 0 Number of
Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: gluster-2:/data/glusterfs
Brick2: gluster-1:/data/glusterfs
Options Reconfigured: transport.address-family: inet nfs.disable: on performance.client-io-threads: off
# 启动卷
gluster volume start data
8、安装glusterfs客户端
yum -y install glusterfs-fuse
9、挂载glusterfs数据卷
# 创建挂载点
mkdir /gfs_data
# 开机挂载,更新/etc/fstab
glusterfs-1:/data /gfs_data glusterfs backupvolfile-server=glusterfs-2,use-readdirp=no,log- level=WARNING,log-file=/var/log/gluster.log 0 0
# 挂载
mount -a
本文标签: CentOs 安装GlusterFs
版权声明:本文标题:CentOs 安装GlusterFs 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1699085363a327304.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论