微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 Kubernetes 中使用 hostpath 和 glusterfs for mysql 挂载目录问题

如何解决在 Kubernetes 中使用 hostpath 和 glusterfs for mysql 挂载目录问题

背景:

我使用 glusterfs 部署了 MysqL 作为后端存储,但观察到数据库速度缓慢,因为我有基于 IOT 的解决方案,该解决方生成 10 毫秒和 50 毫秒的数据,这些数据假设存储在数据库中。 我配置了我的 PV 就像

kind: PersistentVolume
Metadata:
  name: MysqL-pv
  labels:
    type: glusterfs
spec:
  storageClassName: glusterfs-sc
  capacity:
    storage: 245Gi
  accessModes:
    - ReadWriteMany
  glusterfs:
    endpoints: glusterfs-cluster
    path: /gv1
    readOnly: false
  persistentVolumeReclaimPolicy: Retain

由于速度慢,我做了以下步骤

  • 将卷更改并配置为主机路径(glusterfs 砖的挂载目录)

  • 所以 glusterfs 砖在目录 /brick/brick1/gv1 上,我像这样安装了

    mount -t glusterfs server1:/test-volume /mnt/MysqL

我现在的PV如下

spec:
  storageClassName: manual
  capacity:
    storage: 245Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/MysqL"

我可以观察到 Db 的许多改进启动得到了很大的改进。因为 MysqL 是在本地写入,而 glusterfs 是在做复制。

但昨天我观察到 /mnt/MysqL 正在使用根空间而不是 /brick/brick1/gv1 我认为是由于节点的重新启动 glusterfs 暂时失去了法定人数而发生了这种情况。

我怎样才能避免这种情况?如果 /mnt/MysqL 没有挂载 MysqL 应该停止工作。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。