6.elasticsearch-head插件安装
安装elasticsearch-head前需要安装node.js
6.1Node.Js安装
6.1.1下载
wget https://nodejs.org/dist/v12.18.1/node-v12.18.1-linux-x64.tar.xz
6.1.2解压
tar xf node-v12.18.1-linux-x64.tar.xz
6.1.3重命名
mv node-v12.18.1-linux-x64 node
cd node
6.1.4配置环境变量
vim /etc/profile
export PATH=$PATH:/root/node-v12.18.1-linux-x64/bin
source /etc/profile
6.1.5 验证
node -v
6.2elasticsearch-head的安装
6.2.1下载
git clone git://github.com/mobz/elasticsearch-head.git
6.2.2安装grunt-cli
npm install -g grunt-cli
6.2.3安装grunt
cd elasticsearch-head
npm install grunt --save
6.2.4安装依赖的npm包
npm install
6.2.5修改启动配置文件
所有依赖包安装成功后,修改 elasticsearch-head 目录下的 Gruntfile.js 文件,在 options 属性内增加 hostname,设置为 0.0.0.0
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}
}
6.2.6修改elasticsearch的elasticsearch.yml文件
cd /elasticsearch/config
vim elasticsearch.yml
#增加如下内容
http.cors.enabled: true
http.cors.allow-origin: "*"
6.2.7启动并验证
在elasticsearch-head目录下执行命令
grunt server
出现如下内容标识成功:
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100