etcd etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=arm64 set


 

 

oot@ubuntu:~/cfssl/etcd# /usr/bin/etcd version
2021-07-01 16:00:41.185752 W | etcdmain: running etcd on unsupported architecture "arm64" since ETCD_UNSUPPORTED_ARCH is set
2021-07-01 16:00:41.185945 E | etcdmain: error verifying flags, 'version' is not a valid flag. See 'etcd --help'.
root@ubuntu:~/cfssl/etcd# 

 

根據提示設置環境變量

# export ETCD_UNSUPPORTED_ARCH=arm64

也可以加入到vi ~/.bash_profile中然后source ~/.bash_profile固化下來

 

root@ubuntu:~/cfssl/etcd# /usr/bin/etcd version
2021-07-01 16:01:14.205081 W | etcdmain: running etcd on unsupported architecture "arm64" since ETCD_UNSUPPORTED_ARCH is set
2021-07-01 16:01:14.205273 E | etcdmain: error verifying flags, 'version' is not a valid flag. See 'etcd --help'.
root@ubuntu:~/cfssl/etcd# 

 

下載

etcd-v3.3.11
root@ubuntu:~/cfssl/etcd# ls etcd-v3.3.11-linux-arm64
Documentation  etcd  etcdctl  README-etcdctl.md  README.md  READMEv2-etcdctl.md
root@ubuntu:~/cfssl/etcd# ./etcd-v3.3.11-linux-arm64/etcd --version
2021-07-01 16:06:22.589156 W | etcdmain: running etcd on unsupported architecture "arm64" since ETCD_UNSUPPORTED_ARCH is set
etcd Version: 3.3.11
Git SHA: 2cf9e51d2
Go Version: go1.10.7
Go OS/Arch: linux/arm64

 采用3.5的可以了

/etcd-v3.5.0-linux-arm64# ./etcd version
{"level":"info","ts":1625128352.6903818,"caller":"etcdmain/etcd.go:72","msg":"Running: ","args":["./etcd","version"]}
{"level":"warn","ts":1625128352.6904616,"caller":"etcdmain/etcd.go:74","msg":"failed to verify flags","error":"'version' is not a valid flag"}

 

 

