catalogue
I. elasticsearch7 6.1 installation steps
III. install IK word splitter (ordinary user operation)
be careful:
- es cannot be started by root user, and some operations cannot be operated by root user. For specific reasons, please refer to the blog
- I use ES7 The cluster is built in version 6.1. Refer to other versions
- This version is a cluster build, not a stand-alone version. I only write the operation of one machine below. The operation of the other two or more machines is the same. You only need to modify the corresponding IP and node name
es installation package:
Link: https://pan.baidu.com/s/1oieQ8BFBAs_TMMB8Aw5dCA
Extraction code: xtub
kibana installation package:
Link: https://pan.baidu.com/s/1ItcRhH9Hhg4D49pKqdncAA
Extraction code: 8opj
ik installation package:
Link: https://pan.baidu.com/s/1LkbbkF5qDc4_c45W9Nj8eg
Extraction code: ig0l
head installation package:
Link: https://pan.baidu.com/s/1FgsUbvv6std0qazhqMkPyw
Extraction code: 0nms
I. elasticsearch7 6.1 installation steps
1. Create a es dedicated user (ordinary user)
//Create elastic search user group groupadd elasticsearch //Create ccb user and set password useradd ccb passwd ccb //Create folder mkdir -p /usr/local/es //Create a folder elasticsearch - 7.6. In es one mkdir -p elasticsearch-7.6.1 //Users es are added to the elasticsearch user group usermod -G elasticsearch ccb chown -R ccb/usr/local/es/elasticsearch-7.6.1 //Modify permissions so that ordinary users ccb have greater permissions visudo //Under the line root ALL=(ALL) ALL //Add ccb users as follows: ccb ALL=(ALL) ALL //After adding and saving successfully, switch to ccb user operation su ccb
2. Upload and unzip the compressed package
Note: at this time, you should switch to the ccb user for operation. The following operations should be performed by the ccb user, otherwise some problems may occur
cd /user/local/ tar -zvxf elasticsearch-7.6.1-linux-x86_64.tar.gz -C /usr/local/es/
3. Create two folders to store data and logs
mkdir -p /usr/local/es/elasticsearch-7.6.1/log mkdir -p /usr/local/es/elasticsearch-7.6.1/data
4. Modify the configuration file elasticsearch yml
cd /usr/local/es/elasticsearch-7.6.1/config rm -rf elasticsearch.yml vim elasticsearch.yml //node1 cluster.name: ccb-es node.name: node1 path.data: /usr/local/es/elasticsearch-7.6.1/data path.logs: /usr/local/es/elasticsearch-7.6.1/log network.host: 192.168.197.5 http.port: 9200 discovery.seed_hosts: ["192.168.197.5", "192.168.197.6", "192.168.197.7"] cluster.initial_master_nodes: ["node1", "node2", "node3"] bootstrap.system_call_filter: false bootstrap.memory_lock: false http.cors.enabled: true http.cors.allow-origin: "*" //node2 cluster.name: ccb-es node.name: node2 path.data: /usr/local/es/elasticsearch-7.6.1/data path.logs: /usr/local/es/elasticsearch-7.6.1/log network.host: 192.168.197.6 http.port: 9200 discovery.seed_hosts: ["192.168.197.5", "192.168.197.6", "192.168.197.7"] cluster.initial_master_nodes: ["node1", "node2", "node3"] bootstrap.system_call_filter: false bootstrap.memory_lock: false http.cors.enabled: true http.cors.allow-origin: "*" //node3 luster.name: ccb-es node.name: node3 path.data: /usr/local/es/elasticsearch-7.6.1/data path.logs: /usr/local/es/elasticsearch-7.6.1/log network.host: 192.168.197.7 http.port: 9200 discovery.seed_hosts: ["192.168.197.5", "192.168.197.6", "192.168.197.7"] cluster.initial_master_nodes: ["node1", "node2", "node3"] bootstrap.system_call_filter: false bootstrap.memory_lock: false http.cors.enabled: true http.cors.allow-origin: "*"
5. Modify JVM Option, adjust the JVM heap memory size according to the memory size of each machine (for example, my physical machine memory is 8G, and then I adjust 1.5G memory for three virtual machines. In jvm.option s, I give 400m, because I will not store too much data in the cluster, so everyone can adjust it according to their own situation)
cd /usr/local/es/elasticsearch-7.6.1/config vim jvm.options -Xms400m -Xmx400m
6. Start es service
get into bin catalogue ./elasticsearch -d see es process jps If jps Report the error, don't find it, you didn't pretend jdk,Just execute the following command yum install java-1.8.0-openjdk-devel.x86_64
7. Partial startup error handling method
1. The first is to see if your firewall is turned off. If not, you must turn it off
close Linux firewall It takes effect permanently and will not be restored after restart On: chkconfig iptables on close: chkconfig iptables off Effective immediately and restored after restart On: service iptables start close: service iptables stop
2. If max file descriptors [4096] for elasticsearch process like too low, increase to at least [65536] error occurs, it is because es you need to create a large number of index files, so you need to lift the limit on the maximum number of open files in the linux system (all three machines need to operate)
sudo vi /etc/security/limits.conf //Don't copy the * sign below. Copy the following sentences to limits Conf file * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
3. If Max virtual memory areas vm max_ map_ Count [65530] like too low, increase to at least [262144] error, because the maximum virtual memory is too small and the three machines execute the command
vi /etc/sysctl.conf //Add the following vm.max_map_count=262144 //Execute after saving sysctl -p
4. The above is the problem I encountered. If there are other problems, you have to Baidu yourself
II. Install kibana client (all three machines should be installed. Ordinary users should perform the following operations)
1. Download Kibana and put it in the es directory
2. Unzip the file: tar -zxvf kibana-X.X.X-linux-x86_64.tar.gz
3. Go to / usr/local/es/kibana-X.X.X-linux-x86_64/config directory
4. Using the vim editor: vim kibana yml
server.port: 5601 server.host: "The server IP" elasticsearch.hosts: ["http://IP:9200 "] / / here is the access address of elasticsearch
5. Start Kibana
/usr/local/es/kibana-7.6.1-linux-x86_64/bin/kibana
6. Visit Kibana
http://IP:5601
III. install IK word splitter (ordinary user operation)
1. Create / plugins/ik in the es directory
mkdir -p /usr/local/es/elasticsearch-7.6.1/plugins/ik
2. Upload and unzip the ik word splitter
cd /usr/local/es/elasticsearch-7.6.1/plugins/ik unzip elasticsearch-analysis-ik-7.6.1.zip
3. Restart es, ik and install it here
4. Install elasticsearch head plug-in (all three machines need to be operated. Ordinary users need ccb operation)
After the es service is started, the access interface is ugly. In order to better view the information in the index library, we can install the elasticsearch head plug-in, which can more easily and quickly see the es management interface
1. Install node js
cd /usr/local/es wget https://npm.taobao.org/mirrors/node/v8.1.0/node-v8.1.0-linux-x64.tar.gz tar -zxvf node-v8.1.0-linux-x64.tar.gz -C /usr/local/es/
2. Create soft connection
sudo ln -s /usr/local/es/node-v8.1.0-linux-x64/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm sudo ln -s /usr/local/es/node-v8.1.0-linux-x64/bin/node /usr/local/bin/node
3. Modify environment variables
vi /etc/profile export NODE_HOME=/usr/local/es/node-v8.1.0-linux-x64 export PATH=:$PATH:$NODE_HOME/bin
After modifying the environment variable, use source to take effect
source /etc/profile
4. Verify that the installation was successful
node -v npm -v
5. Upload installation package
6. decompression
cd /usr/local/es/ tar -zxvf elasticsearch-head-compile-after.tar.gz -C /usr/local/es/
7. Modify gruntfile JS this file
cd /usr/local/es/elasticsearch-head vim Gruntfile.js
8. Find line 93, hostname: '192.168 100.100 ', modified to 192.168 197.5 (that is, modify it to the IP of your own machine)
connect: { server: { options: { hostname: '192.168.197.5', port: 9100, //After startup, if the display port is occupied, you can modify this port, such as 9124 base: '.', keepalive: true } } }
9. Modify app js
cd /usr/local/es/elasticsearch-head/_site vim app.js
Navigate to line 4354 and modify http://localhost:9200 by http://192.168.197.5:9200
10. Start the head service
cd /usr/local/es/elasticsearch-head/node_modules/grunt/bin/ //Foreground start ./grunt server
11. Access the elasticsearch head interface: http://ip:9100/ (Note: if the above port is modified by itself, the modified port shall be used)
V. summary
Elasticsearch7.6.1 and other basic toolkits are installed here. The whole installation process is not difficult, but you need to be careful because there are many places to change the configuration! Thanks for watching