etcd 3.x 重要配置参数
作者:互联网
[Unit] Description=Etcd Server After=network.target After=network-online.target Wants=network-online.target Documentation=http://github.com/coreos [Service] Type=notify WorkingDirectory={{ ETCD_DIR }} ExecStart={{ ETCD_DIR }}/bin/etcd \ --name={{ name }} \ --initial-advertise-peer-urls=http://{{ ansible_default_ipv4.address }}:10001 \ --listen-peer-urls=http://{{ ansible_default_ipv4.address }}:10001 \ --listen-client-urls=http://{{ ansible_default_ipv4.address }}:20002,http://{{ ansible_default_ipv4.address }}:20001 \ --advertise-client-urls=http://{{ ansible_default_ipv4.address }}:20002,http://{{ ansible_default_ipv4.address }}:20001 \ --initial-cluster-token={{ cluster_token }} \ --initial-cluster {{ ETCD_NODES }} \ --initial-cluster-state={{ CLUSTER_STATE }} \ --data-dir={{ ETCD_DIR }}/data \ --auto-compaction-mode=periodic --auto-compaction-retention=120h \ --max-request-bytes '33554432' --quota-backend-bytes '8589934592' Restart=always RestartSec=5 LimitNOFILE=1000000 [Install] WantedBy=multi-user.target
In v3.3.3, --auto-compaction-mode=revision --auto-compaction-retention=1000
automatically Compact
on "latest revision" - 1000
every 5-minute (when latest revision is 30000, compact on revision 29000). Previously, --auto-compaction-mode=periodic --auto-compaction-retention=72h
automatically Compact
with 72-hour retention windown for every 7.2-hour. Now, Compact
happens, for every 1-hour but still with 72-hour retention window. Previously, --auto-compaction-mode=periodic --auto-compaction-retention=30m
automatically Compact
with 30-minute retention windown for every 3-minute. Now, Compact
happens, for every 30-minute but still with 30-minute retention window. Periodic compactor keeps recording latest revisions for every compaction period when given period is less than 1-hour, or for every 1-hour when given compaction period is greater than 1-hour (e.g. 1-hour when --auto-compaction-mode=periodic --auto-compaction-retention=24h
). For every compaction period or 1-hour, compactor uses the last revision that was fetched before compaction period, to discard historical data. The retention window of compaction period moves for every given compaction period or hour. For instance, when hourly writes are 100 and --auto-compaction-mode=periodic --auto-compaction-retention=24h
, v3.2.x
, v3.3.0
, v3.3.1
, and v3.3.2
compact revision 2400, 2640, and 2880 for every 2.4-hour, while v3.3.3
or later compacts revision 2400, 2500, 2600 for every 1-hour. Furthermore, when --auto-compaction-mode=periodic --auto-compaction-retention=30m
and writes per minute are about 1000, v3.3.0
, v3.3.1
, and v3.3.2
compact revision 30000, 33000, and 36000, for every 3-minute, while v3.3.3
or later compacts revision 30000, 60000, and 90000, for every 30-minute.
2.--max-request-bytes
etcd Raft消息最大字节数,ETCD默认该值为1.5M; 但是很多业务场景发现同步数据的时候1.5M完全没法满足要求,所以提前确定初始值很重要; 由于1.5M导致我们线上的业务无法写入元数据的问题,
我们紧急升级之后把该值修改为默认32M,但是官方推荐的是10M,大家可以根据业务情况自己调整
3.--quota-backend-bytes
ETCDdb数据大小,默认是2G,当数据达到2G的时候就不允许写入,必须对历史数据进行压缩才能继续写入; 参加1里面说的,我们启动的时候就应该提前确定大小,官方推荐是8G,这里我们也使用8G的配置
标签:hour,--,auto,配置,参数,compaction,etcd,every,retention 来源: https://www.cnblogs.com/leleyao/p/15754258.html