kubernetes --- Glusterfs
gluster配额管理
gluster volume quota cloud enable
gluster volume quota cloud limit-usage /mail/pbs 20MB
dd if=/dev/zero of=test bs=1MB count=100
添加一个服务器加入到存储池中,前提是他们能被DNS服务器解析到。让你的防火墙能够通过probe requests/replies :
gluster peer probe server
2.反向操作,删除一个服务器从存储池中。
gluster peer detach server4
gluster volume create k8s-volume transport tcp replica 2 10.16.16.35:/data/glusterfs_data 10.16.16.36:/data/glusterfs_data 10.16.16.37:/data/glusterfs_data 10.16.16.38:/data/glusterfs_data
gluster volume info
====
# 先安装 gluster 源
$ yum install centos-release-gluster -y
# 安装 glusterfs 组件
$ yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma glusterfs-geo-replication glusterfs-devel
## 创建 glusterfs 目录
$ mkdir /opt/glusterd
## 修改 glusterd 目录
$ sed -i 's/var\/lib/opt/g' /etc/glusterfs/glusterd.vol
# 启动 glusterfs
$ systemctl start glusterd.service
# 设置开机启动
$ systemctl enable glusterd.service
#查看状态
$ systemctl status glusterd.service
$ vi /etc/hosts
172.20.0.113 sz-pg-oam-docker-test-001.tendcloud.com
172.20.0.114 sz-pg-oam-docker-test-002.tendcloud.com
172.20.0.115 sz-pg-oam-docker-test-003.tendcloud.com
# 开放端口
$ iptables -I INPUT -p tcp --dport 24007 -j ACCEPT
# 创建存储目录
$ mkdir /opt/gfs_data
# 添加节点到 集群
# 执行操作的本机不需要probe 本机
[root@sz-pg-oam-docker-test-001 ~]#
gluster peer probe sz-pg-oam-docker-test-002.tendcloud.com
gluster peer probe sz-pg-oam-docker-test-003.tendcloud.com
# 查看集群状态
$ gluster peer status
Number of Peers: 2
Hostname: sz-pg-oam-docker-test-002.tendcloud.com
Uuid: f25546cc-2011-457d-ba24-342554b51317
State: Peer in Cluster (Connected)
Hostname: sz-pg-oam-docker-test-003.tendcloud.com
Uuid: 42b6cad1-aa01-46d0-bbba-f7ec6821d66d
State: Peer in Cluster (Connected)
# 创建分布卷
$ gluster volume create k8s-volume transport tcp sz-pg-oam-docker-test-001.tendcloud.com:/opt/gfs_data sz-pg-oam-docker-test-002.tendcloud.com:/opt/gfs_data sz-pg-oam-docker-test-003.tendcloud.com:/opt/gfs_data force
# 查看volume状态
$ gluster volume info
Volume Name: k8s-volume
Type: Distribute
Volume ID: 9a3b0710-4565-4eb7-abae-1d5c8ed625ac
Status: Created
Snapshot Count: 0
Number of Bricks: 3
Transport-type: tcp
Bricks:
Brick1: sz-pg-oam-docker-test-001.tendcloud.com:/opt/gfs_data
Brick2: sz-pg-oam-docker-test-002.tendcloud.com:/opt/gfs_data
Brick3: sz-pg-oam-docker-test-003.tendcloud.com:/opt/gfs_data
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
# 启动 分布卷
$ gluster volume start k8s-volume
Glusterfs调优.
# 开启 指定 volume 的配额
$ gluster volume quota k8s-volume enable
gluster volume set gfs_disk network.ping-timeout 5
# 限制 指定 volume 的配额
$ gluster volume quota k8s-volume limit-usage / 1TB
# 设置 cache 大小, 默认32MB
$ gluster volume set k8s-volume performance.cache-size 4GB
# 设置 io 线程, 太大会导致进程崩溃
$ gluster volume set k8s-volume performance.io-thread-count 16
# 设置 网络检测时间, 默认42s
$ gluster volume set k8s-volume network.ping-timeout 10
# 设置 写缓冲区的大小, 默认1M
$ gluster volume set k8s-volume performance.write-behind-window-size 1024MB