The previous chapter mainly explained the deployment of es cluster , this chapter mainly describes the installation of several common plug-ins in es cluster.
One, install the node environment
Since both the head and sql plugins depend on the node environment, the node environment must be installed before
installation. For details, please refer to node environment deployment and npm domestic source configuration
2. Install the head plugin (offline installation)
Description:
es-head is a plug-in of ElasticSearch, which provides a visual operation interface of es. After es 2.X version, the plug-in is not installed and started in the plug-in installation mode that supports es, but is started in grunt mode; at the same time, elasticsearch-head above 5.0 cannot be placed in the plugins and modules directory of elasticsearch, otherwise elasticsearch will start up Report an error.
1. Download the head plugin installation package
cd /u01/isi/application/elasticsearch-6.5.1
wget https://codeload.github.com/mobz/elasticsearch-head/zip/master 或
wget https://github.com/mobz/elasticsearch-head/archive/master.zip 或
wget https://github.com/mobz/elasticsearch-head
2. Unzip and install (root user)
unzip master.zip
mv elasticsearch-head-master elasticsearch-head
cd elasticsearch-head
npm install -g grunt-cli
npm install #可以忽略该命令
cd ..
chown -R isi:isi elasticsearch-head #统一权限
3. Modify es and es-head configuration
1) Modify elasticsearch.yml to add cross-domain configuration (restart es to take effect)
http.cors.enabled: true
http.cors.allow-origin: "*"
2) Edit elaticseach-head/Gruntfile.js (non-essential operation)
Modify the server listening address and add the hostname attribute as follows:
Hostname can be'*' or'ip address' or '0.0.0.0', please do not write less "," after true
3) Modify the connection address of es-head (non-essential operation)
cd /u01/isi/application/elasticsearch-6.5.1/elasticsearch-head/_site
编辑app.js
找到this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
将localhost改成es服务ip地址
4. Restart es, then start es-head
After modifying the es configuration, you need to restart es, then switch to the es-head directory, execute the following statement to start es-head:
./ grunt server
write the script to start and stop the head plug-in
cat start.sh
cd /u01/isi/application/elasticsearch-6.5.1/elasticsearch-head
nohup grunt server &
cat stop.sh
kill -9 `ps -ef | grep grunt | grep -v grep | awk '{print $2}'`
Grant permissions
chmod +x start_head.sh
chmod +x stop_head.sh
5. Verification
http://ip:9100/
Three, es-sql installation
1. Download the corresponding version of sq-sql plugin
cd /u01/isi/application/elasticsearch-6.5.1
wget https://github.com/NLPchina/elasticsearch-sql/archive/6.5.1.0.tar.gz
2. Unzip and install (root user)
tar -xf 6.5.1.0.tar.gz
cd elasticsearch-sql-6.5.1.0
npm install express -save
cd ..
chown -R isi:isi elasticsearch-sql-6.5.1.0 #统一权限
3. Modify the service port in the site-server/site_configuration.json configuration file
cd /u01/isi/application/elasticsearch-6.5.1/elasticsearch-sql-6.5.1.0/src/site-server
cat site_configuration.json
4. Restart es and start es-sql
Write es-sql start and stop script
cat start.sh
cd /u01/isi/application/elasticsearch-6.5.1/elasticsearch-sql-6.5.1.0
cd src/site-server && nohup node node-server.js &
cat stop.sh
kill -9 `ps -ef|grep node|grep -v grep|awk '{print $2}'`
Grant permissions
chmod +x start_sql.sh
chmod +x stop_sql.sh
5. Verification
http://192.168.80.151:9101/
4. Chinese word segmentation plugin IK
1. Online installation
1) Installation link
https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.1/elasticsearch-analysis-ik-6.5.1.zip
2) Installation (es users can install)
cd /u01/isi/application/elasticsearch-6.5.1/bin
./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.1/elasticsearch-analysis-ik-6.5.1.zip
Follow the prompts to belong y
to
2. Offline installation
1) Download the plugin
cd /u01/isi/application/elasticsearch-6.5.1
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.1/elasticsearch-analysis-ik-6.5.1.zip
2) Unzip
mkdir analysis-ik
unzip elasticsearch-analysis-ik-6.5.1.zip -d analysis-ik
chown -R isi:isi analysis-ik
mv analysis-ik /u01/isi/application/elasticsearch-6.5.1/plugins/
3) Restart the es service
cd /u01/isi/application/elasticsearch-6.5.1/
./stop.sh
./start.sh