How to: Fix "No response returned from Elasticsearch. Is it running?".

Slavik

XenForo moderator
Staff member
Fix "No response returned from Elasticsearch. Is it running?"

Please note this guide is less relevant due to recommending Florens repo, whilst the same concepts/troubleshooting methods apply, the paths will not be the same.

This guide is provided for users who may receive the following report in the XenForo error log after installing Elasticseach and XenForo Enhanced Search.

Code:
"No response returned from Elasticsearch. Is it running?".

This guide assumes the user has basic knowledge of SSH and prior to starting the steps below has logged in as root. Please note, whilst this is a simple and easy guide, I take no responsibility for any damages or losses that may occur to your system by following the steps below. If you are unsure at any stage, please ask for assistance or seek the help of a qualified Linux Systems Administrator.

Causes of the Error

This error is usually caused by one of two problems. Firstly the error may be caused if the Elasticsearch Service has not been activated, or has stopped running, for example, following a server restart. Secondly, dependent upon your server configuration, the Elasticsearch Service may be incorrectly binding to an IP or Port, which, your XenForo installation has not been configured to use.

Step 1

Confirm Elasticsearch is running by using the following command.

Code:
ps -A

A long list of running proccesses will be provided, you will be looking for one similar to

Code:
17927 ?        00:00:04 elasticsearch-l

If you see this line then you know the Elasticsearch Service is running. If you cannot find the Elasticsearch service running then use the following command to manually start the service.

RHEL/SUSE
Code:
 service elasticsearch start

Debian/Ubuntu
Code:
/etc/init.d/elasticsearch restart

You should get the following output

Code:
Starting ElasticSearch...
Waiting for ElasticSearch......
running: PID: xxxxx

Step 2

Explicitly bind the Elasticsearch IP and Port.

In this guide we will bind the Elasticsearch Service to the default IP 127.0.0.1 and Port 9200

RHEL/SUSE
Open up /elasticsearch/config/elasticsearch.yml and on line 199 edit

Code:
# network.host: 192.168.0.1

to

Code:
network.host: 127.0.0.1

On line 211 edit

Code:
# http.port: 9200

to

Code:
http.port: 9200

Save and Exit

Restart the Elasticsearch Service by typing the following in SSH

Code:
rcelasticsearch restart

You should get the following output

Code:
Stopping ElasticSearch...
Stopped ElasticSearch.
Starting ElasticSearch...
Waiting for ElasticSearch......
running: PID: xxxxx

Elasticsearch is now runing with your updated config.

Debian/Ubuntu
Open up /usr/local/elasticsearch/config/elasticsearch.yml and on line 199 edit

Code:
# network.host: 192.168.0.1
to

Code:
network.host: 127.0.0.1

On line 211 edit

Code:
# http.port: 9200

to

Code:
http.port: 9200

Save and Exit

Restart the Elasticsearch Service by typing the following in SSH

Code:
/etc/init.d/elasticsearch restart

You should get the following output

Code:
Stopping ElasticSearch...
Stopped ElasticSearch.
Starting ElasticSearch...
Waiting for ElasticSearch......
running: PID: xxxxx

Elasticsearch is now runing with your updated config.

Step 3

Confirm Elasticsearch is listening on your bound IP and Port.

In SSH type the following

Code:
curl http://127.0.0.1:9200

You should get output similar to the following

