I am in the 2 hour of my Elastic Search immersion. I successfully installed ES with Marvel (with marvel.agent.enabled: false
in config/elasticsearch.yml) and was able to make successful requests from Sense. I restarted my development machine and now when I make the following request on Sense, it responds:
Request failed to get to the server (status code: 0):
Elasticsearch may not be reachable or you may need to check your CORS settings.If CORS is enabled, try turning off Sense's Basic Authentication support under Setting (cog icon).This will result in a less strict CORS enforcement by the browser.
Please check the marvel documentation for more information.
Request(source):
PUT /megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
As directed, I checked if ES is reachable by making a similar request on curl:
Request:
curl -XPUT http://localhost:9200/megacorp/employee/100 -d '{ "first_name" : "test" }'
Response:
{"_index":"megacorp","_type":"employee","_id":"100","_version":1,"created":true}
This leads me to think that ES is available.
Moving on to the next check "you may need to check your CORS settings.". I added the following configuration to elasticsearch.yml (and restarted ES) based on this recommendation:
http.cors.enabled: true
http.cors.allow-origin: /.*/
http.cors.allow-credentials: true
But there is no change in behaviour.
Toggling "Support Basic Auth" in Marvel/Smart settings has no impact either.
Welcome any pointers on what could be going wrong.
Try running the marvel/sense html page on another browser or in private/incognito mode. I had the same problem and doing this solved it. I think it is due to the settings being stored on cookie or something not really sure.
I was having this same problem too and according to Elasticsearch's docs here: http://www.elastic.co/guide/en/marvel/current/configuration.html#cors, you have to enable CORS.
To summarize, open the elasticsearch.yml file in the config/ folder and put this
http.cors.enabled: true
http.cors.allow-origin: /.*/
http.cors.allow-credentials: true
somewhere in there, probably the "Network And HTTP" section.
Then, after I restarted elasticsearch, it worked fine for me in Marvel Sense.
So when trying to run commands in sense, try using the ip address of the machine where the server is hosted, instead of using http://localhost:9200/_plugin/marvel/sense/index.html. This worked for me.
In your ES cluster logs (in one node) locate a line looking like
[INFO ][http ] [c7_64] bound_address {inet[/0:0:0:0:0:0:0:0:9201]}, publish_address {inet[/192.168.88.128:9201]}
You are interested in what's after publish_address
. When accessing Sense use the IP:PORT you see there. In my example, the Sense URL would look like this:
http://192.168.88.128:9201/_plugin/marvel/sense/index.html
The CORS part is mostly valid for the scenario where Marvel is installed in a separate cluster and it shouldn't be needed when Marvel is installed in the same cluster as the monitored nodes. It's also needed when Shield is installed in the cluster.
I was also having the same problem. Make sure that the server field is not blank. My problem got solved after filling in the field with local
I was having the same problem with Chrome. Clearing browser data solves my problem. It's under history -> clearing browser data -> check cookies and other site and plugin data,cached images and files,autofill form data,Hosted app data.
Not sure which one did the trick but that's how I did and it worked. Hope this helps.
Not strictly related to Marvel, but when I have issue connecting to elasticsearch from "outside" the server I need to.
Change the elasticsearch.yml
config, where the host is listening to - listen to all network interfaces:
network.host: 0.0.0.0
After that, depending on your server, you should open the tcp port on your firewall (if you use the default port of elasticsearch: 9200). For example on Centos (or RHEL), you should run:
sudo firewall-cmd --zone=public --add-port=9200/tcp --permanent
sudo firewall-cmd --reload
来源:https://stackoverflow.com/questions/28354523/es-reachable-from-curl-but-not-from-marvel-sense