mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-26 03:35:31 +00:00
Remove blank lines after code block markers
This commit is contained in:
@@ -20,14 +20,12 @@ $ curl -L https://github.com/etcd-io/etcd/releases/download/v3.5.17/etcd-v3.5.17
|
||||
$ tar xzvf etcd-v3.5.17-linux-amd64.tar.gz
|
||||
$ cd etcd-v3.5.17-linux-amd64
|
||||
```
|
||||
|
||||
解压后,可以看到文件包括
|
||||
|
||||
```bash
|
||||
$ ls
|
||||
Documentation README-etcdctl.md README.md READMEv2-etcdctl.md etcd etcdctl
|
||||
```
|
||||
|
||||
其中 `etcd` 是服务主文件,`etcdctl` 是提供给用户的命令客户端,其他文件是支持文档。
|
||||
|
||||
下面将 `etcd` `etcdctl` 文件放到系统可执行目录 (例如 `/usr/local/bin/`)。
|
||||
@@ -35,7 +33,6 @@ Documentation README-etcdctl.md README.md READMEv2-etcdctl.md etcd etcdctl
|
||||
```bash
|
||||
$ sudo cp etcd* /usr/local/bin/
|
||||
```
|
||||
|
||||
默认 `2379` 端口处理客户端的请求,`2380` 端口用于集群各成员间的通信。启动 `etcd` 显示类似如下的信息:
|
||||
|
||||
```bash
|
||||
@@ -44,7 +41,6 @@ $ etcd
|
||||
2017-12-03 11:18:34.411579 I | embed: listening for peers on http://localhost:2380
|
||||
2017-12-03 11:18:34.411938 I | embed: listening for client requests on localhost:2379
|
||||
```
|
||||
|
||||
此时,可以使用 `etcdctl` 命令进行测试,设置和获取键值 `testkey: "hello world"`,检查 `etcd` 服务是否启动成功:
|
||||
|
||||
```bash
|
||||
@@ -58,7 +54,6 @@ $ etcdctl get testkey
|
||||
testkey
|
||||
hello world
|
||||
```
|
||||
|
||||
说明 etcd 服务已经成功启动了。
|
||||
|
||||
### 15.2.2 Docker 镜像方式运行
|
||||
@@ -86,7 +81,6 @@ quay.io/coreos/etcd:v3.5.17 \
|
||||
--logger zap \
|
||||
--log-outputs stderr
|
||||
```
|
||||
|
||||
打开新的终端按照上一步的方法测试 `etcd` 是否成功启动。
|
||||
|
||||
### 15.2.3 macOS 中运行
|
||||
|
||||
@@ -117,7 +117,6 @@ networks:
|
||||
-
|
||||
subnet: 172.16.238.0/24
|
||||
```
|
||||
|
||||
使用 `docker compose up` 启动集群之后使用 `docker exec` 命令登录到任一节点测试 `etcd` 集群。
|
||||
|
||||
```bash
|
||||
|
||||
@@ -80,7 +80,6 @@ OPTIONS:
|
||||
--user="" username[:password] for authentication (prompt if password is not supplied)
|
||||
-w, --write-out="simple" set the output format (fields, json, protobuf, simple, table)
|
||||
```
|
||||
|
||||
### 15.4.1 数据库操作
|
||||
|
||||
数据库操作围绕对键值和目录的 CRUD (符合 REST 风格的一套操作:Create) 完整生命周期的管理。
|
||||
@@ -95,7 +94,6 @@ etcd 在键的组织上采用了层次化的空间结构 (类似于文件系统
|
||||
$ etcdctl put /testdir/testkey "Hello world"
|
||||
OK
|
||||
```
|
||||
|
||||
#### get
|
||||
|
||||
获取指定键的值。例如
|
||||
@@ -107,7 +105,6 @@ $ etcdctl get testkey
|
||||
testkey
|
||||
hello
|
||||
```
|
||||
|
||||
支持的选项为
|
||||
|
||||
`--sort` 对结果进行排序
|
||||
@@ -122,7 +119,6 @@ hello
|
||||
$ etcdctl del testkey
|
||||
1
|
||||
```
|
||||
|
||||
### 15.4.2 非数据库操作
|
||||
|
||||
#### watch
|
||||
@@ -137,7 +133,6 @@ PUT
|
||||
testkey
|
||||
2
|
||||
```
|
||||
|
||||
#### member
|
||||
|
||||
通过 `list`、`add`、`update`、`remove` 命令列出、添加、更新、删除 etcd 实例到 etcd 集群中。
|
||||
|
||||
Reference in New Issue
Block a user