@@ -113,7 +113,7 @@ endif::[]
113113ifeval::["{release-state}"!="unreleased"]
114114[source,sh,subs="attributes"]
115115----
116- docker run --name es-node01 --net elastic -p 9200:9200 -it docker.elastic.co/elasticsearch/elasticsearch:{version}
116+ docker run --name es01 --net elastic -p 9200:9200 -it docker.elastic.co/elasticsearch/elasticsearch:{version}
117117----
118118
119119endif::[]
@@ -130,15 +130,15 @@ to the `http_ca.crt` certificate, which you'll use in the next step.
130130+
131131[source,sh]
132132----
133- docker exec -it es-node01 /bin/bash -c "find /usr/share/elasticsearch -name http_ca.crt"
133+ docker exec -it es01 /bin/bash -c "find /usr/share/elasticsearch -name http_ca.crt"
134134----
135135
136136. Copy the `http_ca.crt` security certificate from your Docker container to
137137your local machine.
138138+
139139[source,sh]
140140----
141- docker cp es-node01 :/usr/share/elasticsearch/config/tls_auto_config_<timestamp>/http_ca.crt .
141+ docker cp es01 :/usr/share/elasticsearch/config/tls_auto_config_<timestamp>/http_ca.crt .
142142----
143143`<timestamp>`:: The timestamp of when the auto-configuration process created
144144the security files directory in your Docker container.
@@ -226,6 +226,57 @@ endif::[]
226226 .. Log in to {kib} as the `elastic` user with the password that was generated
227227 when you started {es}.
228228
229+ [[docker-enroll-nodes]]
230+ [discrete]
231+ ==== Enroll additional nodes
232+
233+ When you start {es} for the first time, the installation process configures a single-node cluster by default. This process also generates an enrollment token
234+ and prints it to your terminal. If you want a node to join an existing cluster,
235+ start the new node with the generated enrollment token.
236+
237+ --
238+ .Generating enrollment tokens
239+ ****
240+ The enrollment token is valid for 30 minutes. If you need to generate a
241+ new enrollment token, run the
242+ {ref}/create-enrollment-token.html[`elasticsearch-create-enrollment-token`] tool
243+ on your existing node. This tool is available in the {es} `bin` directory of the
244+ Docker container.
245+
246+ For example, run the following command on the existing `es01` node to
247+ generate an enrollment token for new {es} nodes:
248+
249+ [source,sh]
250+ ----
251+ docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node
252+ ----
253+ ****
254+ --
255+
256+ . In the terminal where you started your first node, copy the generated
257+ enrollment token for adding new {es} nodes.
258+
259+ . On your new node, start {es} and include the generated enrollment token.
260+ +
261+ [source,sh,subs="attributes"]
262+ ----
263+ docker run -e ENROLLMENT_TOKEN="<token>" --name es02 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:{version}
264+ ----
265+ +
266+ {es} is now configured to join the existing cluster.
267+
268+ If you experience issues where the container where your first node is running
269+ exits when your second node starts, explicitly set values for the JVM heap size.
270+ To {ref}/docker.html#docker-set-heap-size[manually configure the heap size],
271+ include the `ES_JAVA_OPTS` variable and set values for `-Xms` and `-Xmx` when
272+ starting each node. For example, the following command starts node `es02` and
273+ sets the minimum and maximum JVM heap size to 1 GB:
274+
275+ [source,sh,subs="attributes"]
276+ ----
277+ docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e ENROLLMENT_TOKEN="<token>" --name es02 -p 9201:9200 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:{version}
278+ ----
279+
229280[[docker-generate]]
230281[discrete]
231282==== Generate passwords and enrollment tokens
@@ -237,7 +288,7 @@ For example, to reset the password for the `elastic` user:
237288
238289[source,sh]
239290----
240- docker exec -it es-node01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
291+ docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
241292----
242293
243294If you need to generate new enrollment tokens for {kib} or {es} nodes, run the
@@ -248,7 +299,7 @@ For example, to generate a new enrollment token for {kib}:
248299
249300[source,sh]
250301----
251- docker exec -it es-node01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
302+ docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
252303----
253304
254305
@@ -261,7 +312,7 @@ To remove the containers and their network, run:
261312[source,sh]
262313----
263314docker network rm elastic
264- docker rm es-node01
315+ docker rm es01
265316docker rm kib01
266317----
267318
@@ -380,8 +431,8 @@ and join the lines before running this command.
380431--
381432["source","sh"]
382433----
383- docker exec es-node01 /bin/bash -c "bin/elasticsearch-setup-passwords \
384- auto --batch --url https://es-node01 :9200"
434+ docker exec es01 /bin/bash -c "bin/elasticsearch-setup-passwords \
435+ auto --batch --url https://es01 :9200"
385436----
386437
387438IMPORTANT: Make a note of the generated passwords.
@@ -406,13 +457,13 @@ ifeval::["{release-state}"!="unreleased"]
406457 kib01:
407458 image: docker.elastic.co/kibana/kibana:${VERSION}
408459 container_name: kib01
409- depends_on: {"es-node01 ": {"condition": "service_healthy"}}
460+ depends_on: {"es01 ": {"condition": "service_healthy"}}
410461 ports:
411462 - 5601:5601
412463 environment:
413464 SERVERNAME: localhost
414- ELASTICSEARCH_URL: https://es-node01 :9200
415- ELASTICSEARCH_HOSTS: https://es-node01 :9200
465+ ELASTICSEARCH_URL: https://es01 :9200
466+ ELASTICSEARCH_HOSTS: https://es01 :9200
416467 ELASTICSEARCH_USERNAME: kibana_system
417468 **ELASTICSEARCH_PASSWORD: CHANGEME**
418469 ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES: $CERTS_DIR/ca/ca.crt
@@ -453,15 +504,15 @@ volumes by running `docker-compose -f elastic-docker-tls.yml down -v`.
453504Specifying settings for {es} and {{kib}} directly in the compose file is a convenient way to get started,
454505but loading settings from a file is preferable once you get past the experimental stage.
455506
456- For example, to use `es-node01 .yml` as the configuration file for the `es-node01 ` {es} node,
507+ For example, to use `es01 .yml` as the configuration file for the `es01 ` {es} node,
457508you can create a bind mount in the volumes section.
458509
459510["source","yaml"]
460511----
461512 volumes:
462513 - data01:/usr/share/elasticsearch/data
463514 - certs:$CERTS_DIR
464- - ./es-node01 .yml:/usr/share/elasticsearch/config/elasticsearch.yml
515+ - ./es01 .yml:/usr/share/elasticsearch/config/elasticsearch.yml
465516----
466517
467518Similarly, to load {kib} settings from a file, you overwrite `/usr/share/kibana/config/kibana.yml`:
0 commit comments