Jul 01 16:28:54 ubuntu etcd[19548]: {"level":"fatal","ts":1625128134.5026824,"caller":"flags/flag.go:85","msg":"conflicting environment variable is shadowed by corresponding command-line flag (either unset environment variable or disable flag))","envir
Jul 01 16:28:54 ubuntu systemd[1]: etcd.service: Main process exited, code=exited, status=1/FAILURE
Jul 01 16:28:54 ubuntu systemd[1]: etcd.service: Failed with result 'exit-code'.
Jul 01 16:28:54 ubuntu systemd[1]: Failed to start Etcd Server.

 

 

etcd 3.4注意事項:

ETCD3.4版本ETCDCTL_API=3 etcdctl 和 etcd --enable-v2=false 成為了默認配置,如要使用v2版本,執行etcdctl時候需要設置ETCDCTL_API環境變量,例如:ETCDCTL_API=2 etcdctl
ETCD3.4版本會自動讀取環境變量的參數,所以EnvironmentFile文件中有的參數,不需要再次在ExecStart啟動參數中添加,二選一,如同時配置,會觸發以下類似報錯“etcd: conflicting environment variable “ETCD_NAME” is shadowed by corresponding command-line flag (either unset environment variable or disable flag)”
flannel操作etcd使用的是v2的API,而kubernetes操作etcd使用的v3的API
注意:flannel操作etcd使用的是v2的API,而kubernetes操作etcd使用的v3的API,為了兼容flannel,將默認開啟v2版本,故需要配置文件/opt/soft/etcd/etcd.conf中設置 ETCD_ENABLE_V2=“true”

 

root@ubuntu:~/cfssl/etcd# etcd version
{"level":"info","ts":1625130858.3037004,"caller":"etcdmain/etcd.go:72","msg":"Running: ","args":["etcd","version"]}
{"level":"warn","ts":1625130858.3037755,"caller":"etcdmain/etcd.go:74","msg":"failed to verify flags","error":"'version' is not a valid flag"}
root@ubuntu:~/cfssl/etcd# cat /etc/etcd/etcd.conf 
DATA_DIR="/data/k8s/etcd/data"
ETCD_WAL_DIR="/data/k8s/etcd/wal"
ETCD_LISTEN_PEER_URLS="https://10.10.16.82:2380"
ETCD_LISTEN_CLIENT_URLS="https://10.10.16.82:2379"
ETCD_MAX_SNAPSHOTS="5"
ETCD_MAX_WALS="5"
ETCD_NAME="etcd3"
ETCD_SNAPSHOT_COUNT="100000"
ETCD_HEARTBEAT_INTERVAL="100"
ETCD_ELECTION_TIMEOUT="1000"

ETCD_INITIAL_ADVERTISE_PEER_URLS="https://10.10.16.82:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://10.10.16.82:2379"

ETCD_INITIAL_CLUSTER="etcd1=https://10.10.16.251:2380,etcd2=https://10.10.16.47:2380,etcd3=https://10.10.16.82:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
root@ubuntu:~/cfssl/etcd# cat /lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
EnvironmentFile=/etc/etcd/etcd.conf
ExecStart=/usr/bin/etcd   --cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem --peer-cert-file=/opt/etcd/ssl/server.pem --peer-key-file=/opt/etcd/ssl/server-key.pem --trusted-ca-file=/opt/etcd/ssl/ca.pem --peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
root@ubuntu:~/cfssl/etcd# ps -elf | grep etcd
4 S root     31272     1  1  80   0 - 2803937 futex_ 17:10 ?      00:00:03 /usr/bin/etcd --cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem --peer-cert-file=/opt/etcd/ssl/server.pem --peer-key-file=/opt/etcd/ssl/server-key.pem --trusted-ca-file=/opt/etcd/ssl/ca.pem --peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
0 S root     32305 12244  0  80   0 -  1096 pipe_w 17:14 pts/1    00:00:00 grep etcd
root@ubuntu:~/cfssl/etcd# systemctl status etcd
● etcd.service - Etcd Server
   Loaded: loaded (/lib/systemd/system/etcd.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-07-01 17:10:55 HKT; 4min 4s ago
 Main PID: 31272 (etcd)
    Tasks: 28 (limit: 9830)
   CGroup: /system.slice/etcd.service
           └─31272 /usr/bin/etcd --cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem --peer-cert-file=/opt/etcd/ssl/server.pem --peer-key-file=/opt/etcd/ssl/server-key.pem --trusted-ca-file=/opt/etcd/ssl/ca.pem --peer-trusted-c

 

 

root@ubuntu:~/cfssl/etcd# ETCDCTL_API=3 ./etcdctl --cacert  ./etcd2/ca.pem  --cert   ./etcd2/server.pem --key   ./etcd2/server-key.pem  --endpoints=https://10.10.16.47:2379,https://10.10.16.251:2379,https://10.10.16.82:2379  endpoint status --write-out=table
+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|         ENDPOINT          |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|  https://10.10.16.47:2379 | e3cc7a0fe07ff87b |   3.5.0 |   20 kB |      true |      false |       622 |         15 |                 15 |        |
| https://10.10.16.251:2379 | 4b30b4d0c524f887 |  3.3.11 |  262 kB |     false |      false |       622 |         15 |                  0 |        |
|  https://10.10.16.82:2379 | 7f3a1eceedfff110 |   3.5.0 |   20 kB |     false |      false |       622 |         15 |                 15 |        |
+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
root@ubuntu:~/cfssl/etcd# 

 

 

root@ubuntu:~/cfssl/etcd# ETCDCTL_API=3 ./etcdctl --cacert  ./etcd2/ca.pem  --cert   ./etcd2/server.pem --key   ./etcd2/server-key.pem  --endpoints=https://10.10.16.47:2379,https://10.10.16.251:2379,https://10.10.16.82:2379  endpoint status --write-out=table
+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|         ENDPOINT          |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|  https://10.10.16.47:2379 | e3cc7a0fe07ff87b |   3.5.0 |  4.7 MB |      true |      false |       622 |       7260 |               7260 |        |
| https://10.10.16.251:2379 | 4b30b4d0c524f887 |  3.3.11 |  6.1 MB |     false |      false |       622 |       7260 |                  0 |        |
|  https://10.10.16.82:2379 | 7f3a1eceedfff110 |   3.5.0 |  4.7 MB |     false |      false |       622 |       7260 |               7260 |        |
+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
root@ubuntu:~/cfssl/etcd# ETCDCTL_API=3 ./etcdctl --cacert  ./etcd2/ca.pem  --cert   ./etcd2/server.pem --key   ./etcd2/server-key.pem  --endpoints=https://10.10.16.47:2379,https://10.10.16.251:2379,https://10.10.16.82:2379  endpoint health
https://10.10.16.82:2379 is healthy: successfully committed proposal: took = 27.201802ms
https://10.10.16.47:2379 is healthy: successfully committed proposal: took = 27.041661ms
https://10.10.16.251:2379 is healthy: successfully committed proposal: took = 35.976114ms
root@ubuntu:~/cfssl/etcd# ETCDCTL_API=3 ./etcdctl --cacert  ./etcd2/ca.pem  --cert   ./etcd2/server.pem --key   ./etcd2/server-key.pem  --endpoints=https://10.10.16.47:2379,https://10.10.16.251:2379,https://10.10.16.82:2379  member list
4b30b4d0c524f887, started, etcd1, https://10.10.16.251:2380, https://10.10.16.251:2379, false
7f3a1eceedfff110, started, etcd3, https://10.10.16.82:2380, https://10.10.16.82:2379, false
e3cc7a0fe07ff87b, started, etcd2, https://10.10.16.47:2380, https://10.10.16.47:2379, false
root@ubuntu:~/cfssl/etcd# 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM