2016-05-12 192 views
0

我在linux debian核心上運行節點服務器。
我使用pm2在後臺運行所有進程並監視它們。
除彈性搜索服務器外,一切都正常工作,我收到了一條我不明白的錯誤消息。Debian pm2無法啓動elasticsearch服務器

SyntaxError: Unexpected token ILLEGAL 
    at exports.runInThisContext (vm.js:53:16) 
    at Module._compile (module.js:373:25) 
    at Object.Module._extensions..js (module.js:416:10) 
    at Module.load (module.js:343:32) 
    at Function.Module._load (module.js:300:12) 
    at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21) 
    at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:46:21) 
    at Module._compile (module.js:409:26) 
    at Object.Module._extensions..js (module.js:416:10) 
    at Module.load (module.js:343:32) 

當我做pm2 list查看其他進程,這是結果:

enter image description here

我用它來啓動elasticsearch服務器的命令很簡單pm2 start ./bin/elasticsearch,而不是./bin/elasticsearch這是什麼文檔說。

我要在本地運行elasticsearch服務器只所以正確的IP是127.0.0.1端口9200
我還要提到的是,elasticsearch服務器DO工作,如果我正常運行,沒有PM2。

這裏是我的elasticsearch.yml配置文件。

cluster.name: swissnet 
node.name: "swissnet-data" 
node.master: true 
node.data: true 
path.data: ../local-data/ 
path.logs: ../local-logs/ 
ES_HEAP_SIZE: 300m 
network.host: 127.0.0.1 
http.port: 9200 
http.cors.enabled: true 
http.cors.allow-origin: "*" 
discovery.zen.ping.unicast.hosts: ["127.0.0.1"] 
discovery.zen.minimum_master_nodes: 3 
gateway.recover_after_nodes: 8 
gateway.expected_nodes: 10 
gateway.recover_after_time: 5m 
ES_JAVA_OPTS: "-Des.insecure.allow.root=true" 

任何想法? Elasticsearch.yml更新也是受歡迎的。

+0

ES日誌文件中是否有任何有用的可用內容? – Val

+0

日誌文件只是重複'SyntaxError:Unexpected token ILLEGAL'錯誤消息,這就是我不幸的。或者這就是ES的pm2錯誤日誌,當我運行'pm2 start。/ bin/elasticsearch'時,ES日誌不會更新。不是一行。 –

+0

但這不是elasticsearch日誌文件。你能檢查'../ local-logs/swissnet.log'嗎? – Val

回答

1

您需要創建文件SH,例如:ES_service.sh

#!/bin/bash 
sh /your_path/bin/elasticsearch 

然後運行您的PM2命令:

pm2 start ES_service.sh --name=elasticsearch 

與PM2列表來查看服務 我用它在Ubuntu和Centos 7,一切正常 也許它有幫助

Regards