Elasticsearch failed when i try to setup x-pack

when i try to setup x-pack in remote server i have some issues
(in my local ,it works perfectly) ,but it dosn't in remote sever

first :
vi /etc/elasticsearch/elasticsearch.yml
i add this option:

xpack.security.enabled: true
discovery.type: single.node

 ---------------------------------- Network -----------------------------------
#network.host: 0.0.0.0
network.host: 192.168.1.10
#http.port: 9200

root@xxxx:/home/cloud_user# /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME

Connection failure to: http://192.168.1.10:9200/_xpack/security/_authenticate?pretty failed: Connection timed out (Connection timed out)

ERROR: Failed to connect to elasticsearch at http://192.168.1.10:9200/_xpack/security/_authenticate?pretty. Is the URL correct and elasticsearch running?

this is the log:
tail -f /var/log/elasticsearch/elasticsearch.log
root@xxxxxxx:/home/cloud_user# tail -f /var/log/elasticsearch/elasticsearch.log
    at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:446) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:417) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:148) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.node.Node.<init>(Node.java:374) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.node.Node.<init>(Node.java:266) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.10.jar:6.8.10]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.10.jar:6.8.10]
    ... 6 more

even when i desactivate x-pack security ,i have the same issue, and i don't see the 9200 port

   ```Preformatted text Preformatted text root@xxxxxx:/home/cloud_user# netstat -nlpPreformatted text
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN      1193/Xtightvnc      
    tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      1193/Xtightvnc      
    tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      734/systemd-resolve 
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1028/sshd           
    tcp        0      0 0.0.0.0:5601            0.0.0.0:*               LISTEN      3231/node           
    tcp        0      0 0.0.0.0:31297           0.0.0.0:*               LISTEN      1667/node           
    tcp6       0      0 :::5044                 :::*                    LISTEN      3351/java           
    tcp6       0      0 :::22                   :::*                    LISTEN      1028/sshd           
    tcp6       0      0 127.0.0.1:9600          :::*                    LISTEN      3351/java           
    udp        0      0 127.0.0.53:53           0.0.0.0:*                           734/systemd-resolve 
    udp        0      0 172.31.106.118:68       0.0.0.0:*                           700/systemd-network 
    udp6       0      0 fe80::4b3:1fff:feea:546 :::*                                700/systemd-network 
    raw6       0      0 :::58                   :::*                    7           700/systemd-networkPreformatted text```

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

Also please share the full logs.

it's done, thanks

Amine_Aloui
Your ES server has not started. You may want to check / post rest of the start up logs.

There is one issue I noticed in your yaml. discovery.type value should be single-node not single.node

https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html#single-node-discovery

Thanks Vinayak_Sapre,

in /etc/elasticsearch/elasticsearch.yml
I keep only this option:

xpack.security.enabled: true
root@xxxx:/home/user# systemctl restart elasticsearch
Job for elasticsearch.service failed because a timeout was exceeded.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

root@xxxx:/home/user# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
   Active: failed (Result: timeout) since Sun 2020-06-28 23:49:00 UTC; 6min ago
     Docs: https://www.elastic.co
  Process: 18330 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=143)
 Main PID: 18330 (code=exited, status=143)

Jun 28 23:47:29 xxxx systemd[1]: Starting Elasticsearch...
Jun 28 23:48:59 xxxx systemd[1]: elasticsearch.service: Start operation timed out. Terminating.
Jun 28 23:49:00 xxxx systemd[1]: elasticsearch.service: Failed with result 'timeout'.
Jun 28 23:49:00 xxxx systemd[1]: Failed to start Elasticsearch.

@Amine_Aloui
By startup log I meant entries in /var/log/elasticsearch/elasticsearch.log during ES start up.

Sorry for the confusion.

I add this option:

sudo vim /usr/lib/systemd/system/elasticsearch.service

 TimeoutStartSec=180

sudo sytemctl reload-daemon
systemctl restart elasticsearch

root@xxxx:/home/user# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-06-29 00:20:32 UTC; 4s ago
     Docs: https://www.elastic.co
 Main PID: 20356 (java)
    Tasks: 78 (limit: 4613)
   CGroup: /system.slice/elasticsearch.service
           ├─20356 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encodin
           └─20571 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

It works perfectly now,
this is the link of the solution,

https://blog.sleeplessbeastie.eu/2020/02/29/how-to-prevent-systemd-service-start-operation-from-timing-out/

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