Can't connect to localhost:9200

I hope someone could point out a solution for my problem, I am at my wit's end.

I am running a VPS (CentOS 7.5, WHM) with elasticsearch.noarch installed from the repo (6.5.1-1) and the latest ingest-attachment-plugin.

The elasticsearch service is up an running:

  $ sudo systemctl status elasticsearch.service
    ● elasticsearch.service - LSB: This service manages the elasticsearch daemon
       Loaded: loaded (/etc/rc.d/init.d/elasticsearch; bad; vendor preset: disabled)
       Active: active (exited) since Do 2018-11-29 11:46:52 CET; 40min ago
         Docs: man:systemd-sysv-generator(8)
      Process: 2181 ExecStop=/etc/rc.d/init.d/elasticsearch stop (code=exited, status=0/SUCCESS)
      Process: 2188 ExecStart=/etc/rc.d/init.d/elasticsearch start (code=exited, status=0/SUCCESS)

    Nov 29 11:46:47 server systemd[1]: Starting LSB: This service manages the elasticsearch daemon...
    Nov 29 11:46:47 server elasticsearch[2188]: sysctl: permission denied on key 'vm.max_map_count'
    Nov 29 11:46:47 server runuser[2199]: pam_unix(runuser:session): session opened for user elasticsearch by (uid=0)
    Nov 29 11:46:52 server runuser[2199]: pam_unix(runuser:session): session closed for user elasticsearch
    Nov 29 11:46:52 server elasticsearch[2188]: Starting elasticsearch: [  OK  ]
    Nov 29 11:46:52 server systemd[1]: Started LSB: This service manages the elasticsearch daemon.

But I can't connect to localhost:

curl http://localhost:9200
curl: (7) Failed connect to localhost:9200; connection refused

Therefore the fulltextsearch app in Nextcloud won't work: No alive nodes found.

The relevant settings in elasticsearch.yml:
network.bind_host: localhost

There are no entries in /var/log/elasticsearch related to that issue.

I guess,This might be helpful
Related question (i guess)

There is no /etc/default/elasticsearch
I am not sure but the former /etc/default/elasticsearch was superseded by /etc/elasticsearch/elasticsearch.yml IMHO

what does

sudo netstat -tlpn

Give for output?

Ok, I was able to track down (and solve) the problem.

I started the elasticsearch service with sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch and received

[2018-11-29T14:54:48,525][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [xxx] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: node settings must not contain any index level settings
        at org.elasticsearch.bootstrap.Elasticsearch.init( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling( ~[elasticsearch-cli-6.5.1.jar:6.5.1]
        at org.elasticsearch.cli.Command.main( ~[elasticsearch-cli-6.5.1.jar:6.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main( ~[elasticsearch-6.5.1.jar:6.5.1]
Caused by: java.lang.IllegalArgumentException: node settings must not contain any index level settings
        at org.elasticsearch.common.settings.SettingsModule.<init>( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.node.Node.<init>( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.node.Node.<init>( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.bootstrap.Bootstrap.setup( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.bootstrap.Bootstrap.init( ~[elasticsearch-6.5.1.jar:6.5.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init( ~[elasticsearch-6.5.1.jar:6.5.1]
        ... 6 more

With this information I was pointed to Node settings must not contain any index level setting and found two index entries in my elasticsearch.yml:

index.number_of_shards: 3
index.number_of_replicas: 2

After commenting out these lines everything seems back to normal.

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