更改etcd默认存储2G限制

系统版本
[root@aaaaaa etcd]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.4 (Ootpa)
etcd 版本
[root@aaaaaa etcd]# /data/etcd/etcd-v3.5.15-linux-amd64/etcdctl version
etcdctl version: 3.5.15
API version: 3.5
etcd 配置文件
[root@aaaaaa etcd]# cat /data/etcd/ceshinodefile.yml 
name: node1
data-dir: /data/etcd1/etcddata
listen-client-urls: 'http://192.168.73.114:12379'
advertise-client-urls: 'http://192.168.73.114:12379'
listen-peer-urls: 'http://192.168.73.114:12380'
initial-advertise-peer-urls: 'http://192.168.73.114:12380'
initial-cluster: node1=http://192.168.73.114:12380
initial-cluster-token: etcd-cluster-1
initial-cluster-state: new
# quota-backend-bytes: 8589934592 # 更改etcd存储为8G
etcd 启动脚本
[root@aaaaaa etcd]# cat /data/etcd/etcd-start.sh 
#!/bin/bash
nohup /data/etcd/etcd-v3.5.15-linux-amd64/etcd \
--auto-compaction-retention=1 \
--max-request-bytes=10485760 \
--auth-token jwt \
--config-file=/data/etcd/ceshinodefile.yml \
>> /data/etcd/etcd.log 2>&1 &
etcd 状态查看脚本
[root@aaaaaa etcd]# cat /data/etcd/status-cat.sh 
#!/bin/bash
# 设置环境变量
export ETCDCTL_API=3
ENDPOINTS="http://192.168.73.114:12379"

# 查询集群成员
/data/etcd/etcd-v3.5.15-linux-amd64/etcdctl  \
--endpoints=${ENDPOINTS} \
member list

# 查询端点状态
/data/etcd/etcd-v3.5.15-linux-amd64/etcdctl  \
--endpoints=${ENDPOINTS} \
endpoint status --write-out=table

# 持续查看etcd的状态
# for i in {1..10000};do echo $i;sh -x /data/etcd/status-cat.sh;sleep 5;done
etcd 数据压缩清理脚本
[root@aaaaaa etcd]# cat /data/etcd/compact-defrag-etcd.sh 
#!/bin/bash
# vi compact-defrag-etcd.sh
export ETCDCTL_DIAL_TIMEOUT=30s
# 如果遇到空间不足,可以这样操作:
# 获取当前版本号
rev=$(ETCDCTL_API=3 /data/etcd/etcd-v3.5.15-linux-amd64/etcdctl --endpoints http://192.168.73.114:12379  endpoint status --write-out="json" | egrep -o '"revision":[0-9]*' | egrep -o '[0-9]*')
# 压缩所有旧版本
ETCDCTL_API=3 /data/etcd/etcd-v3.5.15-linux-amd64/etcdctl --endpoints http://192.168.73.114:12379 compact $rev
# 去碎片化
ETCDCTL_API=3 /data/etcd/etcd-v3.5.15-linux-amd64/etcdctl --endpoints http://192.168.73.114:12379 defrag
# 取消警报
ETCDCTL_API=3 /data/etcd/etcd-v3.5.15-linux-amd64/etcdctl --endpoints http://192.168.73.114:12379  alarm disarm
# 测试通过
ETCDCTL_API=3 /data/etcd/etcd-v3.5.15-linux-amd64/etcdctl --endpoints http://192.168.73.114:12379 put key0 1234
etcd 批量测试数据写入脚本
# [root@aaaaaa etcd]# cat /data/etcd/test-data-to-etcd.py 

# 安装pyetcd包
# python3 -m pip install etcd-sdk-python

# 导入所需的库和模块
from concurrent
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值