启动elasticsearch的时候报出Exception in thread "main" SettingsException[Failed to load settings from /usr/local/elasticsearch/config/elasticsearch.yml]; nested: MarkedYAMLException[while scanning a simple ke
故障现象:
[elasticsearch@tiantianml-01 ~]$ /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 8, column 1: discovery.zen.ping.unicast.hosts ... ^ could not find expected ':' in 'reader', line 9, column 1: ^ at [Source: cluster.name: my-application node.name: tiantianml-01 path.data: /usr/local/elasticsearch/data path.logs: /usr/local/elasticsearch/logs #bootstrap.memory_lock: false network.host: 127.0.0.1 http.port: 9200 discovery.zen.ping.unicast.hosts:["tiantianml-01"] ...
出现这种错误的原因说明elasticsearch.yml这个配置文件的":"后面缺少空格,查看配置文件如下(果然缺少空格):
cluster.name: my-application node.name: tiantianml-01 path.data: /usr/local/elasticsearch/data path.logs: /usr/local/elasticsearch/logs bootstrap.memory_lock: false network.host: 127.0.0.1 http.port: 9200 discovery.zen.ping.unicast.hosts:["tiantianml-01"]
添加空格重新启动即可正常启动。