zoukankan      html  css  js  c++  java
  • etcd空间配额2G限制优化

    一.简单说明

    etcd的数据库空间配额大小默认限制为2G,当数据达到2G的时候就不允许写入。这里如果想继续写入,必须对历史数据进行压缩,或者调整etcd数据库的空间配额大小限制。

    二.具体配置

    当空间配额满载时,会提示mvcc: database space exceeded

    2.1 查看etcd的配额使用量

    [root@k8s001 ~]# export ETCDCTL_API=3
    [root@k8s001 ~]# etcdctl endpoint status --write-out table
    +----------------+------------------+---------+---------+-----------+-----------+------------+
    |    ENDPOINT    |        ID        | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
    +----------------+------------------+---------+---------+-----------+-----------+------------+
    | 127.0.0.1:2379 | 8e9e05c52164694d |  3.3.10 |  7.8 MB |      true |         3 |    3085227 |
    +----------------+------------------+---------+---------+-----------+-----------+------------+
    

    2.2 开启磁盘碎片整理

    1.获取历史版本号

    [root@k8s001 ~]# export ETCDCTL_API=3
    [root@k8s001 ~]# etcdctl endpoint status --write-out="json" | egrep -o '"revision":[0-9]*' | egrep -o '[0-9].*'
    8991138
    

    2.压缩旧版本

    [root@k8s001 ~]# etcdctl compact 8991138
    compacted revision 8991138
    

    3.etcd进行碎片整理

    [root@k8s001 ~]# etcdctl defrag  
    Finished defragmenting etcd member[127.0.0.1:2379]
    

    4.查看etcd数据库大小

    [root@k8s001 ~]# etcdctl endpoint status --write-out table
    +----------------+------------------+---------+---------+-----------+-----------+------------+
    |    ENDPOINT    |        ID        | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
    +----------------+------------------+---------+---------+-----------+-----------+------------+
    | 127.0.0.1:2379 | 8e9e05c52164694d |  3.3.10 |  1.3 MB |      true |         3 |    3089646 |
    +----------------+------------------+---------+---------+-----------+-----------+------------+
    

    2.3 修改etcd空间配额大小

    1.修改systemd文件

    [root@k8s001 ~]# cat /etc/systemd/system/etcd.service 
    ......
    --quota-backend-bytes=10240000000 # 这里单位是字节
    ......
    

    2.重启etcd服务

    [root@k8s001 ~]# systemctl daemon-reload
    [root@k8s001 ~]# systemctl restart etcd
    
  • 相关阅读:
    Python 安装Twisted 提示python version 2.7 required,which was not found in the registry
    Openfire Strophe开发中文乱码问题
    css div 垂直居中
    How to create custom methods for use in spring security expression language annotations
    How to check “hasRole” in Java Code with Spring Security?
    Android 显示/隐藏 应用图标
    Android 当媒体变更后,通知其他应用重新扫描
    文件上传那些事儿
    专题:点滴Javascript
    主流动画实现方式总结
  • 原文地址:https://www.cnblogs.com/yuhaohao/p/13292085.html
Copyright © 2011-2022 走看看