elasticsearch 更新CORS的配置文件后,Elasticsearch不会重新启动,elasticsearch,cors,elasticsearch,Cors" /> elasticsearch 更新CORS的配置文件后,Elasticsearch不会重新启动,elasticsearch,cors,elasticsearch,Cors" />

elasticsearch 更新CORS的配置文件后,Elasticsearch不会重新启动

elasticsearch 更新CORS的配置文件后,Elasticsearch不会重新启动,elasticsearch,cors,elasticsearch,Cors,我已经更新了我的Elasticsearch配置文件(注意:ES是2.2)以使其启用CORS。我对ES 1.4也做了同样的操作,它工作正常,但在这里它不工作,ES不会重新启动。下面是错误和配置文件 错误: root@XXX:/etc/elasticsearch# sudo service elasticsearch status -l ● elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system

我已经更新了我的Elasticsearch配置文件(注意:ES是2.2)以使其启用CORS。我对ES 1.4也做了同样的操作,它工作正常,但在这里它不工作,ES不会重新启动。下面是错误和配置文件

错误:

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'.
root@XXX:/etc/elasticsearch#sudo服务elasticsearch状态-l
● elasticsearch.service-elasticsearch
已加载:已加载(/usr/lib/systemd/system/elasticsearch.service;已禁用;供应商预设:已启用)
活动:自2016年3月11日星期五00:03:03东部时间以来失败(结果:退出代码);9分钟前
文件:http://www.elastic.co
进程:9710 ExecStart=/usr/share/elasticsearch/bin/elasticsearch-Des.pidfile=${PID\u DIR}/elasticsearch.PID-Des.default.path.home=${ES\u home}-Des.default.path.logs=${LOG\u DIR}-Des.default.data=${data\u DIR}-Des default.path.conf=${conf conf\conf DIR}(代码=退出,状态=1/失败)
进程:9707 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch systemd pre-exec(代码=退出,状态=0/成功)
主PID:9710(代码=退出,状态=1/故障)
3月11日00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:network.host:XX.XX.XX
3月11日00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:^
3月11日00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:应为,但找到BlockMappingStart
3月11日00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:在“阅读器”第67行第3列:
3月11日00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:http.cors.enabled:true
3月11日00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:^
3月11日00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:在com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl$ParseBlockM…a:570)
3月11日00:03:03 ubuntu-1gb-sfo1-01 systemd[1]:elasticsearch.service:主进程退出,代码=退出,状态=1/失败
3月11日00:03:03 ubuntu-1gb-sfo1-01 systemd[1]:elasticsearch.service:设备进入故障状态。
3月11日00:03:03 ubuntu-1gb-sfo1-01 systemd[1]:elasticsearch.service:失败,结果为“退出代码”。
我的ES配置文件如下(根据以下建议更新了YML)

#network.bind_主机:127.0.0.1
http.publish_端口:9200
http.port:9200
#
#为HTTP设置自定义端口:
#
#http.port:9200
#
#有关更多信息,请参阅以下位置的文档:
# 
#
http.cors.enabled:true
http.cors.enabled:true
http.cors.allow-origin:“*”

每行必须从左侧缩进一个空格。行
http.cors.enabled:true
似乎缩进了两个空格。

每行必须从左侧缩进一个空格。行
http.cors.enabled:true
似乎缩进了两个空格。

您可能希望使缩进一致(即没有多余的空格)确保每行的所有设置都从字符0开始,即删除行开头的所有空格填充。您可能希望使缩进一致(即没有多余的空格)确保所有设置都从每行的字符0开始,即删除行开头的所有空格填充。您应该不希望使用空格并左对齐。Elasticsearch配置文件中的默认设置是一个空格缩进。就我个人而言,我认为如果坚持这样做,事情就更难搞砸了。但是你确实可以不使用缩进。我总是发现让我的所有设置左对齐并且完全没有空格比较容易,特别是因为在那个文件中有很多注释,而且在不同的部分中区分1或2个空格并不总是很明显。我认为他们只是出于易读的目的(即设置名称不会直接附加到
#
符号上)才添加了额外的空间,而不是出于其他原因。在中,他们将确保在开始之前验证所有设置。另外值得一提的是,YAML关心缩进,因此完全不缩进是工作配置的最安全方式。运气不好,我尝试缩进,但仍然是同一个问题。我已经在问题上发布了我更新的YML。你应该不喜欢任何空格,并且左对齐。Elasticsearch配置文件中的默认设置是一个空格缩进。就我个人而言,我认为如果坚持这样做,事情就更难搞砸了。但是你确实可以不使用缩进。我总是发现让我的所有设置左对齐并且完全没有空格比较容易,特别是因为在那个文件中有很多注释,而且在不同的部分中区分1或2个空格并不总是很明显。我认为他们只是出于易读的目的(即设置名称不会直接附加到
#
符号上)才添加了额外的空间,而不是出于其他原因。在中,他们将确保在开始之前验证所有设置。另外值得一提的是,YAML关心缩进,因此完全不缩进是工作配置的最安全方式。运气不好,我试过缩进,但仍然是同一个问题。我已经在问题上发布了我更新的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: "*"