etcd_dbsize 只能使用2G限制修改
etcd DB 空间配额大小默认限制为2G,当数据达到2G的时候就不允许写入.
1. 查看 etcd的 使用情况
[root@master1 ~]# export ETCDCTL_API=3 [root@master1 ~]# etcdctl endpoint status --write-out table +----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+ | ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS | +----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+ | 127.0.0.1:2379 | 3de693f1d3a82371 | 3.4.9 | 16 MB | false | false | 4 | 4088148 | 4088148 | | +----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
2. 获取历史版本号
[root@master1 ~]# etcdctl endpoint status --write-out="json" | egrep -o '"revision":[0-9]*' | egrep -o '[0-9].*' 3120107
3. 压缩旧版本
[root@master1 ~]# etcdctl compact 3120107 compacted revision 3120107
4. 整理磁盘碎片
[root@master1 ~]# etcdctl defrag Finished defragmenting etcd member[127.0.0.1:2379]
5. 再次查看etcd db大小
[root@master1 ~]# etcdctl endpoint status --write-out table +----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+ | ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS | +----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+ | 127.0.0.1:2379 | 3de693f1d3a82371 | 3.4.9 | 2.0 MB | false | false | 4 | 4088322 | 4088322 | | +----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
6. 修改etcd 配置调整大小
[root@master1 ~]# vim /lib/systemd/system/etcd.service [Unit] Description=Etcd Server After=network.target After=network-online.target Wants=network-online.target [Service] Type=notify WorkingDirectory=/data/etcd/ EnvironmentFile=-/etc/etcd/etcd.conf User=etcd # set GOMAXPROCS to number of processors ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --quota-backend-bytes=10240000000" Restart=on-failure LimitNOFILE=65536 [Install] WantedBy=multi-user.target
7. 重启
[root@master1 ~]# systemctl daemon-reload
[root@master1 ~]# systemctl restart etcd