1、首先确保es集群开启无误,
2、使用head访问es报错(F12打开都是错,)
3、原因:因为配置了x-pack,有账户密码,所以head访问不了es集群
4、解决:
在es的安装目录下,修改vi config/elasticsearch.yml
增加如下代码
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,Content-Type
5、重启集群,仍然访问不上,f12还是报一堆的错
6、在连接上面添加 写上你的x-pack配置的账号密码
默认是 账号elastic 密码changeme
?auth_user=elastic&auth_password=changeme
7、OK了,正确无误,大家快去测试把