启动elasticsearch的时候报出Exception in thread "main" SettingsException[Failed to load settings from /usr/local/elasticsearch/config/elasticsearch.yml]; nested: MarkedYAMLException[while scanning a simple ke

时间:2024-11-27 17:36:25

故障现象:

[elasticsearch@tiantianml- ~]$ /usr/local/elasticsearch/bin/elasticsearch
Exception in thread "main" SettingsException[Failed to load settings from /usr/local/elasticsearch/config/elasticsearch.yml]; nested: MarkedYAMLException[while scanning a simple key
in 'reader', line , column :
discovery.zen.ping.unicast.hosts ...
^
could not find expected ':'
in 'reader', line , column : ^ at [Source: cluster.name: my-application
node.name: tiantianml-
path.data: /usr/local/elasticsearch/data
path.logs: /usr/local/elasticsearch/logs
#bootstrap.memory_lock: false
network.host: 127.0.0.1
http.port:
discovery.zen.ping.unicast.hosts:["tiantianml-01"]
...

出现这种错误的原因说明elasticsearch.yml这个配置文件的":"后面缺少空格,查看配置文件如下(果然缺少空格):

cluster.name: my-application
node.name: tiantianml-
path.data: /usr/local/elasticsearch/data
path.logs: /usr/local/elasticsearch/logs
bootstrap.memory_lock: false
network.host: 127.0.0.1
http.port:
discovery.zen.ping.unicast.hosts:["tiantianml-01"]

添加空格重新启动即可正常启动。