用于查看集群状态
- ES: v5.6.12
- OS: Ubuntu 16.04
ES安装完成
root@elk:~# curl localhost:9200
{
"name" : "80ELvPI",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "v8oV3pEwQV-BGk2YTK1DBA",
"version" : {
"number" : "5.6.12",
"build_hash" : "cfe3d9f",
"build_date" : "2018-09-10T20:12:43.732Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
root@elk:~#
head插件
官方readme中有几种方式使用:
- Running with built in server
- Running with docker
- Running as a Chrome extension
- Running as a plugin of Elasticsearch (deprecated)
- Running with the local proxy
- Alternatives
以前我们用的最多的就是作为一个ES插件来使用,不过从ES 5.*版本开始便不再支持;
故目前我将其build为一个server,而后再连接本机ES端口来使用
running
git clone git://github.com/mobz/elasticsearch-head.git
网速慢,或者直接下载
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
cd ./elasticsearch-head
npm install
npm install grunt-cli
npm install -g cnpm --registry=
启用9100端口vim ./elasticsearch-head/Gruntfile.js
,加一个hostname
connect: {
server: {
options: {
hostname: '10.10.2.109',
port: 9100,
base: '.',
keepalive: true
}
}
}
此时可启动服务,但未连接到ES集群
root@elk:/opt/elk/elasticsearch-head-master# ln -s /opt/elk/elasticsearch-head-master/node_modules/grunt/bin/grunt /usr/bin/grunt
root@elk:/opt/elk/elasticsearch-head-master# grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://10.10.2.109:9100
connect ES
vim /opt/elk/elasticsearch-head-master/_site/app.js
,修改为ES监听地址
init: function(parent) {
this._super();
this.prefs = services.Preferences.instance();
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.10.2.109:9200";
if( this.base_uri.charAt( this.base_uri.length - 1 ) !== "/" ) {
vim /etc/elasticsearch/elasticsearch.yml
,添加如下字段
http.cors.enabled: true
http.cors.allow-origin: "*"
ES-head
网友评论