fix(content): harden dashboard and etcd examples

This commit is contained in:
yeasy
2026-06-03 00:40:40 -07:00
parent 8dd6a556c8
commit 130d03bf65
2 changed files with 8 additions and 8 deletions
+7 -7
View File
@@ -59,14 +59,14 @@ hello world
### 15.2.2 Docker 镜像方式运行
镜像名称为 `quay.io/coreos/etcd`可以通过下面的命令启动 `etcd` 服务监听到 `2379` `2380` 端口
镜像名称为 `quay.io/coreos/etcd`可以通过下面的命令启动单机实验用 `etcd` 服务并只把 `2379` `2380` 映射到宿主机回环地址
> **版本说明** 示例中使用 `v3.5.29` 标签请访问 [etcd 官方发布页](https://github.com/etcd-io/etcd/releases) 获取最新可用版本标签。
```bash
$ docker run \
-p 2379:2379 \
-p 2380:2380 \
-p 127.0.0.1:2379:2379 \
-p 127.0.0.1:2380:2380 \
--mount type=bind,source=/tmp/etcd-data.tmp,destination=/etcd-data \
--name etcd-gcr-v3.5.29 \
quay.io/coreos/etcd:v3.5.29 \
@@ -74,10 +74,10 @@ quay.io/coreos/etcd:v3.5.29 \
--name s1 \
--data-dir /etcd-data \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://<HOST_IP>:2379 \
--advertise-client-urls http://127.0.0.1:2379 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://<HOST_IP>:2380 \
--initial-cluster s1=http://<HOST_IP>:2380 \
--initial-advertise-peer-urls http://127.0.0.1:2380 \
--initial-cluster s1=http://127.0.0.1:2380 \
--initial-cluster-token tkn \
--initial-cluster-state new \
--log-level info \
@@ -85,7 +85,7 @@ quay.io/coreos/etcd:v3.5.29 \
--log-outputs stderr
```
其中 `listen-*` 可以绑定 `0.0.0.0` 监听所有网卡 `advertise-*` 应填写其他节点或客户端**实际可访问的主机地址**不能直接写成 `0.0.0.0`
上面示例仅用于单机实验宿主机端口限定在 `127.0.0.1`因此不会把未启用 TLS etcd 直接暴露到外部网络容器内部的 `listen-*` 可以绑定 `0.0.0.0` 监听容器网卡 `advertise-*` 应填写其他节点或客户端**实际可访问的主机地址**不能直接写成 `0.0.0.0`生产或多节点环境不要使用明文 HTTP 暴露 etcd应结合固定内网地址TLS客户端证书认证和防火墙访问控制
打开新的终端按照上一步的方法测试 `etcd` 是否成功启动