安装Node
下载源码
1
| wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz
|
1
| xz -d node-v6.10.2-linux-x64.tar.xz
|
1
| [elasticsearch@elasticsearch01 server]$ tar xvf node-v6.10.2-linux-x64.tar -C /data/server/
|
目录重命名
1
| mv node-v6.10.2-linux-x64 node
|
配置NODE_HOME
1 2
| export NODE_HOME=/data/server/node export PATH=$PATH:$NODE_HOME/bin
|
查看安装是否成功


下载插件包
1
| git clone https://github.com/mobz/elasticsearch-head.git
|
安装grunt
1 2
| cd elasticsearch-head npm install -g grunt --registry=https://registry.npm.taobao.org
|
安装head插件
在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行:
1 2
| cd elasticsearch-head npm install grunt --save
|
关于配置
1
| elasticsearch-head下Gruntfile.js文件,默认监听在127.0.0.1下9200端口
|
启动服务
1
| /elasticsearch-head/node_modules/grunt/bin/grunt server (后台运行 + &)
|
修改Elasticsearch配置
修改elasticsearch.yml文件加入以下内容:
1 2
| http.cors.enabled: true
|
1 2
| http.cors.allow-origin: "*"
|