Create users
From 5.0, Elasticsearch’s security level has improved, and the ROOT account is not allowed to start, so we have to add a user
1 Create Elasticsearch user group
1 |
|
2 Create a user ES and set the password to ES
After
1 2 |
|
, enter the password twice and complete the password modification
3 User ES Add to Elasticsearch User Group
1 |
|
4 Set SUDO permissions
[root
@localhost
~]# visudo
Appears: Visudo: Command Not Found error, because there is no Sudo installation,
execute command installation:yum
install
sudo
For other reasons, please refer tohttps://blog.csdn.net/Zsigner/article/details/88863745
1 2 3 4 5 |
After modifying the effective command sudo visudo -c
|
1 2 |
|
download installation package
download elasticsearch in/usr/local/src directory, and decompress tar.gz
[[email protected] src]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.tar.gz
Appears: -bash: Wget: Command Not Founderror, the reason is that there is no installation of WGET
execute commands under root -yinstall wett, ES user under Sudo Yum -Y Install WGET
After downloading, decompress (the compression command is a file name generated by TAR -ZCVF compressed file/directory EG: Tar -ZCVF FILENAME.TAR.GZ ./filename)
[es
@localhost
src]$ sudo tar -zxvf elasticsearch-
6.3
.
2
.tar.gz
Enter the ES account password.
ES all = (all) all add
ceph ALL=(es) NOPASSWD:ALL
Perform the command under ES user, you don’t need to enter the password anymore, as follows
|
1 |
|
Change Elasticsearch-6.3.2 folder and internal files, the user is ES, the user group is elasticsearch, -R means step by step
1 |
|
elasticsearch configuration
elasticsearch.yml modification
1 |
|
Error: Sudo: vim: Command Not Found, the reason is not installed with VIM
Installation command: yum install vim
Installation completes the modified yml file command:
vim config/elasticsearch.yml
Modify content (add it without it):
cluster.name: my-application
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
# Because Centos6 does not support seccomp, ES defaults bootstrap.system_call_filter to test for TRUE
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
Modify /etc/sysctl.conf
Switch back to root user execution
1 |
|
Add content to the last side of the file:
vm.max_map_count=262144
After saving exit, use sysctl -P to refresh and take effect
[[email protected] ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.max_map_count = 262144
[[email protected] ~]#
Modify the file /etc/security/limits.conf
1 |
|
Add the following content:
1 2 3 4 5 |
|
Start ElasticSearch may also report the following errors
max number of threads [1024] for user [lish] likely too low, increase to at least [4096]
Solution: Switch to the root user and enter the limits.d directory to modify the configuration file.
vi /etc/security/limits.d/90-nproc.conf
Modify the following content:
* soft nproc 1024
# Modified to
* soft nproc 4096
Start Elasticsearch
After completing the above configuration modification, switch to the ES user, the directory switch to the ELASTICSEARCH installation directory for execution
1 |
|
Enter LocalHost in the browser: 9200 verification whether it is successful. If the browser outputs the following information, it means that the installation is successfully started
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
If abnormal information appears during the startup process, please follow the information on Baidu. Below is an error message encountered by the startup process and attach a solution
信息 4 1: Expecting token of type [start_object] But Found [Value_string]];
Reason for error: Elasticsearch.yml file internal error
Solution: Carefully check the configuration item writing format in the yml file: (space) name: (space) value
------------------------------------------------ -----------------------------------------------------------------------------------------
Anomalial information 2: java.lang.unsupportedOperationException: Seccomp unavailable: config_seccomp not compiled into kernel, config_seccomp and config_filter are neededed
Reason for error: CentOS6 does not support seccomp, and ES defaults bootstrap.system_call_filter to test for TRUE, so the detection fails.
Solution: Modify elasticsearch.yml to add content:
bootstrap.Memory_lock: false
bootstrap.system_call_filter: false
------------------------------------------------ -----------------------------------------------------------------------------------------
------------------------------------------------ -----------------------------------------------------------------------------------------
Anomalial information 3: bindtransportException [failed to bind to [9300-9400]
Solution to open the configuration file elasticsearch.yml to modify network.host: 192.168.0.1 to the IP 0.0.0.0.0
------------------------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------
Abnormal Information 4: Max Number of Threads [1024] for user [lish] likely too low, increase to at least [2048]
Solution: Switch to the root user and enter the limits.d directory to modify the configuration file.
vi /etc/security/limits.d/90- nProc.conf
Modify the following content:
* Soft NPROC 1024
#change into
* Soft NPROC 2048
Reference article:
https://www.cnblogs.com/jingping/p/9448099.html