Create a user
5.0 beginning, ElasticSearch improve the security level is not allowed to start using the root account, so we have to add a user
1 Create a user group elasticsearch
root@localhost ~]# groupadd elasticsearch
2 Create a user and set a password for es es
[root@localhost ~]# useradd es [root@localhost ~]# passwd es
3 es added to the user group of the user elasticsearch
[root@localhost ~]# usermod -G elasticsearch es
4 Set sudo permissions
[root@localhost ~]# visudo
es ALL=(ALL) ALL
After the addition was successfully saved to switch a user operation es
[root@localhost ~]# su es [es@localhost root]$
Download the installation package
[es@localhost src]$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.tar.gz
[es@localhost src]$ tar -xvf elasticsearch-5.5.2.tar.gz
Unzip the file to / usr / local
[es@localhost src]$ sudo mv elasticsearch-5.5.2 /usr/local
Change their user elasticsearch-5.5.2 folder and internal file is es, the user group group elasticsearch, -R represents a stepwise
[es@localhost local]$ sudo chown -R es:elasticsearch elasticsearch-5.5.2
ElasticSearch Configuration
elasticsearch.yml 修改
[es @ localhost elasticsearch-6.3.2] $ vim config / elasticsearch.yml cluster.name: My-the Application node.name: the Node-1 network.host: 0.0.0.0 http.port: 9200 # because Centos6 does not support SecComp, The ES is the default bootstrap.system_call_filter detection to true bootstrap.memory_lock: false bootstrap.system_call_filter: false
Modify /etc/sysctl.conf
Switch back to root user
vim /etc/sysctl.conf
Add content in the final surface file:
vm.max_map_count=262144
Save and exit, use sysctl -p to refresh the effect.
Modify the file /etc/security/limits.conf
vim /etc/security/limits.conf
Add the following:
Hard nofile 65536 soft nofile 65536 soft nproc 2048 hard nproc 4096
Start elasticesearch may also report the following error
max number of threads [1024] for user [lish] likely too low, increase to at least [4096]
Solution: Switch to the root user, enter limits.d directory to modify configuration files.
we /etc/security/limits.d/90-nproc.conf
Modify the following:
soft nproc 1024
#change into
soft nproc 4096
Start elasticsearch
After completing the above configuration changes, the user switch to es, change the directory to perform the installation directory elasticsearch
In the browser, enter localhost: 9200 Verify started successfully, if the browser output following information represents the installation starts successfully
Elasticsearch command in the Linux SH elasticsearch Start , keys ctrl + c when the program will stop off, how to program it started in the background?
Need to use: ./ elasticsearch -d
when executed at this time there will be no authority ./elasticsearch: Permission denied
authorization is required to perform the command: chmod + x bin / elasticsearch
executed again ./elasticsearch -d to start
using ps aux | grep elasticsearch see if you can start
If an exception message appears during startup, according to the message Baidu related issues, the following is the error message encountered during startup along with my solutions
Exception information 1: expecting token of type [START_OBJECT ] but found [VALUE_STRING]]; Cause of error: Internal elasticsearch.yml file error Solution: Carefully check yml file configuration items written format: (space) name :( space) value -------------------------------------------------- ------------------------------- exception information 2: java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed wrong reasons: Centos6 does not support SecComp, while ES default bootstrap.system_call_filter detection to true, resulting in detection failure led directly to the ES can not be started after the failure solution: modify elasticsearch.yml add about content: bootstrap.memory_lock : false bootstrap.system_call_filter: false ------------------------------------------- -------------------------------------- -------------------------------------------------- ------------------------------- exception information 3: BindTransportException [Failed to bind to [9300-9400] solution to open the configuration file elasticsearch.yml will network.host: 192.168.0.1 0.0.0.0 modify native IP ------------------------------ -------------------------------------------------- ------------ exception information 4: max number of threads [1024 ] for user [lish] likely too low, increase to at least [2048] solution: switch to root into limits. modify the configuration file d directory. vi /etc/security/limits.d/90-nproc.conf modify the following: * Soft nproc 1024 # amended as * soft nproc 2048