ElasticSearch配置Head
Install and configure node.js
- Go to the official website to download the latest version of node: http://nodejs.cn/download/
Baidu Cloud:
Link: https://pan.baidu.com/s/1usLKcn1FpSjKoaTh23eWZg
Extraction code: 19tn to
get node-v12.13.0-linux-x64. tar.xz file, upload to linux - Use command to convert xz file to tar file
xz -d node-v12.13.0-linux-x64.tar.xz
- Unzip the tar file:
tar -xvf node-v12.13.0-linux-x64.tar
- Configure environment variables
Copy the installation path, mine is as follows: /opt/local_software/node-v14.6.0-linux-x64
vi /etc/profile
Add the following code:
export NODE_HOME=/opt/local_software/node-v14.6.0-linux-x64
export PATH=$PATH:$NODE_HOME/bin
- Update environment variables
source /etc/profile
- Verify that the installation is successful:
node -v
Install npm
If not installed, please refer to the blog linux installation npm
verification version:
Install es-head
Download path: My Baidu Cloud
Link: https://pan.baidu.com/s/18pjsia7dTe_U4nP3gfC8dA
Extraction code: io4z
- Upload to linux
- unzip files
unzip elasticsearch-head-master.zip
- Enter the folder, modify the configuration file
- Modify the Gruntfile.js file
vi Gruntfile.js
Add a line of hostname (you can enter /connect and press Enter to directly locate this line)
connect: {
server: {
options: {
port: 9100,
base: '.',
hostname: '*',
keepalive: true
}
}
}
- Modify the app.js file
vi _site/app.js
Modify this line: the following ip should be the ip and port of es (you can enter /this.bash and press Enter to directly locate this line)
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.135.237:9201";
- Execute npm command 1 (otherwise the seventh step is likely to report an error)
npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
- Execute npm command 2
npm install
- Modify the elasticsearch.yml file of ES
vi config/elasticsearch.yml
Add the following lines, because ES does not support cross-domain by default, so we should configure cross-domain configuration to allow ES to connect to the head plugin
http.cors.enabled: true
http.cors.allow-origin: "*"
Run ES-head
Run ES
Run ES-head
Start head in the foreground:
./node_modules/grunt/bin/grunt server
When the following interface appears,
you can access the page:
http://192.168.135.237:9100/
modify the ip address in the text box and click connect (mine is a cluster of 5 ESs, and the following page happens to be 5 nodes):
Start head in the background:
nohup ./node_modules/grunt/bin/grunt server > es-head-start.log 2>&1 &