GitHub - mobz/elasticsearch-head: A web front end for an elastic search cluster
上传并解压:
- root@zq-virtual-machine:/home/elasticsearch# rz
- root@zq-virtual-machine:/home/elasticsearch# unzip elasticsearch-head-master.zip
根目录下使用命令启动elasticsearch:
root@zq-virtual-machine:/home/elasticsearch/elasticsearch-8.4.0/bin# su esroot
$ ./elasticsearch
node -v
如果没有安装:先安装nodejs
1、官网下载nodejs
2、创建文件夹: mkdir -p /home/soft/
3、添加安装包:
cd /home/soft/
4、解压
tar -xvf node-v16.15.1-linux-x64.tar.xz
ln -s /home/soft/node-v16.15.1-linux-x64/bin/node /usr/bin
ln -s /home/soft/node-v16.15.1-linux-x64/bin/npm /usr/bin
5、然后测试/查看版本
node -v
npm -v
cd elasticsearch-head-master/
npm install
报错:
npm ERR! code 137 npm ERR! path /home/elasticsearch/elasticsearch-head-master/node_modules/phantomjs-prebuilt npm ERR! command failed npm ERR! command sh /tmp/install-cf9989e7.sh npm ERR! PhantomJS not found on PATH npm ERR! Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2 npm ERR! Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 npm ERR! Receiving... npm ERR! Killed npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-08-30T04_33_46_160Z-debug-0.log单独安装:npm install phantomjs@2.1.1 --ignore-scripts
再次:npm install
npm run start
虚拟机内访问:
物理主机访问:http://192.168.1.129:9100/
修改防火墙状态,并开放9100端口:
开启ufw:ufw enable
开放9100端口:ufw allow 9100
查看ufw状态:ufw status
查看状态:systemctl status firewalld关闭防火墙:systemctl stop firewalld
可通过命令:telnet 192.168.1.129 9100,测试端口是否开放。
vim config/elasticsearch.yml
- # 在末尾添加配置
- http.cors.enabled: true
- http.cors.allow-origin: "*"
重启es和es-head,访问结果如下图: