1、GlusterFS部署

安装GlusterFS集群的主要目的是为k8s集群提供分布式持久化存储。

GlusterFS部署使用2台服务器,服务名称与IP如下:

1 	db-storagea  	10.1.70.29
2 db-storageb 10.1.70.30

Ubuntu系统服务安装及启动

apt-get install  glusterfs-server
systemctl start glusterd
systemctl enable glusterd
systemctl status glusterd

集群认证

服务器10.1.70.29

gluster peer probe 10.1.70.30

查看集群集群状态

服务器10.1.70.29

命令:gluster peer status

反馈:Number of Peers: 1

服务器10.1.70.30

命令:gluster peer status

反馈:Number of Peers: 1

分别在服务器10.1.70.29,10.1.70.30创建目录

mkdir -p /data/gluster  /data/portal-files  /data/portal-private  /data/portal-config

创建gluster卷并启动卷

创建名称为 : mamm-volume 路径为 :/data/gluster
gluster volume create mamm-volume repl 2 10.1.70.29:/data/gluster 10.1.70.30:/data/gluster
启动mamm-volume卷
gluster volume start mamm-volume gluster volume create portal-files repl 2 10.1.70.29:/data/portal-files 10.1.70.30:/data/portal-files force gluster volume start portal-files gluster volume create portal-private repl 2 10.1.70.29:/data/portal-private 10.1.70.30:/data/portal-private force gluster volume start portal-private gluster volume create portal-config repl 2 10.1.70.29:/data/portal-config 10.1.70.30:/data/portal-config force gluster volume start portal-config

查看卷空间

命令: gluster volume info

Gluster 测试 找台服务器测试

客户端安装  glusterfs-client
mkdir /opt/clusterfstest
挂载
mount -t glusterfs 10.1.70.29:/mamm-volume /opt/clusterfstest

2、Kubernetes使用glusterfs持久化

先决条件

  • 设置 GlusterFS 服务器集群
  • 创建 GlusterFS 卷

创建 endpoints

apiVersion: v1
kind: Endpoints
metadata:
name: glusterfs-cluster
subsets:
- addresses:
- ip: 10.1.70.29
ports:
- port: 24007
- addresses:
- ip: 10.1.70.30
ports:
- port: 24007

subsets字段应填充 GlusterFS 集群中节点的地址。可以在字段中提供任何有效值(从 1 到 65535)端口。

kubectl get endpoints

还需要为这些端点创建一个服务,以便它们能够持久存在

apiVersion: v1
kind: Service
metadata:
name: glusterfs-cluster
spec:
ports:
- port: 20447

3、使用控制器进行挂载

    volumeMounts:
- mountPath: "/var/www/html/web/sites/default/files"
name: portal-files
- mountPath: "/var/www/html/private"
name: portal-private
- mountPath: "/var/www/html/config"
name: portal-config
volumes:
- name: portal-files
glusterfs:
endpoints: glusterfs-cluster
path: portal-files
readOnly: false
- name: portal-private
glusterfs:
endpoints: glusterfs-cluster
path: portal-private
readOnly: false
- name: portal-config
glusterfs:
endpoints: glusterfs-cluster
path: portal-config
readOnly: false

4、在pod内测试

在pod内相关目录创建文件,然后在gluster服务器卷目录查看该文件是否存在

最新文章

  1. 车销宝无线开单PDA 一款互联网+POS神器 无缝与电脑数据同步 无线POS开单解决方案
  2. 无法找到类:java.lang.ClassNotFoundException: com.tt.javaweb.HttpServletRequest问题解决
  3. Excel01-不同的单元格输入同一数据
  4. Laravel-数据库操作笔记
  5. 一道有关球赛队员分配的C++程序题目
  6. 14.5.4 InnoDB File-Per-Table Tablespaces 每个表一个文件
  7. [Android学习笔记]SeekBar的使用
  8. 4.mysql数据库创建,表中创建模具模板脚本,mysql_SQL99标准连接查询(恩,外部连接,全外连接,交叉连接)
  9. HDU 4408 Minimum Spanning Tree 最小生成树计数
  10. typedef和define的详细区别
  11. Linux系统KVM虚拟化技术
  12. xxx.jar或者xxx.war中没有主清单属性和spring-boot-maven-plugin的作用
  13. MVC中如何避免POST请求中出现的重复提交
  14. LeetCode 42 Trapping Rain Water(积水体积)
  15. Castle DynamicProxy creation出现COMException(0x800703fa)错误的解决方案
  16. OGG FOR BIGDATA 安装(修正)
  17. NSURLSession下载和断点续传
  18. luogu p3366 最小生成树模板
  19. FastReport.Net使用:[24]其他控件(邮政编码(Zip Code),网格文本(Cellular Text)以及线性刻度尺(Linear Gauge))
  20. struts2学习(15)struts2防重复提交

热门文章

  1. python的namespace的理解
  2. 通过C#在控制台输出各种图形文字
  3. Solution -「多校联训」查拉图斯特拉如是说
  4. traceroute实用命令总结
  5. 从观察者设计模式的角度理解Zookeeper中的Watcher
  6. Linux性能优化之磁盘I/O调优
  7. 面试突击25:sleep和wait有什么区别
  8. mysql 事务 隔离性 锁
  9. Python中编码encode()与解码decode()
  10. 号外!号外!这个敏捷高效的大数据bi看板可以免费使用啦!