Install Elastic Search

Hi Team,

I had a requirement to create elasticsearch cluster with three nodes . I had install the elasticsearch binaries on these three nodes individually and updated the elasticsearch.yml file with node information but they all three work as individual nodes. I have attached the yml file for your information. Could you please help me how I can configure it so that all three node works as cluster. The above scenario which I mentioned is not a k8s deployment.

Thanks,
Debasis

Have you followed the steps outlined in the docs here?

hi @miltonhultgren thanks for your response. Before proceeding I need a small help here.
Actually, by mistake installed 7.9.2 so I removed the installation by using the below command. Then I installed the latest version as per the docs but while starting the service getting error in log as belwo.

yum remove elasticsearch-7.9.2-1.x86_64

[2023-09-05T17:39:41,066][ERROR][o.e.b.Elasticsearch ] [cb-2] fatal exception while booting Elasticsearch
java.lang.IllegalStateException: cannot upgrade a node from version [7.9.2] directly to version [8.9.1], upgrade to version [7.17.0] first.

Could you please help here why I am getting above error because already did a cleanup for older version.

Thanks,
Debasis

I'm not an expert on yum but I wonder if maybe you had more versions installed?
What if you run yum remove elasticsearch without the version number?

I found this page which talks about some issues that can happen and how to purge the left over files, maybe that helps?

Thanks for your response @miltonhultgren . After cleaning up the directories I can able to start up the service.

Hi, @miltonhultgren While starting the services in node-1 (out of three nodes) I got the below error. Is there any way to upload elasticsearch.yml file to this conversation?

Could you please help on the below error.

[2023-09-06T12:05:34,589][ERROR][o.e.b.Elasticsearch ] [cb-1] fatal exception while booting Elasticsearch
org.elasticsearch.ElasticsearchSecurityException: invalid configuration for xpack.security.http.ssl - [xpack.security.http.ssl.enabled] is not set, but the following settings have been configured in elasticsearch.yml : [xpack.security.http.ssl.keystore.secure_password]
at org.elasticsearch.xpack.core.ssl.SSLService.validateServerConfiguration(SSLService.java:650) ~[?:?]
at org.elasticsearch.xpack.core.ssl.SSLService.loadSslConfigurations(SSLService.java:624) ~[?:?]
at org.elasticsearch.xpack.core.ssl.SSLService.(SSLService.java:159) ~[?:?]
at org.elasticsearch.xpack.core.XPackPlugin.createSSLService(XPackPlugin.java:495) ~[?:?]
at org.elasticsearch.xpack.core.XPackPlugin.createComponents(XPackPlugin.java:324) ~[?:?]
at org.elasticsearch.node.Node.lambda$new$16(Node.java:733) ~[elasticsearch-8.9.1.jar:?]
at org.elasticsearch.plugins.PluginsService.lambda$flatMap$1(PluginsService.java:261) ~[elasticsearch-8.9.1.jar:?]
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]

Thanks,
Debasis

Based on that error it just looks like you also need to enable SSL before giving it any other config settings.
If you add xpack.security.http.ssl.enabled: true it should likely fix that issue if you want to run with SSL.

If you don't, then please comment out/remove any other SSL property that you've added to the config.

Thanks @miltonhultgren able to proceed with the installation. After creating the enrollment token while adding node-2 with the token value I got the error as below. Could you please advise?


[root@cb-2 bin]# ./elasticsearch --enrollment-token eyJ2ZXIiOiI4LjkuMSIsImFkciI6WyIxMC4xMC4xOC41OTo5MjAwIl0sImZnciI6IjUzNDJmNDA2ZjlmMjFmNmU4ZDdhNTVjNTRkM2Q3NThjOTBlZjg2N2ZmN2E0MGFiMzkxNmYwOTgzNzE4ZDY3MmMiLCJrZXkiOiIxaG1JYVlvQlJxaFppam9mWnZmYjo0YUpaYUVhOVJwLXcyVGEzZ1dDbzdnIn0=

ERROR: Skipping security auto configuration because it appears that security is already configured.

Thanks,
Debasis

Hi, @miltonhultgren,
I tried with other option to add a node but still error out. Any clue how to solve this.

[root@cb-2 elasticsearch]# /usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token eyJ2ZXIiOiI4LjkuMSIsImFkciI6WyIxMC4xMC4xOC41OTo5MjAwIl0sImZnciI6ImEwMDU5M2IwNjZlMjY4MGM5MGZlYmY0Zjg0OWJmMGRmM2U5NGQwYzUxOGMyM2E2MGJhOTU0OTNkY2Y5ZDU5YTciLCJrZXkiOiJXVllVYW9vQjhrdFRBV2tKTU44WDp2OW9ubGx4TlJuUzJNRzU1b0VCa3BBIn0=
Generates all the necessary security configuration for a node in a secured cluster

Option              Description
------              -----------
-E <KeyValuePair>   Configure a setting
--enrollment-token  The enrollment token to use
-h, --help          Show help
-s, --silent        Show minimal output
-v, --verbose       Show verbose output

ERROR: Aborting enrolling to cluster. This node doesn't appear to be auto-configured for security. Expected configuration is missing from elasticsearch.yml.

Thanks,
Debasis

I'm afraid this is outside of my domain of knowledge now.

But does the first error stop you from enrolling or is it simply saying it's skipping the security configuration because it is already configured?

Yes, the error stops me from adding the node. I am not able to start the service on second node (cb-2) mentioned above.

Thanks,
Debasis

Hi @miltonhultgren ,

As per the documentation link, I did the enrollment as below but immediately got an error as below. As per documentation, there is no such thing mentioned whether it should run as root or any other user.
Could you please advise or any clue on how to proceed further?

[root@cb-2 bin]# ./elasticsearch --enrollment-token

[2023-09-06T16:12:43,842][ERROR][o.e.b.Elasticsearch ] [cb-2] fatal exception while booting Elasticsearchjava.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.server@8.9.1/org.elasticsearch.bootstrap.Elasticsearch.initializeNatives(Elasticsearch.java:280)
at org.elasticsearch.server@8.9.1/org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:166)
at org.elasticsearch.server@8.9.1/org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:71)

Thanks,
Debasis

I'm afraid this is beyond what I know about Elasticsearch.
@stephenb Could you lend a hand here perhaps?

I think the error message is quite clear. Do not run as root - instead use the elasticsearch user.

@Christian_Dahlqvist by making the below changes in the master node, is able to add one node in the cluster and both are running as root users also.
But not able to add one more node as it gives some error related to node IP.
Could you please share one example of elasticsearch.yml file which used to create a cluster?

xpack.security.enabled: false
xpack.ml.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.enrollment.enabled: true

> Blockquote

Thanks,
Debasis

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