前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Etcd 维护

Etcd 维护

作者头像
用户5760343
发布2019-10-29 14:49:42
2.3K0
发布2019-10-29 14:49:42
举报
文章被收录于专栏:sktjsktj

1、设置保留历史时间 --auto-compaction-retention

保持一个小时的历史

$ etcd --auto-compaction-retention=1

压缩到修订版本3

$ etcdctl compact 3

2、压缩后,反碎片化 etcdctl defrag

3、备份快照 etcdctl snapshot save backup.db

4、快照恢复

etcdctl snapshot restore snapshot.db \ --name m1 \ --initial-cluster m1=http:/host1:2380,m2=http://host2:2380,m3=http://host3:2380 \ --initial-cluster-token etcd-cluster-1 \ --initial-advertise-peer-urls http://host1:2380
etcdctl snapshot restore snapshot.db \ --name m1 \ --initial-cluster m1=http:/host1:2380,m2=http://host2:2380,m3=http://host3:2380 \ --initial-cluster-token etcd-cluster-1 \ --initial-advertise-peer-urls http://host1:2380

etcdctl snapshot restore snapshot.db --name m2 --initial-cluster m1=http:/host1:2380,m2=http://host2:2380,m3=http://host3:2380 --initial-cluster-token etcd-cluster-1 --initial-advertise-peer-urls http://host2:2380 $ etcdctl snapshot restore snapshot.db --name m3 --initial-cluster m1=http:/host1:2380,m2=http://host2:2380,m3=http://host3:2380 --initial-cluster-token etcd-cluster-1 --initial-advertise-peer-urls http://host3:2380

启动

etcd \ --name m1 \ --listen-client-urls http://host1:2379 \ --advertise-client-urls http://host1:2379 \ --listen-peer-urls http://host1:2380 &
etcd \ --name m1 \ --listen-client-urls http://host1:2379 \ --advertise-client-urls http://host1:2379 \ --listen-peer-urls http://host1:2380 &

etcd --name m2 --listen-client-urls http://host2:2379 --advertise-client-urls http://host2:2379 --listen-peer-urls http://host2:2380 & $ etcd --name m3 --listen-client-urls http://host3:2379 --advertise-client-urls http://host3:2379 --listen-peer-urls http://host3:2380 &

5、配置空间配额

设置非常小的 16MB 配额

$ etcd --quota-backend-bytes=16777216

删除多读的键空间将把集群带回配额限制,因此警告能被接触:

获取当前修订版本

$ etcdctl --endpoints=:2379 endpoint status [{"Endpoint":"127.0.0.1:2379","Status":{"header":{"cluster_id":8925027824743593106,"member_id":13803658152347727308,"revision":1516,"raft_term":2},"version":"2.3.0+git","dbSize":17973248,"leader":13803658152347727308,"raftIndex":6359,"raftTerm":2}}]

压缩所有旧有修订版本

$ etdctl compact 1516 compacted revision 1516

反碎片化过度空间

$ etcdctl defrag Finished defragmenting etcd member[127.0.0.1:2379]

解除警告

$ etcdctl alarm disarm memberID:13803658152347727308 alarm:NOSPACE

测试put被再度容许

$ etdctl put newkey 123 OK

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019.10.25 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 保持一个小时的历史
  • 压缩到修订版本3
  • 启动
  • 设置非常小的 16MB 配额
  • 删除多读的键空间将把集群带回配额限制,因此警告能被接触:
  • 获取当前修订版本
  • 压缩所有旧有修订版本
  • 反碎片化过度空间
  • 解除警告
  • 测试put被再度容许
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档