环境
centos7 elastichsearch-6.2.3 node v8.11.1
安装elasticsearch
安装elasticsearch请查看:https://blog.csdn.net/mjlfto/article/details/79769152
安装node
1、到nodejs官网现在最新nodejs,官网下载地址:https://nodejs.org/en/download/
2、 解压压缩包
3、配置环境变量
4、环境变量生效:source /etc/profile
5、执行:node -v
下载elastichsearch-head插件
1、安装git:yum install git
2、git clone git://github.com/mobz/elasticsearch-head.git
3、cd elasticsearch-head
4、npm install,如下图,会报错
此时忽略报错,执行:npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
5、npm run start(忽略)
grunt安装
npm install -g grunt-cli
修改Elasticsearch配置文件
vim elasticsearch-5.6.1/config/elasticsearch.yml
加入以一内容:
http.cors.enabled: truehttp.cors.allow-origin: "*"
修改Gruntfile.js,如下图:
增加hostname: ‘192.168.1.107’
启动elasticsearch-head:如下图
grunt server
浏览器访问(如无法访问,开启防火墙,添加9100到防火墙):http://192.168.1.107:9100/
elasticsearch-head 设置后台启动和关闭
启动(如下图,不能用root账户启动):nohup grunt server &exit
关闭:kill -9 进程号