愚者求师之过,智者从师之长。

elasticsearch安装插件elasticsearch-head-master,跨域时报错

Elasticsearch | 作者 smalldongdong | 发布于2018年04月25日 | 阅读数:9326

我在文件:elasticsearch.yml末尾添加:
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
 
结果报错,报错信息:

[2018-04-25T13:06:46,900][INFO ][o.e.p.PluginsService     ] [B3RM21M] no plugins loaded
[2018-04-25T13:06:47,386][ERROR][o.e.b.Bootstrap          ] Exception
java.lang.IllegalArgumentException: unknown setting [http.cors.allowed] did you mean any of [http.cors.allow-headers, http.cors.allow-methods, http.cors.enabled]?
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:293) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:256) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:139) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.node.Node.<init>(Node.java:344) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) [elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) [elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) [elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) [elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.6.0.jar:5.6.0]
[2018-04-25T13:06:47,390][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown setting [http.cors.allowed] did you mean any of [http.cors.allow-headers, http.cors.allow-methods, http.cors.enabled]?
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.0.jar:5.6.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.0.jar:5.6.0]
 
已邀请:

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自: misaki qiumingben

对于head,最方便的是直接在Chrome中安装插件: 
https://chrome.google.com/webs ... kegm/

smalldongdong

赞同来自:

您好,我是在elasticsearch安装插件elasticsearch-head-master,跨域时报错,请问您说的是什么意思啊?不是在elasticsearch.yml末尾添加:
http.cors.enabled: true
http.cors.allow-origin: "*"
 

xiaoke - http://blog.51cto.com/kexiaoke

赞同来自:

看样子配置没有问题,你是所有的es节点都添加了吗,添加完了,有没有进行重启操作。

zqc0512 - andy zhou

赞同来自:

你是安装的这个么?
https://github.com/mobz/elasticsearch-head
http.cors.allow-headers: Authorization  你没有配置密码的时候把这个注释掉。
这玩意是独立的了。

要回复问题请先登录注册