Code:
{
  "ok" : true,
  "name" : "Wild Child",
  "version" : {
    "number" : "0.18.7",
    "snapshot_build" : false
  },
  "tagline" : "You Know, for Search",
  "cover" : "DON'T PANIC",
  "quote" : {
    "book" : "The Hitchhiker's Guide to the Galaxy",
    "chapter" : "Chapter 8",
    "text1" : "\"Space,\" it says, \"is big. Really big. You just won't believe how vastly hugely mindbogglingly big it is. I mean you may think it's a long way down the road to the chemist, but that's just peanuts to space, LISTEN!\" and so on..."
  }

Congratulations, we have just confirmed Elasticsearch is running and configured to listen on the correct IP and Port.

Step 4

Explicitly set IP and Port in Xenforo.

Within the XenForo admin go to Options > Search Options and within the Elasticsearch Server Details boxes enter 127.0.0.1 and 9200 respectively.

Save Changes

Reindex your board

Congratulations, everything should be working fine now.

Help it still doesn't work!

Your servers security rules such as your Firewall may be blocking access to the required port. You may need to unblock this IP within your security or Firewall settings. If you still have issues after this please make a thread requesting support on the XenForo forums or ticket system.
 
Last edited:
Code:
-bash-4.2# sudo service elasticsearch restart
Restarting elasticsearch (via systemctl):                  [  OK  ]
-bash-4.2# curl -X GET 'http://localhost:9200'
{
  "name" : "Madame MacEvil",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "kgiLXtMZQy6FhqfNP4Wn7g",
  "version" : {
    "number" : "2.4.1",
    "build_hash" : "c67dc32e24162035d18d6fe1e952c4cbcbe79d16",
    "build_timestamp" : "2016-09-27T18:57:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.2"
  },
  "tagline" : "You Know, for Search"
 
First delete index, than Optimize Mappings and then rebuild search.
Be sure you use the latest ES XenForo Addon.
An exception occurred: Elasticsearch indexing failed. See the server error log for more details. in /home/admin/web/codeby.net/public_html/forum/library/XenES/Search/SourceHandler/ElasticSearch.php on line 1098

  1. XenES_Search_SourceHandler_ElasticSearch->_triggerFailedIndexError() in XenES/Search/SourceHandler/ElasticSearch.php at line 76
  2. XenES_Search_SourceHandler_ElasticSearch->finalizeRebuildSet() in XenForo/Search/Indexer.php at line 125
  3. XenForo_Search_Indexer->finalizeRebuildSet() in XenForo/Deferred/SearchIndex.php at line 76
  4. XenForo_Deferred_SearchIndex->execute() in XenForo/Model/Deferred.php at line 295
  5. XenForo_Model_Deferred->runDeferred() in XenForo/Model/Deferred.php at line 429
  6. XenForo_Model_Deferred->_runInternal() in XenForo/Model/Deferred.php at line 374
  7. XenForo_Model_Deferred->run() in XenForo/ViewRenderer/Abstract.php at line 352
  8. XenForo_ViewRenderer_Abstract::hasManualDeferredToRun() in XenForo/ViewRenderer/HtmlAdmin.php at line 131
  9. XenForo_ViewRenderer_HtmlAdmin->renderContainer() in XenForo/FrontController.php at line 639
  10. XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
  11. XenForo_FrontController->run() in /home/admin/web/codeby.net/public_html/forum/admin.php at line 13
 
For me, the hint was in the elastic search log entries. I needed to remove and then install some plugins.

Such as:
bin/plugin remove license
bin/plugin install license
 
Code:
[root@server1 ~]# rcelasticsearch restart
-bash: rcelasticsearch: command not found
[root@server1 ~]# /etc/init.d/elasticsearch restart
Restarting elasticsearch (via systemctl):                  [  OK  ]
[root@server1 ~]# service elasticsearch start
Starting elasticsearch (via systemctl):                    [  OK  ]
[root@server1 ~]# curl http://127.0.0.1:9200
curl: (7) Failed connect to 127.0.0.1:9200; Connection refused
[root@server1 ~]#

i got this issue
 
What do you see in /var/log/elasticsearch/elasticsearch.log?
Also what does ps -edf | grep java return?
Output of systemctl status elasticsearch.service
 
Code:
[root@server1 ~]# ps -edf | grep java
root      536353  414795  0 06:13 pts/0    00:00:00 grep --color=auto java
and i see there is no log file i checked both folders
 
list of open ports in system :
PHP:
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1353/mysqld        
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      247906/exim        
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      2003/dovecot      
tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN      479402/spamd-dorman
tcp        0      0 0.0.0.0:2095            0.0.0.0:*               LISTEN      38912/cpsrvd (SSL)
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      2003/dovecot      
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      242432/httpd      
tcp        0      0 0.0.0.0:2096            0.0.0.0:*               LISTEN      38912/cpsrvd (SSL)
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      247906/exim        
tcp        0      0 x.xx.216.157:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 x.xx.216.156:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 x.xx.216.155:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 x.xx.216.154:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 x.xx.216.153:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 x.xx.216.152:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 x.xx.216.151:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 x.xx.216.150:53         0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      2355/pure-ftpd (SER
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      247906/exim        
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      2608/named        
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      242432/httpd      
tcp        0      0 0.0.0.0:2077            0.0.0.0:*               LISTEN      38966/cpdavd - acce
tcp        0      0 0.0.0.0:2078            0.0.0.0:*               LISTEN      38966/cpdavd - acce
tcp        0      0 0.0.0.0:2079            0.0.0.0:*               LISTEN      38966/cpdavd - acce
tcp        0      0 0.0.0.0:2080            0.0.0.0:*               LISTEN      38966/cpdavd - acce
tcp        0      0 0.0.0.0:49152           0.0.0.0:*               LISTEN      2009/sshd          
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      2003/dovecot      
tcp        0      0 0.0.0.0:2082            0.0.0.0:*               LISTEN      38912/cpsrvd (SSL)
tcp        0      0 0.0.0.0:2083            0.0.0.0:*               LISTEN      38912/cpsrvd (SSL)
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      2003/dovecot      
tcp        0      0 0.0.0.0:2086            0.0.0.0:*               LISTEN      38912/cpsrvd (SSL)
tcp        0      0 0.0.0.0:2087            0.0.0.0:*               LISTEN      38912/cpsrvd (SSL)
tcp6       0      0 :::587                  :::*                    LISTEN      247906/exim        
tcp6       0      0 :::110                  :::*                    LISTEN      2003/dovecot      
tcp6       0      0 ::1:783                 :::*                    LISTEN      479402/spamd-dorman
tcp6       0      0 :::143                  :::*                    LISTEN      2003/dovecot      
tcp6       0      0 :::80                   :::*                    LISTEN      242432/httpd      
tcp6       0      0 :::465                  :::*                    LISTEN      247906/exim        
tcp6       0      0 :::21                   :::*                    LISTEN      2355/pure-ftpd (SER
tcp6       0      0 :::4949                 :::*                    LISTEN      1347/perl          
tcp6       0      0 :::25                   :::*                    LISTEN      247906/exim        
tcp6       0      0 :::443                  :::*                    LISTEN      242432/httpd      
tcp6       0      0 :::49152                :::*                    LISTEN      2009/sshd          
tcp6       0      0 :::993                  :::*                    LISTEN      2003/dovecot      
tcp6       0      0 :::995                  :::*                    LISTEN      2003/dovecot
 
Top Bottom