Skip to content

Commit 9106efc

Browse files
authored
update emqx content (#2452)
* update emqx content * emqx: address review comments
1 parent 5086d42 commit 9106efc

File tree

1 file changed

+17
-42
lines changed

1 file changed

+17
-42
lines changed

emqx/content.md

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,51 +32,35 @@ The EMQX broker runs as Linux user `emqx` in the docker container.
3232

3333
All EMQX Configuration in [`etc/emqx.conf`](https://github.com/emqx/emqx/blob/master/apps/emqx/etc/emqx.conf) can be configured via environment variables.
3434

35-
By default, the environment variables with `EMQX_` prefix are mapped to key-value pairs in configuration files.
36-
37-
You can change the prefix by overriding `HOCON_ENV_OVERRIDE_PREFIX`.
38-
3935
Example:
4036

41-
```bash
42-
EMQX_LISTENERS__SSL__DEFAULT__ACCEPTORS <--> listeners.ssl.default.acceptors
43-
EMQX_ZONES__DEFAULT__MQTT__MAX_PACKET_SIZE <--> zones.default.mqtt.max_packet_size
44-
```
37+
EMQX_DASHBOARD__DEFAULT_PASSWORD <--> dashboard.default_password
38+
EMQX_NODE__COOKIE <--> node.cookie
39+
EMQX_LISTENERS__SSL__default__ENABLE <--> listeners.ssl.default.enable
40+
41+
Note: The lowercase use of 'default' is not a typo. It is used to demonstrate that lowercase environment variables are equivalent.
4542

4643
- Prefix `EMQX_` is removed
47-
- All upper case letters is replaced with lower case letters
44+
- All upper case letters are replaced with lower case letters
4845
- `__` is replaced with `.`
4946

50-
If `HOCON_ENV_OVERRIDE_PREFIX=DEV_` is set:
51-
52-
```bash
53-
DEV_LISTENER__SSL__EXTERNAL__ACCEPTORS <--> listener.ssl.external.acceptors
54-
DEV_MQTT__MAX_PACKET_SIZE <--> mqtt.max_packet_size
55-
DEV_LISTENERS__TCP__DEFAULT__BIND <--> listeners.tcp.default.bind
56-
```
57-
5847
For example, set MQTT TCP port to 1883
5948

6049
```console
61-
$ docker run -d --name emqx -e DEV_LISTENERS__TCP__DEFAULT__BIND=1883 -p 18083:18083 -p 1883:1883 %%IMAGE%%:latest
50+
$ docker run -d --name emqx -e EMQX_DASHBOARD__DEFAULT_PASSWORD=mysecret -p 18083:18083 -p 1883:1883 %%IMAGE%%:latest
6251
```
6352

64-
Please read more about EMQX configuration in the [official documentation](https://www.emqx.io/docs/en/v5.0/admin/cfg.html).
53+
Please read more about EMQX configuration in the [official documentation](https://docs.emqx.com/en/emqx/latest/configuration/configuration.html)
6554

6655
#### EMQX node name configuration
6756

68-
| Options | Default | Mapped | Description |
69-
|-------------|----------------|--------|----------------------------|
70-
| `EMQX_NAME` | container name | none | EMQX node short name |
71-
| `EMQX_HOST` | container IP | none | EMQX node host, IP or FQDN |
57+
Environment variable `EMQX_NODE__NAME` allows you to specify an EMQX node name, which defaults to `<container_name>@<container_ip>`.
7258

73-
These environment variables are used during container startup phase only in [docker-entrypoint.sh](./docker-entrypoint.sh).
74-
75-
If `EMQX_NAME` and `EMQX_HOST` are set, and `EMQX_NODE_NAME` is not set, `EMQX_NODE_NAME=$EMQX_NAME@$EMQX_HOST`. Otherwise `EMQX_NODE_NAME` is taken verbatim.
59+
If not specified, EMQX determines its node name based on the running environment or other environment variables used for node discovery.
7660

7761
### Cluster
7862

79-
EMQX supports a variety of clustering methods, see our [documentation](https://www.emqx.io/docs/en/latest/deploy/cluster/intro.html) for details.
63+
EMQX supports a variety of clustering methods, see our [documentation](https://docs.emqx.com/en/emqx/latest/deploy/cluster/create-cluster.html) for details.
8064

8165
Let's create a static node list cluster from docker-compose.
8266

@@ -89,8 +73,7 @@ Let's create a static node list cluster from docker-compose.
8973
emqx1:
9074
image: %%IMAGE%%:latest
9175
environment:
92-
- "EMQX_NAME=emqx"
93-
- "EMQX_HOST=node1.emqx.io"
76+
- "EMQX_NODE__NAME=emqx@node1.emqx.io"
9477
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
9578
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io, emqx@node2.emqx.io]"
9679
networks:
@@ -101,8 +84,7 @@ Let's create a static node list cluster from docker-compose.
10184
emqx2:
10285
image: %%IMAGE%%:latest
10386
environment:
104-
- "EMQX_NAME=emqx"
105-
- "EMQX_HOST=node2.emqx.io"
87+
- "EMQX_NODE__NAME=emqx@node2.emqx.io"
10688
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
10789
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io, emqx@node2.emqx.io]"
10890
networks:
@@ -124,7 +106,7 @@ Let's create a static node list cluster from docker-compose.
124106
- View cluster
125107

126108
```bash
127-
$ docker exec -it my_emqx_emqx1_1 sh -c "emqx_ctl cluster status"
109+
$ docker exec -it my_emqx_emqx1_1 sh -c "emqx ctl cluster status"
128110
Cluster status: #{running_nodes => ['emqx@node1.emqx.io','emqx@node2.emqx.io'],
129111
stopped_nodes => []}
130112
```
@@ -134,19 +116,16 @@ Let's create a static node list cluster from docker-compose.
134116
If you want to persist the EMQX docker container, you need to keep the following directories:
135117

136118
- `/opt/emqx/data`
137-
- `/opt/emqx/etc`
138119
- `/opt/emqx/log`
139120

140-
Since data in these folders are partially stored under the `/opt/emqx/data/mnesia/${node_name}`, the user also needs to reuse the same node name to see the previous state. In detail, one needs to specify the two environment variables: `EMQX_NAME` and `EMQX_HOST`, `EMQX_HOST` set as `127.0.0.1` or network alias would be useful.
121+
Since data in these folders are partially stored under the `/opt/emqx/data/mnesia/${node_name}`, the user also needs to reuse the same node name to see the previous state. To make this work, one needs to set the host part of `EMQX_NODE__NAME` to something static that does not change when you restart or recreate the container. It could be container name, hostname or loopback IP address `127.0.0.1` if you only have one node.
141122

142123
In if you use docker-compose, the configuration would look something like this:
143124

144125
```YAML
145126
volumes:
146127
vol-emqx-data:
147128
name: foo-emqx-data
148-
vol-emqx-etc:
149-
name: foo-emqx-etc
150129
vol-emqx-log:
151130
name: foo-emqx-log
152131

@@ -155,19 +134,15 @@ services:
155134
image: %%IMAGE%%:latest
156135
restart: always
157136
environment:
158-
EMQX_NAME: foo_emqx
159-
EMQX_HOST: 127.0.0.1
137+
EMQX_NODE__NAME: foo_emqx@127.0.0.1
160138
volumes:
161139
- vol-emqx-data:/opt/emqx/data
162-
- vol-emqx-etc:/opt/emqx/etc
163140
- vol-emqx-log:/opt/emqx/log
164141
```
165142
166-
Note that `/opt/emqx/etc` contains some essential configuration files. If you want to mount a host directory in the container to persist configuration overrides, you will need to bootstrap it with [default configuration files](https://github.com/emqx/emqx/tree/master/apps/emqx/etc).
167-
168143
### Kernel Tuning
169144
170-
Under Linux host machine, the easiest way is [Tuning guide](https://www.emqx.io/docs/en/latest/deploy/tune.html).
145+
Under Linux host machine, the easiest way is [Tuning guide](https://docs.emqx.com/en/emqx/latest/performance/tune.html).
171146
172147
If you want tune Linux kernel by docker, you must ensure your docker is latest version (>=1.12).
173148

0 commit comments

Comments
 (0)