introduction
ElasticSearch 6.8.4 is installed on the client machine, so the local installation is used for stand-alone testing, so record it.
The Linux version in the virtual machine is centos7.
Depends on environment configuration
Install JDK
Install JDK tutorial, you can read my article: https://blog.csdn.net/weixin_52799373/article/details/126405150
Download the installation package
Download them all to /usr/local
elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.4.tar.gz
kibana
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.8.4-linux-x86_64.tar.gz
Install
decompress
tar -zxvf elasticsearch-6.8.4.tar.gz
tar -zxvf kibana-6.8.4-linux-x86_64.tar.gz
After decompression:
install elasticsearch
Because of security issues, elasticsearch does not allow the root user to start, so create a new user to start elasticsearch.
# 添加用户
useradd elasticsearch
# 设置权限
chown -R elasticsearch:elasticsearch /usr/local/elasticsearch-6.8.4
chown -R elasticsearch:elasticsearch /usr/local/kibana-6.8.4-linux-x86_64
Start configuration tweaks
Edit vim /usr/local/elasticsearch-6.8.4/config/elasticsearch.yml
Set the startup ip and port. If not set, the default is localhost
to uncomment, or you can add it directly at the end. Feel free to add it later.
network.host: 192.168.169.131
http.port: 9200
System Configuration Adjustments
Modify the /etc/security/limits.conf file, add configuration, need to log in again to take effect
# 在文件末尾中增加下面内容
# 调整每个进程最大同时打开文件数,最大线程个数
# elasticsearch 前面创建的es用户
elasticsearch soft nofile 65536
elasticsearch hard nofile 65536
elasticsearch soft nproc 4096
elasticsearch hard nproc 4096
Modify the /etc/sysctl.conf file and add configuration
vm.max_map_count=262144
sysctl -p executes the command to take effect, otherwise it will fail.
Adjust es startup memory
vim /usr/local/elasticsearch-6.8.4/config/jvm.options
# 根据机器内存而定
-Xms256m
-Xmx256m
start up
Switch elasticsearch user:su elasticsearch
-
Normal startup:
/usr/local/elasticsearch-6.8.4/bin/elasticsearch
The startup is successful as shown in the above figure
. Since the virtual machine has not opened the port yet, I directly access http://localhost:9200/ in the browser in the virtual machine, as shown in the above figure, it is successful. -
Background start:
/usr/local/elasticsearch-6.8.4/bin/elasticsearch -d
Install Kibana
Change setting
Modify /usr/local/kibana-6.8.4-linux-x86_64/config/kibana.yml to configure the port address of es. Since this file is all commented out, it is recommended to add the following content directly at the end:
server.host: "192.168.169.131"
elasticsearch.hosts: ["http://192.168.169.131:9200"]
start up
/usr/local/kibana-6.8.4-linux-x86_64/bin/kibana
Visit http://192.168.169.131:5601
to set Kibana to Chinese:vim /usr/local/kibana-6.8.4-linux-x86_64/config/kibana.yml
i18n.locale: "zh-CN"
The command started by kibana background
mkdir /usr/local/kibana-6.8.4-linux-x86_64/logs
mkdir /usr/local/kibana-6.8.4-linux-x86_64/pid
nohup /usr/local/kibana-6.8.4-linux-x86_64/bin/kibana >> /usr/local/kibana-6.8.4-linux-x86_64/logs/kibana.log 2>&1 & echo $! > /usr/local/kibana-6.8.4-linux-x86_64/pid/kibana.pid
Chinese interface
common problem
java.nio.file.AccessDeniedException: /usr/local/elasticsearch-6.8.4/config/elasticsearch.keystore
means no permission, re-executechown -R elasticsearch:elasticsearch /usr/local/elasticsearch-6.8.4