tutorial-tls-addnodes.asciidoc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[encrypting-communications-hosts]]
  4. === Add nodes to your cluster
  5. You can add more nodes to your cluster and optionally designate specific
  6. purposes for each node. For example, you can allocate master nodes, data nodes,
  7. ingest nodes, machine learning nodes, and dedicated coordinating nodes. For
  8. details about each node type, see <<modules-node>>.
  9. Let's add two nodes to our cluster!
  10. . Install two additional copies of {es}. It's possible to run multiple {es}
  11. nodes using a shared installation. In this tutorial, however, we're keeping
  12. things simple by using the `zip` or `tar.gz` packages and by putting each copy
  13. in a separate folder. You can simply repeat the steps that you used to install
  14. {es} in the
  15. {stack-gs}/get-started-elastic-stack.html#install-elasticsearch[Getting started with the {stack}]
  16. tutorial.
  17. . Generate certificates for the two new nodes.
  18. +
  19. --
  20. For example, run the following command:
  21. ["source","sh",subs="attributes,callouts"]
  22. ----------------------------------------------------------------------
  23. ./bin/elasticsearch-certutil cert \
  24. --ca elastic-stack-ca.p12 \ <1>
  25. --multiple
  26. ----------------------------------------------------------------------
  27. <1> Use the certificate authority that you created in <<encrypting-communications-certificates>>.
  28. You are prompted for information about each new node. Specify `node-2` and
  29. `node-3` for the instance names. For the purposes of this tutorial, specify the
  30. same IP address (`127.0.0.1,::1`) and DNS name (`localhost`) for each node.
  31. You are prompted to enter the password for your CA. You are also prompted to
  32. create a password for each certificate.
  33. By default, the command produces a zip file named `certificate-bundle.zip`,
  34. which contains the generated certificates and keys.
  35. --
  36. . Decompress the `certificate-bundle.zip` file. For example:
  37. +
  38. --
  39. ["source","sh",subs="attributes,callouts"]
  40. ----------------------------------------------------------------------
  41. unzip certificate-bundle.zip
  42. Archive: certificate-bundle.zip
  43. creating: node-2/
  44. inflating: node-2/node-2.p12
  45. creating: node-3/
  46. inflating: node-3/node-3.p12
  47. ----------------------------------------------------------------------
  48. The `certificate-bundle.zip` file contains a folder for each of your nodes. Each
  49. folder contains a single PKCS#12 keystore that includes a node certificate,
  50. node key, and CA certificate.
  51. --
  52. . Create a folder to contain certificates in the configuration directory of each
  53. {es} node. For example, create a `certs` folder in the `config` directory.
  54. . Copy the appropriate certificate to the configuration directory on each node.
  55. For example, copy the `node-2.p12` file into the `config/certs` directory on the
  56. second node and the `node-3.p12` into the `config/certs` directory on the third
  57. node.
  58. . Specify the name of the cluster and give each node a unique name.
  59. +
  60. --
  61. For example, add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
  62. file on the second node:
  63. [source,yaml]
  64. ----
  65. cluster.name: test-cluster
  66. node.name: node-2
  67. ----
  68. Add the following settings to the `ES_PATH_CONF/elasticsearch.yml`
  69. file on the third node:
  70. [source,yaml]
  71. ----
  72. cluster.name: test-cluster
  73. node.name: node-3
  74. ----
  75. NOTE: In order to join the same cluster as the first node, they must share the
  76. same `cluster.name` value.
  77. --
  78. . (Optional) Provide seed addresses to help your nodes discover other nodes with
  79. which to form a cluster.
  80. +
  81. --
  82. For example, add the following setting in the `ES_PATH_CONF/elasticsearch.yml`
  83. file:
  84. [source,yaml]
  85. ----
  86. discovery.seed_hosts: ["localhost"]
  87. ----
  88. The default value for this setting is `127.0.0.1, [::1]`, therefore it isn't
  89. actually required in this tutorial. When you want to form a cluster with nodes
  90. on other hosts, however, you must use this setting to provide a list of
  91. master-eligible nodes to seed the discovery process. For more information, see
  92. <<modules-discovery-hosts-providers>>.
  93. --
  94. . On each node, enable TLS for transport communications. You must also configure
  95. each node to identify itself using its signed certificate.
  96. +
  97. --
  98. include::tutorial-tls-internode.asciidoc[tag=enable-tls]
  99. --
  100. . On each node, store the password for the PKCS#12 file in the {es} keystore.
  101. +
  102. --
  103. include::tutorial-tls-internode.asciidoc[tag=secure-passwords]
  104. On the second node, supply the password that you created for the `node-2.p12`
  105. file. On the third node, supply the password that you created for the
  106. `node-3.p12` file.
  107. --
  108. . Start each {es} node. For example, if you installed {es} with a `.tar.gz`
  109. package, run the following command from each {es} directory:
  110. +
  111. --
  112. ["source","sh",subs="attributes,callouts"]
  113. ----------------------------------------------------------------------
  114. ./bin/elasticsearch
  115. ----------------------------------------------------------------------
  116. See <<starting-elasticsearch>>.
  117. If you encounter errors, you can see some common problems and solutions in
  118. <<trb-security-ssl>>.
  119. --
  120. . Verify that your cluster now contains three nodes.
  121. +
  122. --
  123. For example, log into {kib} with the `elastic` built-in user. Go to
  124. *Dev Tools > Console* and run the <<cluster-health,cluster health API>>:
  125. [source,console]
  126. ----------------------------------
  127. GET _cluster/health
  128. ----------------------------------
  129. Confirm the `number_of_nodes` in the response from this API.
  130. You can also use the <<cat-nodes,cat nodes API>> to identify the master
  131. node:
  132. [source,console]
  133. ----------------------------------
  134. GET _cat/nodes?v=true
  135. ----------------------------------
  136. The node that has an asterisk(*) in the `master` column is the elected master
  137. node.
  138. --
  139. Now that you have multiple nodes, your data can be distributed across the
  140. cluster in multiple primary and replica shards. For more information about the
  141. concepts of clusters, nodes, and shards, see
  142. <<getting-started>>.
  143. [discrete]
  144. [[encrypting-internode-nextsteps]]
  145. === What's next?
  146. Congratulations! You've encrypted communications between the nodes in your
  147. cluster and can pass the
  148. <<bootstrap-checks-tls,TLS bootstrap check>>.
  149. If you want to encrypt communications between other products in the {stack}, see
  150. <<encrypting-communications>>.