Configure xpack basic authentication

ES: 7.10.2-SNAPSHOT with basic/trial license.

I want to run elasticsearch with xpack enabled as basic authentication.

xpack.security.enabled: true
xpack.security.authc.realms:
   native.realm1:
    order: 0

running into some error,

{"type": "server", "timestamp": "2020-12-30T19:24:16,441Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "initialized" }
{"type": "server", "timestamp": "2020-12-30T19:24:16,441Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "starting ..." }
{"type": "server", "timestamp": "2020-12-30T19:24:16,655Z", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "publish_address {10.2.0.211:9300}, bound_addresses {0.0.0.0:9300}" }
{"type": "server", "timestamp": "2020-12-30T19:24:17,049Z", "level": "WARN", "component": "o.e.t.TcpTransport", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "exception caught on transport layer [Netty4TcpChannel{localAddress=/10.2.0.211:9300, remoteAddress=/10.2.0.168:48996}], closing connection",
"stacktrace": ["java.lang.IllegalStateException: transport not ready yet to handle incoming requests",
"at org.elasticsearch.transport.TransportService.onRequestReceived(TransportService.java:952) ~[elasticsearch-7.10.2-SNAPSHOT.jar:7.10.2-SNAPSHOT]"
{"type": "server", "timestamp": "2020-12-30T19:24:17,066Z", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }
{"type": "server", "timestamp": "2020-12-30T19:24:17,327Z", "level": "INFO", "component": "o.e.c.c.Coordinator", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "setting initial configuration to VotingConfiguration{RfG3uLsUSze64mBdYnhG9Q,tElKUqcfTmWIvSg4wqVoSg,{bootstrap-placeholder}-elasticsearch-master-2}" }
{"type": "server", "timestamp": "2020-12-30T19:24:17,750Z", "level": "INFO", "component": "o.e.c.s.MasterService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "elected-as-master ([2] nodes joined)[{elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}{n0YikIJ3TTKQXgMOzr9qSw}{10.2.0.211}{10.2.0.211:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, {elasticsearch-master-1}{tElKUqcfTmWIvSg4wqVoSg}{RDZ4JSeYT4-ugjkRY5LyNA}{10.2.0.168}{10.2.0.168:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}{n0YikIJ3TTKQXgMOzr9qSw}{10.2.0.211}{10.2.0.211:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}, added {{elasticsearch-master-1}{tElKUqcfTmWIvSg4wqVoSg}{RDZ4JSeYT4-ugjkRY5LyNA}{10.2.0.168}{10.2.0.168:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}}" }
{"type": "server", "timestamp": "2020-12-30T19:24:17,761Z", "level": "WARN", "component": "o.e.c.s.MasterService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "failing [elected-as-master ([2] nodes joined)[{elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}{n0YikIJ3TTKQXgMOzr9qSw}{10.2.0.211}{10.2.0.211:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, {elasticsearch-master-1}{tElKUqcfTmWIvSg4wqVoSg}{RDZ4JSeYT4-ugjkRY5LyNA}{10.2.0.168}{10.2.0.168:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_]]: failed to commit cluster state version [1]",
"stacktrace": ["org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException: node is no longer master for term 1 while handling publication",
"at org.elasticsearch.cluster.coordination.Coordinator.publish(Coordinator.java:1083) ~[elasticsearch-7.10.2-SNAPSHOT.jar:7.10.2-SNAPSHOT]"
{"type": "server", "timestamp": "2020-12-30T19:24:17,774Z", "level": "INFO", "component": "o.e.c.c.JoinHelper", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "failed to join {elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}{n0YikIJ3TTKQXgMOzr9qSw}{10.2.0.211}{10.2.0.211:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} with JoinRequest{sourceNode={elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}

What am I missing?
Thanks.

There is no error listed there, so it's not clear what problem you are trying to solve sorry.

It also looks like you are running a snapshot build of 7.10.2? I would use 7.10.1 as the last stable release.

There are error from the last two statement 'failed to join...'

{"type": "server", "timestamp": "2020-12-30T19:24:17,761Z", "level": "WARN", "component": "o.e.c.s.MasterService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "failing [elected-as-master ([2] nodes joined)[{elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}{n0YikIJ3TTKQXgMOzr9qSw}{10.2.0.211}{10.2.0.211:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, {elasticsearch-master-1}{tElKUqcfTmWIvSg4wqVoSg}{RDZ4JSeYT4-ugjkRY5LyNA}{10.2.0.168}{10.2.0.168:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_]]: failed to commit cluster state version [1]",
"stacktrace": ["org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException: node is no longer master for term 1 while handling publication",
"at org.elasticsearch.cluster.coordination.Coordinator.publish(Coordinator.java:1083) ~[elasticsearch-7.10.2-SNAPSHOT.jar:7.10.2-SNAPSHOT]"
{"type": "server", "timestamp": "2020-12-30T19:24:17,774Z", "level": "INFO", "component": "o.e.c.c.JoinHelper", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "failed to join {elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}{n0YikIJ3TTKQXgMOzr9qSw}{10.2.0.211}{10.2.0.211:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} with JoinRequest{sourceNode={elasticsearch-master-0}{RfG3uLsUSze64mBdYnhG9Q}

If I take out the xpack settings below the cluster startup successfully.

xpack.security.enabled: true
xpack.security.authc.realms:
   native.realm1:
   order: 0

Thanks.

You have multiple nodes, but you are only showing us the logs and config for 1 node.

What is happening on the other nodes?

I redeployed the cluster using 7.10.1 as suggested by @warkolm. Here is the logs for the three nodes.

master-0
elasticsearch.yml:

xpack.security.enabled: true
xpack.security.authc.realms:
   native.realm1:
      order: 0

Logs:

{"type": "server", "timestamp": "2020-12-31T05:34:17,373Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "initialized" }
{"type": "server", "timestamp": "2020-12-31T05:34:17,373Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "starting ..." }
{"type": "server", "timestamp": "2020-12-31T05:34:17,577Z", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "publish_address {10.2.1.67:9300}, bound_addresses {0.0.0.0:9300}" }
{"type": "server", "timestamp": "2020-12-31T05:34:17,959Z", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }
{"type": "server", "timestamp": "2020-12-31T05:34:18,979Z", "level": "INFO", "component": "o.e.c.c.Coordinator", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "setting initial configuration to VotingConfiguration{{bootstrap-placeholder}-elasticsearch-master-2,GNpi1wvCR2Wao_ksDmirDA,C_qtZ64LQJS9xFPu3cTJ7g}" }
{"type": "server", "timestamp": "2020-12-31T05:34:19,368Z", "level": "INFO", "component": "o.e.c.c.JoinHelper", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-0", "message": "failed to join {elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true} with JoinRequest{sourceNode={elasticsearch-master-0}{GNpi1wvCR2Wao_ksDmirDA}{zi_TueQZQqGFN_LFl3RlCA}{10.2.1.67}{10.2.1.67:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, minimumTerm=0, optionalJoin=Optional[Join{term=1, lastAcceptedTerm=0, lastAcceptedVersion=0, sourceNode={elasticsearch-master-0}{GNpi1wvCR2Wao_ksDmirDA}{zi_TueQZQqGFN_LFl3RlCA}{10.2.1.67}{10.2.1.67:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, targetNode={elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}}]}",
"stacktrace": ["org.elasticsearch.transport.RemoteTransportException: [elasticsearch-master-1][10.2.0.180:9300][internal:cluster/coordination/join]",
"Caused by: org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException: node is no longer master for term 1 while handling publication",

master-1
elasticsearch.yml:

xpack.security.enabled: true
xpack.security.authc.realms:
   native.realm1:
      order: 0

Logs:

{"type": "server", "timestamp": "2020-12-31T05:34:18,597Z", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-1", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }
{"type": "server", "timestamp": "2020-12-31T05:34:18,873Z", "level": "INFO", "component": "o.e.c.c.Coordinator", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-1", "message": "setting initial configuration to VotingConfiguration{{bootstrap-placeholder}-elasticsearch-master-2,GNpi1wvCR2Wao_ksDmirDA,C_qtZ64LQJS9xFPu3cTJ7g}" }
{"type": "server", "timestamp": "2020-12-31T05:34:19,306Z", "level": "INFO", "component": "o.e.c.s.MasterService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-1", "message": "elected-as-master ([2] nodes joined)[{elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, {elasticsearch-master-0}{GNpi1wvCR2Wao_ksDmirDA}{zi_TueQZQqGFN_LFl3RlCA}{10.2.1.67}{10.2.1.67:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}, added {{elasticsearch-master-0}{GNpi1wvCR2Wao_ksDmirDA}{zi_TueQZQqGFN_LFl3RlCA}{10.2.1.67}{10.2.1.67:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}}" }
{"type": "server", "timestamp": "2020-12-31T05:34:19,308Z", "level": "WARN", "component": "o.e.c.s.MasterService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-1", "message": "failing [elected-as-master ([2] nodes joined)[{elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, {elasticsearch-master-0}{GNpi1wvCR2Wao_ksDmirDA}{zi_TueQZQqGFN_LFl3RlCA}{10.2.1.67}{10.2.1.67:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_]]: failed to commit cluster state version [1]", 
"stacktrace": ["org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException: node is no longer master for term 1 while handling publication",
"at org.elasticsearch.cluster.coordination.Coordinator.publish(Coordinator.java:1083) ~[elasticsearch-7.10.1.jar:7.10.1]",
{"type": "server", "timestamp": "2020-12-31T05:34:19,316Z", "level": "INFO", "component": "o.e.c.c.JoinHelper", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-1", "message": "failed to join {elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} with JoinRequest{sourceNode={elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, minimumTerm=0, optionalJoin=Optional[Join{term=1, lastAcceptedTerm=0, lastAcceptedVersion=0, sourceNode={elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, targetNode={elasticsearch-master-1}{C_qtZ64LQJS9xFPu3cTJ7g}{Y9eLj8_1Ql6sdF6Dw3HQ0g}{10.2.0.180}{10.2.0.180:9300}{cdhilmrstw}{ml.machine_memory=2147483648, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}}]}", 
"stacktrace": ["org.elasticsearch.transport.RemoteTransportException: [elasticsearch-master-1][10.2.0.180:9300][internal:cluster/coordination/join]",
"Caused by: org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException: node is no longer master for term 1 while handling publication",
{"type": "server", "timestamp": "2020-12-31T05:34:19,495Z", "level": "INFO", "component": "o.e.c.c.CoordinationState", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-1", "message": "cluster UUID set to [HwcYUSLVRayVAZiajbVopQ]" }

master-2
elasticsearch.yml:

xpack.security.enabled: true
xpack.security.authc.realms:
   native.realm1:
     order: 0

Logs:

{"type": "server", "timestamp": "2020-12-31T06:15:15,882Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "initialized" }
{"type": "server", "timestamp": "2020-12-31T06:15:15,882Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "starting ..." }
{"type": "server", "timestamp": "2020-12-31T06:15:16,127Z", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "publish_address {10.2.0.215:9300}, bound_addresses {0.0.0.0:9300}" }
{"type": "server", "timestamp": "2020-12-31T06:15:16,321Z", "level": "WARN", "component": "o.e.t.TcpTransport", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "exception caught on transport layer [Netty4TcpChannel{localAddress=/10.2.0.215:9300, remoteAddress=/10.2.1.88:39866}], closing connection", 
"stacktrace": ["java.lang.IllegalStateException: transport not ready yet to handle incoming requests",
"at org.elasticsearch.transport.TransportService.onRequestReceived(TransportService.java:952) ~[elasticsearch-7.10.1.jar:7.10.1]",
{"type": "server", "timestamp": "2020-12-31T06:15:16,567Z", "level": "WARN", "component": "o.e.t.TcpTransport", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "exception caught on transport layer [Netty4TcpChannel{localAddress=/10.2.0.215:9300, remoteAddress=/10.2.0.179:58692}], closing connection", 
"stacktrace": ["java.lang.IllegalStateException: transport not ready yet to handle incoming requests",
"at org.elasticsearch.transport.TransportService.onRequestReceived(TransportService.java:952) ~[elasticsearch-7.10.1.jar:7.10.1]",
"at org.elasticsearch.transport.InboundHandler.handleRequest(InboundHandler.java:164) ~[elasticsearch-7.10.1.jar:7.10.1]",
{"type": "server", "timestamp": "2020-12-31T06:15:16,581Z", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }
{"type": "server", "timestamp": "2020-12-31T06:15:16,763Z", "level": "INFO", "component": "o.e.c.c.Coordinator", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "setting initial configuration to VotingConfiguration{f54LUufJQkiqGuGSTUNdGw,{bootstrap-placeholder}-elasticsearch-master-1,eYELzT4DQI6xXOS0876lYw}" }
{"type": "server", "timestamp": "2020-12-31T06:15:17,375Z", "level": "INFO", "component": "o.e.c.s.ClusterApplierService", "cluster.name": "elasticsearch", "node.name": "elasticsearch-master-2", "message": "master node changed {previous [], current [{elasticsearch-master-1}{YzL_Xr7wSse5YH0sC_LkYg}{56DexTh4RtWa3RTeVMgAMg}{10.2.0.179}{10.2.0.179:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}]}, added {{elasticsearch-master-0}{f54LUufJQkiqGuGSTUNdGw}{Mm_RrF0bTca2z-wh9pRZjA}{10.2.1.88}{10.2.1.88:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true},{elasticsearch-master-1}{YzL_Xr7wSse5YH0sC_LkYg}{56DexTh4RtWa3RTeVMgAMg}{10.2.0.179}{10.2.0.179:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}}, term: 2, version: 2, reason: ApplyCommitRequest{term=2, version=2, sourceNode={elasticsearch-master-1}{YzL_Xr7wSse5YH0sC_LkYg}{56DexTh4RtWa3RTeVMgAMg}{10.2.0.179}{10.2.0.179:9300}{cdhilmrstw}{ml.machine_memory=2147483648, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}}" }

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