[英]Elastic search with docker does not start
I am retrieving details from elastic search in my angular application. 我在角度应用程序中从弹性搜索中检索细节。 which worked when i installed the elastic search on my local machine. 当我在我的本地机器上安装弹性搜索时工作。 I had to append the following lines to the elasticsearch.yml file to get it work with the angularApp. 我不得不将以下行附加到elasticsearch.yml文件以使其与angularApp一起使用。
http.cors.allow-origin: "/.*/"
http.cors.enabled: true
Now elastic search server is installed with a docker. 现在弹性搜索服务器与docker一起安装。 It also worked when i ran without adding those two lines. 当我在没有添加这两行的情况下运行时它也起作用。 But when i added and restart the elastic search, it gives me the following error. 但是当我添加并重新启动弹性搜索时,它会给我以下错误。
{1.4.2}: Setup Failed ...
- SettingsException[Failed to load settings from [file:/elasticsearch/config/elasticsearch.yml]]
ScannerException[while scanning a simple key; could not found expected ':'; in 'reader', line 7, column 3:
http.cors.enabled: true
^]
org.elasticsearch.common.settings.SettingsException: Failed to load settings from [file:/elasticsearch/config/elasticsearch.yml]
at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:947)
at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromUrl(ImmutableSettings.java:931)
at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:77)
at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:106)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:177)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: while scanning a simple key
in 'reader', line 6, column 3:
http.cors.allow-origin:"/.*/"
^
Here is the Elasticsearch.yml file on the server 这是服务器上的Elasticsearch.yml文件
There are at least two possible issues, which are not mutually exclusive: 至少有两个可能的问题,这些问题并不相互排斥:
First: 第一:
http.cors.allow-origin:"/.*/"
should really be 应该真的
http.cors.allow-origin: "/.*/"
as YAML notation requires white space separation between the :
and the value of a key-value pair. 因为YAML表示法要求:
和键值对之间的空格分隔。
Second, the error trace you provided suggests that there is leading white space in front of http.cors.allow-origin: "/.*/"
that is inconsistent with its block per proper YAML notation. 其次,您提供的错误跟踪表明http.cors.allow-origin: "/.*/"
前面有前导空格http.cors.allow-origin: "/.*/"
与每个正确的YAML表示法的块不一致。 It's more likely that the http.cors.allow-origin: "/.*/"
needs to be devoid of leading white space if any exists (since I think http
is typically a top-level block in Elasticsearch configuration files). http.cors.allow-origin: "/.*/"
更有可能http.cors.allow-origin: "/.*/"
前导空格(如果存在)(因为我认为http
通常是Elasticsearch配置文件中的顶级块)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.