elasticsearch-head是els的界面插件,地址https://github.com/mobz/elasticsearch-head
1.进入github并下载
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
2.解压
[root@localhost /usr/local/src]# unzip master.zip [root@localhost /usr/local/src]# mv elasticsearch-head-master/ /usr/local/ [root@localhost /usr/local/src]# ls /usr/local/elasticsearch-head-master/ Dockerfile elasticsearch-head.sublime-project grunt_fileSets.js LICENCE plugin-descriptor.properties README.textile src Dockerfile-alpine Gruntfile.js index.html package.json proxy _site test [root@localhost /usr/local/src]#
3.下载node
https://nodejs.org/en/download/
[root@localhost /usr/local/src]# wget https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz [root@localhost /usr/local/src]# tar -Jxvf node-v8.11.3-linux-x64.tar.xz -C /usr/local/ [root@localhost /usr/local/src]# mv /usr/local/node-v8.11.3-linux-x64/ /usr/local/node-8.11.3
4.配置node环境变量
[root@localhost /usr/local/src]# vim /etc/profile export NODE_HOME=/usr/local/node-8.11.3 export PATH=$PATH:$NODE_HOME/bin [root@localhost /usr/local/src]# source /etc/profile [root@localhost /usr/local/src]# node -v # 输出版本号则代表配置成功 v8.11.3 [root@localhost /usr/local/src]#
5.npm install
[root@localhost /usr/local/src]# cd /usr/local/elasticsearch-head-master/ [root@localhost /usr/local/elasticsearch-head-master]# npm install phantomjs-prebuilt@2.1.14 --ignore-scripts # 因为有墙,phantomjs-prebuilt需要单独安装,不然会失败 [root@localhost /usr/local/elasticsearch-head-master]# npm install
6.需改配置
[root@localhost /usr/local/elasticsearch-head-master]# vim Gruntfile.js connect: { server: { options: { hostname: '0.0.0.0', # 增加这段 port: 9100, base: '.', keepalive: true } } } [root@localhost /usr/local/elasticsearch-head-master]#
7.开启els跨域
[root@localhost /usr/local/elasticsearch-head-master]# cd ../elasticsearch-5.5.2/config/ [root@localhost /usr/local/elasticsearch-5.5.2/config]# vim elasticsearch.yml # 文件末尾加上如下配置 http.cors.enabled: true http.cors.allow-origin: "*" [root@localhost /usr/local/elasticsearch-5.5.2/config]#
8.重启els
[elsearch@localhost bin]$ ps -ef | grep ela [elsearch@localhost bin]$ kill -9 10899 [elsearch@localhost bin]$ ./elasticsearch -d
9.启动elasticsearch-head
[elsearch@localhost elasticsearch-head-master]$ npm run start
10.访问