# Enabling security in a cluster with two nodes in Elasticsearch

**URL:** https://discuss.elastic.co/t/enabling-security-in-a-cluster-with-two-nodes-in-elasticsearch/252536
**Category:** Elasticsearch
**Created:** [October 19, 2020, 11:54am UTC](https://discuss.elastic.co/t/enabling-security-in-a-cluster-with-two-nodes-in-elasticsearch/252536 "2020-10-19T11:54:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Techmod](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@Techmod](https://discuss.elastic.co/u/Techmod)
#### Post date: [October 19, 2020, 11:54am UTC](https://discuss.elastic.co/t/enabling-security-in-a-cluster-with-two-nodes-in-elasticsearch/252536/1 "2020-10-19T11:54:57Z")

</div>

Hi There,  
I'm trying to enable security feature in Elasticsearch nodes but whenever I turn on "xpack.security.enabled: true" , my Elasticsearch won't start at all. How can I resolve this?

here's my configuration on both of Elasticsearch nodes:

Node 1:

> ```
> # ======================== Elasticsearch Configuration =========================
> #
> # NOTE: Elasticsearch comes with reasonable defaults for most settings.
> # Before you set out to tweak and tune the configuration, make sure you
> # understand what are you trying to accomplish and the consequences.
> #
> # The primary way of configuring a node is via this file. This template lists
> # the most important settings you may want to configure for a production cluster.
> #
> # Please consult the documentation for further information on configuration options:
> # https://www.elastic.co/guide/en/elasticsearch/reference/index.html
> #
> # ---------------------------------- Cluster -----------------------------------
> #
> # Use a descriptive name for your cluster:
> #
> cluster.name: "elastic-a"
> #
> # ------------------------------------ Node ------------------------------------
> #
> # Use a descriptive name for the node:
> #
> node.name: "elastic-master"
> node.master: true
> node.data: true
> #
> # Add custom attributes to the node:
> #
> #node.attr.rack: r1
> #
> # ----------------------------------- Paths ------------------------------------
> #
> # Path to directory where to store the data (separate multiple locations by comma):
> #
> path.data: /var/lib/elasticsearch
> #
> # Path to log files:
> #
> path.logs: /var/log/elasticsearch
> #
> # ----------------------------------- Memory -----------------------------------
> #
> # Lock the memory on startup:
> #
> #bootstrap.memory_lock: true
> #
> # Make sure that the heap size is set to about half the memory available
> # on the system and that the owner of the process is allowed to use this
> # limit.
> #
> # Elasticsearch performs poorly when the system is swapping the memory.
> #
> # ---------------------------------- Network -----------------------------------
> #
> # Set the bind address to a specific IP (IPv4 or IPv6):
> #
> network.host: 192.168.143.30
> #http.host: 0.0.0.0
> #
> # Set a custom port for HTTP:
> #
> #http.port: 9200
> #
> # For more information, consult the network module documentation.
> #
> # --------------------------------- Discovery ----------------------------------
> #
> # Pass an initial list of hosts to perform discovery when this node is started:
> # The default list of hosts is ["127.0.0.1", "[::1]"]
> #
> discovery.seed_hosts: ["192.168.143.30", "192.168.143.23"]
> #
> # Bootstrap the cluster using an initial set of master-eligible nodes:
> #
> cluster.initial_master_nodes: ["elastic-master","elastic-slave"]
> #
> # For more information, consult the discovery and cluster formation module documentation.
> #
> # ---------------------------------- Gateway -----------------------------------
> #
> # Block initial recovery after a full cluster restart until N nodes are started:
> #
> #gateway.recover_after_nodes: 3
> #
> # For more information, consult the gateway module documentation.
> #
> # ---------------------------------- Various -----------------------------------
> #
> # Require explicit names when deleting indices:
> #
> #action.destructive_requires_name: true
> action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*
> xpack.security.enabled: true
> 
> ```

Node 2:

> ```
> # ======================== Elasticsearch Configuration =========================
> #
> # NOTE: Elasticsearch comes with reasonable defaults for most settings.
> # Before you set out to tweak and tune the configuration, make sure you
> # understand what are you trying to accomplish and the consequences.
> #
> # The primary way of configuring a node is via this file. This template lists
> # the most important settings you may want to configure for a production cluster.
> #
> # Please consult the documentation for further information on configuration options:
> # https://www.elastic.co/guide/en/elasticsearch/reference/index.html
> #
> # ---------------------------------- Cluster -----------------------------------
> #
> # Use a descriptive name for your cluster:
> #
> cluster.name: "elastic-a"
> #
> # ------------------------------------ Node ------------------------------------
> #
> # Use a descriptive name for the node:
> #
> node.name: "elastic-slave"
> node.master: true
> node.data: true
> #
> # Add custom attributes to the node:
> #
> #node.attr.rack: r1
> #
> # ----------------------------------- Paths ------------------------------------
> #
> # Path to directory where to store the data (separate multiple locations by comma):
> #
> path.data: /var/lib/elasticsearch
> #
> # Path to log files:
> #
> path.logs: /var/log/elasticsearch
> #
> # ----------------------------------- Memory -----------------------------------
> #
> # Lock the memory on startup:
> #
> #bootstrap.memory_lock: true
> #
> # Make sure that the heap size is set to about half the memory available
> # on the system and that the owner of the process is allowed to use this
> # limit.
> #
> # Elasticsearch performs poorly when the system is swapping the memory.
> #
> # ---------------------------------- Network -----------------------------------
> #
> # Set the bind address to a specific IP (IPv4 or IPv6):
> #
> network.host: 192.168.143.23
> #http.host: 0.0.0.0
> #
> # Set a custom port for HTTP:
> #
> #http.port: 9200
> #
> # For more information, consult the network module documentation.
> #
> # --------------------------------- Discovery ----------------------------------
> #
> # Pass an initial list of hosts to perform discovery when this node is started:
> # The default list of hosts is ["127.0.0.1", "[::1]"]
> #
> discovery.seed_hosts: ["192.168.143.30", "192.168.143.23"]
> #
> # Bootstrap the cluster using an initial set of master-eligible nodes:
> #
> cluster.initial_master_nodes: ["elastic-master","elastic-slave"]
> #
> # For more information, consult the discovery and cluster formation module documentation.
> #
> # ---------------------------------- Gateway -----------------------------------
> #
> # Block initial recovery after a full cluster restart until N nodes are started:
> #
> #gateway.recover_after_nodes: 3
> #
> # For more information, consult the gateway module documentation.
> #
> # ---------------------------------- Various -----------------------------------
> #
> # Require explicit names when deleting indices:
> #
> #action.destructive_requires_name: true
> action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*
> xpack.security.enabled: true
> 
> ```

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [October 19, 2020, 12:09pm UTC](https://discuss.elastic.co/t/enabling-security-in-a-cluster-with-two-nodes-in-elasticsearch/252536/2 "2020-10-19T12:09:52Z")

</div>

What are the logs?

---

<div class="post-metadata">

### Author: ![Techmod](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@Techmod](https://discuss.elastic.co/u/Techmod)
#### Post date: [October 19, 2020, 1:00pm UTC](https://discuss.elastic.co/t/enabling-security-in-a-cluster-with-two-nodes-in-elasticsearch/252536/3 "2020-10-19T13:00:15Z")

</div>

```
[2020-10-12T10:02:18,546][INFO][o.e.l.LicenseService] [elastic-master] license [e8afa8f0-4a2f-4dc1-b398-06581bb98b9b] mode [basic] - valid
[2020-10-12T10:02:18,547][INFO][o.e.x.s.s.SecurityStatusChangeListener] [elastic-master] Active license is now [BASIC]; Security is enabled
[2020-10-12T10:02:18,559][INFO][o.e.g.GatewayService] [elastic-master] recovered [21] indices into cluster_state
[2020-10-12T10:02:20,155][DEBUG][o.e.a.s.TransportSearchAction] [elastic-master] All shards failed for phase: [query]
[2020-10-12T10:02:20,155][DEBUG][o.e.a.s.TransportSearchAction] [elastic-master] All shards failed for phase: [query]
[2020-10-12T10:02:20,162][WARN][r.suppressed] [elastic-master] path: /.kibana/_count, params: {index=.kibana}
org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:534) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:305) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:563) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:384) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.lambda$performPhaseOnShard$0(AbstractSearchAsyncAction.java:219) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction$2.doRun(AbstractSearchAsyncAction.java:284) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.5.0.jar:7.5.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:830) [?:?]
[2020-10-12T10:02:20,157][WARN][r.suppressed] [elastic-master] path: /.kibana_task_manager/_count, params: {index=.kibana_task_manager}
org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:534) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:305) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:563) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.onShardFailure(AbstractSearchAsyncAction.java:384) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.lambda$performPhaseOnShard$0(AbstractSearchAsyncAction.java:219) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.action.search.AbstractSearchAsyncAction$2.doRun(AbstractSearchAsyncAction.java:284) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773) [elasticsearch-7.5.0.jar:7.5.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.5.0.jar:7.5.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:830) [?:?]
[2020-10-12T10:02:21,363][INFO][o.e.c.r.a.AllocationService] [elastic-master] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[.kibana_task_manager_1][0]]]).
[2020-10-12T10:02:28,018][INFO][o.e.c.m.MetaDataIndexTemplateService] [elastic-master] adding template [.management-beats] for index patterns [.management-beats]
[2020-10-12T10:02:28,697][DEBUG][o.e.a.s.m.TransportMasterNodeAction] [elastic-master] Get stats for datafeed '_all'

[2020-10-12T10:36:38,437][DEBUG][o.e.a.s.m.TransportMasterNodeAction] [elastic-master] Get stats for datafeed '_all'
[2020-10-12T10:36:42,400][INFO][o.e.n.Node] [elastic-master] stopping ...
[2020-10-12T10:36:42,426][INFO][o.e.x.w.WatcherService] [elastic-master] stopping watch service, reason [shutdown initiated]
[2020-10-12T10:36:42,428][INFO][o.e.x.w.WatcherLifeCycleService] [elastic-master] watcher has stopped and shutdown
[2020-10-12T10:36:42,915][INFO][o.e.x.m.p.l.CppLogMessageHandler] [elastic-master] [controller/2262] [Main.cc@150] Ml controller exiting
[2020-10-12T10:36:42,917][INFO][o.e.x.m.p.NativeController] [elastic-master] Native controller process has stopped - no new native processes can be started
[2020-10-12T10:36:43,184][INFO][o.e.n.Node] [elastic-master] stopped
[2020-10-12T10:36:43,184][INFO][o.e.n.Node] [elastic-master] closing ...
[2020-10-12T10:36:43,209][INFO][o.e.n.Node] [elastic-master] closed
```

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [October 19, 2020, 1:09pm UTC](https://discuss.elastic.co/t/enabling-security-in-a-cluster-with-two-nodes-in-elasticsearch/252536/4 "2020-10-19T13:09:51Z")

</div>

Hey,

You can't just set this to true with no additional configuration. There is a number of things you need to set yourself, see our docs in [https://www.elastic.co/guide/en/elasticsearch/reference/7.9/configuring-security.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.9/configuring-security.html) and [https://www.elastic.co/guide/en/elasticsearch/reference/7.9/encrypting-communications.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.9/encrypting-communications.html), it should be enough to get you going!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 16, 2020, 1:09pm UTC](https://discuss.elastic.co/t/enabling-security-in-a-cluster-with-two-nodes-in-elasticsearch/252536/5 "2020-11-16T13:09:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
