1下載項(xiàng)目
git clone git://github.com/mobz/elasticsearch-head.git
2 下載后進(jìn)入elasticsearch-head罩引,安裝依賴包
npm install
3 運(yùn)行elasticsearch-head服務(wù)
npm run start
4 啟動(dòng)成功
image.png
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 服務(wù)配置屬性
http.cors.enabled true 如果啟用了 HTTP 端口伟姐,那么此屬性會(huì)指定是否允許跨源 REST 請(qǐng)求聂抢。
http.cors.allowed.origin localhost 如果 http.cors.enabled 的值為 true,那么該屬性會(huì)指定允許 REST 請(qǐng)求來自何處旨袒。
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