1. 程式人生 > 其它 >etcd 3.x 重要配置引數

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

Inv3.3.3,--auto-compaction-mode=revision --auto-compaction-retention=1000automaticallyCompacton"latest revision" - 1000every 5-minute (when latest revision is 30000, compact on revision 29000). Previously,--auto-compaction-mode=periodic --auto-compaction-retention=72hautomaticallyCompactwith 72-hour retention windown for every 7.2-hour.Now,Compacthappens, for every 1-hour but still with 72-hour retention window.Previously,--auto-compaction-mode=periodic --auto-compaction-retention=30mautomaticallyCompactwith 30-minute retention windown for every 3-minute.Now,Compacthappens, 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, andv3.3.2compact revision 2400, 2640, and 2880 for every 2.4-hour, whilev3.3.3or latercompacts revision 2400, 2500, 2600 for every 1-hour. Furthermore, when--auto-compaction-mode=periodic --auto-compaction-retention=30mand writes per minute are about 1000,v3.3.0,v3.3.1, andv3.3.2compact revision 30000, 33000, and 36000, for every 3-minute, whilev3.3.3or latercompacts 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的配置