# RKE2 etcd 分開 wal-dir & data-dir 目錄 * data-dir 是 etcd 的數據目錄,用於存放所有的持久化數據,包括數據快照。 * WAL 文件:記錄了對數據的所有變更操作,就是 ETCD 的 log。 * 可以透過 `--wal-dir` 參數來指定 WAL 的存放目錄,在性能敏感或數據可靠性要求極高的情境下,分離 wal-dir 是推薦的做法,但需注意配置一致性和存儲設備的性能。如果未配置 wal-dir,預寫日誌將存儲在 data-dir 中。  ``` machineGlobalConfig: cni: calico disable-kube-proxy: false etcd-arg: - data-dir=/etcd/data - wal-dir=/etcd/wal etcd-expose-metrics: false etcd-extra-mount: - /etcd:/etcd ``` * 驗證 ``` $ ls -l /etcd total 0 drwx------ 1 root root 12 Jan 10 10:43 data drwx------ 1 root root 84 Jan 10 10:43 wal ``` ``` $ cat /etc/rancher/rke2/config.yaml.d/50-rancher.yaml { "agent-token": "d7qb9frh5xm2mv7c472gjsl94gk2gvtw8w9cjj2nt75mmqfnvfw78m", "cni": "calico", "disable-kube-proxy": false, "etcd-arg": [ "data-dir=/etcd/data", "wal-dir=/etcd/wal" ], "etcd-expose-metrics": false, "etcd-extra-mount": [ "/etcd:/etcd" ], ...... ``` ``` $ cat /var/lib/rancher/rke2/server/db/etcd/config advertise-client-urls: https://192.168.11.70:2379 auto-compaction-mode: periodic auto-compaction-retention: 1h0m0s client-transport-security: cert-file: /var/lib/rancher/rke2/server/tls/etcd/server-client.crt client-cert-auth: true key-file: /var/lib/rancher/rke2/server/tls/etcd/server-client.key trusted-ca-file: /var/lib/rancher/rke2/server/tls/etcd/server-ca.crt data-dir: /etcd/data election-timeout: 5000 experimental-initial-corrupt-check: true experimental-watch-progress-notify-interval: 5000000000 heartbeat-interval: 500 initial-advertise-peer-urls: https://192.168.11.70:2380 initial-cluster: rke2-72c87363=https://192.168.11.70:2380 initial-cluster-state: new listen-client-http-urls: https://127.0.0.1:2382 listen-client-urls: https://127.0.0.1:2379,https://192.168.11.70:2379 listen-metrics-urls: http://127.0.0.1:2381 listen-peer-urls: https://127.0.0.1:2380,https://192.168.11.70:2380 log-outputs: - stderr logger: zap name: rke2-72c87363 peer-transport-security: cert-file: /var/lib/rancher/rke2/server/tls/etcd/peer-server-client.crt client-cert-auth: true key-file: /var/lib/rancher/rke2/server/tls/etcd/peer-server-client.key trusted-ca-file: /var/lib/rancher/rke2/server/tls/etcd/peer-ca.crt quota-backend-bytes: '''6442450944''' snapshot-count: 10000 wal-dir: /etcd/wal ``` ## 參考 https://etcd.io/docs/v3.4/op-guide/configuration/#:~:text=This%20allows%20a%20dedicated%20disk%20to%20be%20used%2C%20and%20helps%20avoid%20io%20competition%20between%20logging%20and%20other%20IO%20operations
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up