我已经更新了我的Elasticsearch配置文件(注意:ES是2.2),因为它启用了CORS。我已经为ES 1.4做了同样的工作并且它工作正常但是它不工作且ES不重启.Below是错误和配置文件
错误:
root@XXX:/etc/elasticsearch# sudo service elasticsearch status -l
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2016-03-11 00:03:03 EST; 9min ago
Docs: http://www.elastic.co
Process: 9710 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -Des.pidfile=${PID_DIR}/elasticsearch.pid -Des.default.path.home=${ES_HOME} -Des.default.path.logs=${LOG_DIR} -Des.default.path.data=${DATA_DIR} -Des.default.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)
Process: 9707 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 9710 (code=exited, status=1/FAILURE)
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: network.host: XX.XX.XX.XX
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: ^
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: expected <block end>, but found BlockMappingStart
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: in 'reader', line 67, column 3:
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: http.cors.enabled: true
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: ^
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl$ParseBlockM...a:570)
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 systemd[1]: elasticsearch.service: Unit entered failed state.
Mar 11 00:03:03 ubuntu-1gb-sfo1-01 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
我的ES配置文件如下(在建议之后更新了YML)
# network.bind_host: 127.0.0.1
http.publish_port: 9200
http.port: 9200
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
http.cors.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
答案 0 :(得分:3)
每一行必须从左侧缩进一个空格。行http.cors.enabled: true
似乎缩进了两个空格。