1下载项目
git clone git://github.com/mobz/elasticsearch-head.git
2 下载后进入elasticsearch-head,安装依赖包
npm install
3 运行elasticsearch-head服务
npm run start
4 启动成功
5 配置es的连接地址
vim /opt/elasticsearch-head/_site/app.js
app.App = ui.AbstractWidget.extend({
defaults: {
base_uri: null
},
init: function(parent) {
this._super();
this.prefs = services.Preferences.instance();
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.1.11:9200";
if( this.base_uri.charAt( this.base_uri.length - 1 ) !== "/" ) {
// XHR request fails if the URL is not ending with a "/"
this.base_uri += "/";
}
if( this.config.auth_user ) {
var credentials = window.btoa( this.config.auth_user + ":" + this.config.auth_password );
$.ajaxSetup({
headers: {
"Authorization": "Basic " + credentials
}
});
6 修改Elasticsearch 服务配置属性
http.cors.enabled true 如果启用了 HTTP 端口,那么此属性会指定是否允许跨源 REST 请求。
http.cors.allowed.origin localhost 如果 http.cors.enabled 的值为 true,那么该属性会指定允许 REST 请求来自何处。
vim /opt/es6/elasticsearch-6.2.4/config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
7重启es和es-head
ubuntu@ubuntu:/opt/es6/elasticsearch-6.2.4$ ./bin/elasticsearch
root@ubuntu:/opt/elasticsearch-head# npm run start
image.png
网友评论