成功解决:Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but

追求适度,才能走向成功;人在顶峰,迈步就是下坡;身在低谷,抬足既是登高;弦,绷得太紧会断;人,思虑过度会疯;水至清无鱼,人至真无友,山至高无树;适度,不是中庸,而是一种明智的生活态度。

导读:本篇文章讲解 成功解决:Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

前言

在根据镜像elasticsearch创建容器的时候,启动容器失败。

查看报错日志

查看日志
这里查看相关容器启动失败日志

docker logs e09

在这里插入图片描述

[root@localhost elasticsearch]# docker logs e09
Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1189)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1160)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:75)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:91)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:82)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
	at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
	at org.elasticsearch.cli.Command.main(Command.java:77)
	at org.elasticsearch.common.settings.KeyStoreCli.main(KeyStoreCli.java:33)
Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]]
	at org.elasticsearch.common.xcontent.XContentParserUtils.parsingException(XContentParserUtils.java:77)
	at org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken(XContentParserUtils.java:70)
	at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:672)
	at org.elasticsearch.common.settings.Settings.access$400(Settings.java:75)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1185)
	... 10 more
Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1189)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1160)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:75)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:91)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:82)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
	at org.elasticsearch.cli.Command.main(Command.java:77)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]]
	at org.elasticsearch.common.xcontent.XContentParserUtils.parsingException(XContentParserUtils.java:77)
	at org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken(XContentParserUtils.java:70)
	at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:672)
	at org.elasticsearch.common.settings.Settings.access$400(Settings.java:75)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1185)
	... 9 more

排查问题

是说在启动时在解析elasticsearch.yml出现错误,查看自己外部挂载的elasticsearch.yml配置文件(如没有挂载配置文件,则需去容器内查找)

/mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /mydata/elasticsearch/dada:/usr/share/elasticsearch/dada \
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.17.2

解决方法

修改 elasticsearch.yml中的配置。空格要特别注意

在这里插入图片描述

在这里插入图片描述

启动成功

重新启动容器

docker start e09e7a49ae97

在这里插入图片描述

资料参考:原因+解决方法

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/131474.html

(0)
飞熊的头像飞熊bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!