1、git下载软件包
yum -y install git git clone git://github.com/mobz/elasticsearch-head.git
备注:安装包不要放到elasticsearch/plugins目录下
2、node安装
http://www.cnblogs.com/shhnwangjian/p/6559732.html
2.1、下载编译好的文件
|
1
2
3
|
yum -y install wgetcd /usr/local/src/wget http://nodejs.org/dist/v6.9.4/node-v6.9.4-linux-x64.tar.gz |
2.2、解压
|
1
|
tar -xvf node-v6.9.4-linux-x64.tar.gz |
2.3、查看版本信息
|
1
2
|
cd /usr/local/src/node-v6.9.4-linux-x64/bin./node -v |
2.4、设置全局
|
1
2
|
ln -s /usr/local/src/node-v6.9.4-linux-x64/bin/node /usr/local/bin/nodeln -s /usr/local/src/node-v6.9.4-linux-x64/bin/npm /usr/local/bin/npm |
或者设置NODE_HOME环境变量
|
1
2
|
export NODE_HOME=/usr/local/src/node-v6.9.14-linux-x64export PATH=$NODE_HOME/bin:$PATH |
2.5、淘宝镜像cnpm安装 https://npm.taobao.org/
|
1
2
3
|
npm install -g cnpm --registry=https://registry.npm.taobao.orgln -s /usr/local/src/node-v6.9.4-linux-x64/bin/cnpm /usr/local/bin/cnpmcnpm -v |
3、安装grunt和grunt-cli
|
1
2
3
|
npm install -g grunt-clinpm install -g grunt
cnpm -v |
3、安装grunt
|
1
2
3
|
npm install -g cnpm --registry=https://registry.npm.taobao.orgln -s /usr/local/src/node-v6.9.4-linux-x64/bin/cnpm /usr/local/bin/cnpmcnpm -v |
|
1
2
|
npm install -g grunt-clinpm install -g grunt |
4、修改Elasticsearch配置文件
/etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true http.cors.allow-origin: "*"
5、修改Gruntfile.js
elasticsearch-head/Gruntfile.js
connect: {
server: {
options: {
hostname: ‘0.0.0.0‘,
port: 9100,
base: ‘.‘,
keepalive: true
}
}
}
增加hostname属性,设置为0.0.0.0
6、修改app.js
elasticsearch-head/_site/app.js
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.10.83.163:9200";
把localhost修改成ES的服务器地址,如上面10.10.83.163
7、运行head
进入elasticsearch-head 目录
npm install
启动
grunt server
页面访问:http://10.10.83.163:9100
8、后台启动elasticsearch-head
nohup grunt server &
如果想关闭head插件,查找进程命令:
ps aux|grep head
1、修改Elasticsearch配置文件
/etc/elasticsearch/elasticsearch.yml
http.cors.allow-headers: Authorization
2、页面访问
http://10.10.83.163:9100/?auth_user=elastic&auth_password=changeme
原文:http://www.cnblogs.com/floodwater/p/7371949.html