1
1
[role="xpack"]
2
- [testenv="trial "]
2
+ [testenv="basic "]
3
3
[[encrypting-communications-hosts]]
4
4
=== Add nodes to your cluster
5
5
6
- Up to this point, we have used a cluster with a single {es} node to get up and
7
- running with the {stack}. An {es} _node_ is a single server that is part of your
8
- cluster and stores pieces of your data called _shards_.
9
-
10
- You can add more nodes to your cluster and optionally designate specific purposes
11
- for each node. For example, you can allocate master nodes, data nodes, ingest
12
- nodes, machine learning nodes, and dedicated coordinating nodes. For details
13
- about each node type, see {ref}/modules-node.html[Nodes].
14
-
15
- In a single cluster, you can have as many nodes as you want but they must be
16
- able to communicate with each other. The communication between nodes in a
17
- cluster is handled by the {ref}/modules-transport.html[transport module]. To
18
- secure your cluster, you must ensure that the internode communications are
19
- encrypted.
20
-
21
- NOTE: In this tutorial, we add more nodes by installing more copies of {es} on
22
- the same machine. By default, {es} binds to loopback addresses for HTTP and
23
- transport communication. That is fine for the purposes of this tutorial and for
24
- downloading and experimenting with {es} in a test or development environment.
25
- When you are deploying a production environment, however, you are generally
26
- adding nodes on different machines so that your cluster is resilient to outages
27
- and avoids data loss. In a production scenario, there are additional
28
- requirements that are not covered in this tutorial. See
29
- {ref}/bootstrap-checks.html#dev-vs-prod-mode[Development vs production mode] and
30
- {ref}/add-elasticsearch-nodes.html[Adding nodes to your cluster].
6
+ You can add more nodes to your cluster and optionally designate specific
7
+ purposes for each node. For example, you can allocate master nodes, data nodes,
8
+ ingest nodes, machine learning nodes, and dedicated coordinating nodes. For
9
+ details about each node type, see {ref}/modules-node.html[Nodes].
31
10
32
11
Let's add two nodes to our cluster!
33
12
@@ -39,103 +18,142 @@ in a separate folder. You can simply repeat the steps that you used to install
39
18
{stack-gs}/get-started-elastic-stack.html#install-elasticsearch[Getting started with the {stack}]
40
19
tutorial.
41
20
42
- . Update the `ES_PATH_CONF/elasticsearch.yml` file on each node:
21
+ . Generate certificates for the two new nodes.
43
22
+
44
23
--
45
- .. Enable the {es} {security-features}.
46
- .. Ensure that the nodes share the same {ref}/cluster.name.html[`cluster.name`].
47
- .. Give each node a unique {ref}/node.name.html[`node.name`].
48
- .. Specify the minimum number of master-eligible nodes that must be available to
49
- form a cluster. By default, each node is eligible to be elected as the
50
- {ref}/modules-node.html#master-node[master node] and control the cluster. To
51
- avoid a _split brain_ scenario where multiple nodes elect themselves as the
52
- master, use the `discovery.zen.minimum_master_nodes` setting.
53
-
54
- By default, if you run multiple {es} nodes on the same machine, it
55
- automatically uses free ports in the range 9200-9300 for HTTP and 9300-9400 for
56
- transport. If you want to assign specific port numbers to each node, however,
57
- you can add {ref}/modules-transport.html[TCP transport settings]. You can then
58
- provide a list of these seed nodes,
59
- which is used to discover the nodes in your cluster.
24
+ For example, run the following command:
60
25
61
- For example, add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
62
- file on the first node:
26
+ ["source","sh",subs="attributes,callouts"]
27
+ ----------------------------------------------------------------------
28
+ ./bin/elasticsearch-certutil cert \
29
+ --ca elastic-stack-ca.p12 \ <1>
30
+ --multiple
31
+ ----------------------------------------------------------------------
32
+ // NOTCONSOLE
33
+ <1> Use the certificate authority that you created in <<encrypting-communications-certificates>>.
63
34
64
- [source,yaml]
65
- ----
66
- xpack.security.enabled: true
67
- cluster.name: test-cluster
68
- node.name: node-1
69
- discovery.zen.minimum_master_nodes: 2
70
- transport.tcp.port: 9301
71
- discovery.zen.ping.unicast.hosts: ["localhost:9302", "localhost:9303"]
72
- ----
35
+ You are prompted for information about each new node. Specify `node-2` and
36
+ `node-3` for the instance names. For the purposes of this tutorial, specify the
37
+ same IP address (`127.0.0.1,::1`) and DNS name (`localhost`) for each node.
73
38
74
- Add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
39
+ You are prompted to enter the password for your CA. You are also prompted to
40
+ create a password for each certificate.
41
+
42
+ By default, the command produces a zip file named `certificate-bundle.zip`,
43
+ which contains the generated certificates and keys.
44
+ --
45
+
46
+ . Decompress the `certificate-bundle.zip` file. For example:
47
+ +
48
+ --
49
+ ["source","sh",subs="attributes,callouts"]
50
+ ----------------------------------------------------------------------
51
+ unzip certificate-bundle.zip
52
+
53
+ Archive: certificate-bundle.zip
54
+ creating: node-2/
55
+ inflating: node-2/node-2.p12
56
+ creating: node-3/
57
+ inflating: node-3/node-3.p12
58
+ ----------------------------------------------------------------------
59
+ // NOTCONSOLE
60
+
61
+ The `certificate-bundle.zip` file contains a folder for each of your nodes. Each
62
+ folder contains a single PKCS#12 keystore that includes a node certificate,
63
+ node key, and CA certificate.
64
+ --
65
+
66
+ . Create a folder to contain certificates in the configuration directory of each
67
+ {es} node. For example, create a `certs` folder in the `config` directory.
68
+
69
+ . Copy the appropriate certificate to the configuration directory on each node.
70
+ For example, copy the `node-2.p12` file into the `config/certs` directory on the
71
+ second node and the `node-3.p12` into the `config/certs` directory on the third
72
+ node.
73
+
74
+ . Specify the name of the cluster and give each node a unique name.
75
+ +
76
+ --
77
+ For example, add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
75
78
file on the second node:
76
79
77
80
[source,yaml]
78
81
----
79
- xpack.security.enabled: true
80
82
cluster.name: test-cluster
81
83
node.name: node-2
82
- discovery.zen.minimum_master_nodes: 2
83
- transport.tcp.port: 9302
84
- discovery.zen.ping.unicast.hosts: ["localhost:9301", "localhost:9303"]
85
84
----
86
85
87
86
Add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
88
87
file on the third node:
89
88
90
89
[source,yaml]
91
90
----
92
- xpack.security.enabled: true
93
91
cluster.name: test-cluster
94
92
node.name: node-3
95
- discovery.zen.minimum_master_nodes: 2
96
- transport.tcp.port: 9303
97
- discovery.zen.ping.unicast.hosts: ["localhost:9301", "localhost:9302"]
98
93
----
99
94
100
- TIP: In these examples, we have not specified the `transport.host`,
101
- `transport.bind_host`, or `transport.publish_host` settings, so they default to
102
- the `network.host` value. If you have not specified the `network.host` setting,
103
- it defaults to `_local_`, which represents the loopback addresses for the system.
95
+ NOTE: In order to join the same cluster as the first node, they must share the
96
+ same `cluster.name` value.
104
97
105
- If you choose different cluster names, node names, host names, or ports, you
106
- must substitute the appropriate values in subsequent steps as well.
107
98
--
108
99
109
- . Start each {es} node. For example, if you installed {es} with a `.tar.gz`
110
- package, run the following command from each {es} directory:
100
+ . (Optional) Provide seed addresses to help your nodes discover other nodes with
101
+ which to form a cluster.
111
102
+
112
103
--
113
- ["source","sh",subs="attributes,callouts"]
114
- ----------------------------------------------------------------------
115
- ./bin/elasticsearch
116
- ----------------------------------------------------------------------
104
+ For example, add the following setting in the `ES_PATH_CONF/elasticsearch.yml`
105
+ file:
117
106
118
- See {ref}/starting-elasticsearch.html[Starting {es}].
107
+ [source,yaml]
108
+ ----
109
+ discovery.seed_hosts: ["localhost"]
110
+ ----
111
+
112
+ The default value for this setting is `127.0.0.1, [::1]`, therefore it isn't
113
+ actually required in this tutorial. When you want to form a cluster with nodes
114
+ on other hosts, however, you must use this setting to provide a list of
115
+ master-eligible nodes to seed the discovery process. For more information, see
116
+ {ref}/modules-discovery-hosts-providers.html[Discovery].
117
+ --
118
+
119
+ . On each node, enable TLS for transport communications. You must also configure
120
+ each node to identify itself using its signed certificate.
121
+ +
122
+ --
123
+ include::tutorial-tls-internode.asciidoc[tag=enable-tls]
124
+ --
125
+
126
+ . On each node, store the password for the PKCS#12 file in the {es} keystore.
127
+ +
128
+ --
129
+ include::tutorial-tls-internode.asciidoc[tag=secure-passwords]
119
130
131
+ On the second node, supply the password that you created for the `node-2.p12`
132
+ file. On the third node, supply the password that you created for the
133
+ `node-3.p12` file.
120
134
--
121
135
122
- . (Optional) Restart {kib}. For example, if you installed
123
- {kib} with a `.tar.gz` package, run the following command from the {kib}
124
- directory:
136
+ . Start each {es} node. For example, if you installed {es} with a `.tar.gz`
137
+ package, run the following command from each {es} directory:
125
138
+
126
139
--
127
140
["source","sh",subs="attributes,callouts"]
128
141
----------------------------------------------------------------------
129
- ./bin/kibana
142
+ ./bin/elasticsearch
130
143
----------------------------------------------------------------------
131
144
132
- See {kibana-ref}/start-stop.html[Starting and stopping {kib}].
145
+ See {ref}/starting-elasticsearch.html[Starting {es}].
146
+
147
+ If you encounter errors, you can see some common problems and solutions in
148
+ <<trb-security-ssl>>.
133
149
--
134
150
135
- . Verify that your cluster now contains three nodes. For example, use the
136
- {ref}/cluster-health.html[cluster health API]:
151
+ . Verify that your cluster now contains three nodes.
137
152
+
138
153
--
154
+ For example, log into {kib} with the `elastic` built-in user. Go to
155
+ *Dev Tools > Console* and run the {ref}/cluster-health.html[cluster health API]:
156
+
139
157
[source,js]
140
158
----------------------------------
141
159
GET _cluster/health
@@ -161,3 +179,14 @@ Now that you have multiple nodes, your data can be distributed across the
161
179
cluster in multiple primary and replica shards. For more information about the
162
180
concepts of clusters, nodes, and shards, see
163
181
{ref}/getting-started.html[Getting started with {es}].
182
+
183
+ [float]
184
+ [[encrypting-internode-nextsteps]]
185
+ === What's next?
186
+
187
+ Congratulations! You've encrypted communications between the nodes in your
188
+ cluster and can pass the
189
+ {ref}/bootstrap-checks-xpack.html#bootstrap-checks-tls[TLS bootstrap check].
190
+
191
+ If you want to encrypt communications between other products in the {stack}, see
192
+ <<encrypting-communications>>.
0 commit comments