2017-01-15 57 views
2

我正在我的項目在2個不同的服務器上工作。該代碼是從到位桶克隆所以是完全一樣的,但在其中的一個我得到的每一個HTTP請求的這個錯誤:無法連接到主機,Elasticsearch下降? 500內部服務器錯誤 - HttpException

Couldn't connect to host, Elasticsearch down? 
500 Internal Server Error - HttpException 

S.O. Ubuntu的16.04

當我運行service elasticsearch status我得到這個:

elasticsearch.service - LSB: Starts elasticsearch 
    Loaded: loaded (/etc/init.d/elasticsearch; bad; vendor preset: enabled) 
    Active: active (exited) since Sun 2017-01-15 11:05:25 CET; 1h 16min ago 
    Docs: man:systemd-sysv-generator(8) 
    Process: 1366 ExecStart=/etc/init.d/elasticsearch start (code=exited, status=0 

Jan 15 11:05:25 ubuntu systemd[1]: Starting LSB: Starts elasticsearch... 
Jan 15 11:05:25 ubuntu systemd[1]: Started LSB: Starts elasticsearch. 

當我運行fos:elastica:populate我得到這個錯誤:

[Elastica\Exception\Connection\HttpException] 
Couldn't connect to host, Elasticsearch down? 

運行curl -XGET http://127.0.0.1:9200我得到

curl: (7) Failed to connect to 127.0.0.1 port 9200: Connection refused 

我正在尋找5天,並認爲這個問題是一些東西t權限。

+0

你的代碼在哪裏 – aimme

+0

curl看起來不太好 –

+0

看起來你需要打開端口,就像iptables –

回答

0

非常感謝@antonbormotov。我正在尋找開始elasticsearch,並發現this response.

It seems that to get Elasticsearch to run on 16.04 you have to set START_DAEMON to true on /etc/default/elasticsearch. It comes commented out by default, and uncommenting it makes Elasticsearch start again just fine.

Be sure to use systemctl restart instead of just start because the service is started right after installation, and apparently there's some socket/pidfile/something that systemd keeps that must be released before being able to start the service again

它現在正在運行!