create-enrollment-token.asciidoc 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. [roles="xpack"]
  2. [[create-enrollment-token]]
  3. == elasticsearch-create-enrollment-token
  4. The `elasticsearch-create-enrollment-token` command creates enrollment tokens for
  5. {es} nodes and {kib} instances.
  6. [discrete]
  7. === Synopsis
  8. [source,shell]
  9. ----
  10. bin/elasticsearch-create-enrollment-token
  11. [-f, --force] [-h, --help] [-E <KeyValuePair>] [-s, --scope] [--url]
  12. ----
  13. [discrete]
  14. === Description
  15. NOTE: `elasticsearch-create-enrollment-token` can only be used with {es} clusters
  16. that have been <<configuring-stack-security,auto-configured for security>>.
  17. Use this command to create enrollment tokens, which you can use to enroll new
  18. {es} nodes to an existing cluster or configure {kib} instances to communicate
  19. with an existing {es} cluster that has security features enabled.
  20. The command generates (and subsequently removes) a temporary user in the
  21. <<file-realm,file realm>> to run the request that creates enrollment tokens.
  22. IMPORTANT: You cannot use this tool if the file realm is disabled in your
  23. `elasticsearch.yml` file.
  24. This command uses an HTTP connection to connect to the cluster and run the user
  25. management requests. The command automatically attempts to establish the connection
  26. over HTTPS by using the `xpack.security.http.ssl` settings in
  27. the `elasticsearch.yml` file. If you do not use the default configuration directory,
  28. ensure that the `ES_PATH_CONF` environment variable returns the
  29. correct path before you run the `elasticsearch-create-enrollment-token` command. You can
  30. override settings in your `elasticsearch.yml` file by using the `-E` command
  31. option. For more information about debugging connection failures, see
  32. <<trb-security-setup>>.
  33. [discrete]
  34. [[create-enrollment-token-parameters]]
  35. === Parameters
  36. `-E <KeyValuePair>`:: Configures a standard {es} or {xpack} setting.
  37. `-f, --force`:: Forces the command to run against an unhealthy cluster.
  38. `-h, --help`:: Returns all of the command parameters.
  39. `-s, --scope`:: Specifies the scope of the generated token. Supported values are `node` and `kibana`.
  40. `--url`:: Specifies the base URL (hostname and port of the local node) that the tool uses to submit API
  41. requests to {es}. The default value is determined from the settings in your
  42. `elasticsearch.yml` file. If `xpack.security.http.ssl.enabled` is set to `true`,
  43. you must specify an HTTPS URL.
  44. [discrete]
  45. === Examples
  46. The following command creates an enrollment token for enrolling an {es} node into a cluster:
  47. [source,shell]
  48. ----
  49. bin/elasticsearch-create-enrollment-token -s node
  50. ----
  51. The following command creates an enrollment token for enrolling a {kib} instance into a cluster.
  52. The specified URL indicates where the elasticsearch-create-enrollment-token tool attempts to reach the
  53. local {es} node:
  54. [source,shell]
  55. ----
  56. bin/elasticsearch-create-enrollment-token -s kibana --url "https://172.0.0.3:9200"
  57. ----