The actual installation of the ES chapter ELK6.6.1

First, the environment and precautions

jdk: (build 1.8.0_151-b12)

elasticsearch:6.6.1

CentOS 7

Attention to the problem: jdk version 1.8 must not be too low

root user can not start es, must create a new user

Download extract

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.1.zip
unzip elasticsearch-6.6.1.zip

 

1.1 Create a new user

If you start with a root, there will be "java.lang.RuntimeException: can not runelasticsearch as root" error, as shown below:

We need to create a new user to run es

1.1.1. Create a new user
adduser [用户名]
1.1.2. Modify the new user's password
passwd [用户名]
1.1.3. Authorization sudo

The newly created user does not use the sudo command, you need to add to his authorization.

  1. Add sudoers file writable
chmod -v u+w /etc/sudoers
  1. Modify sudoers file
vim /etc/sudoers
  1. Found in the following location sudoers file and add the following
    [username] ALL = (ALL) ALL (do not lose the password For new users to use sudo, the last read ALL NOPASSWD: ALL you can)

  1. Recover sudoers file writable
chmod -v u-w /etc/sudoers
copy
1.1.4. Elasticsearch folder permissions assigned to new users

Change the folder and all subfolders (folder) belongs users and user groups

chown -R kebi:kebi elasticsearch-6.6.1

 

二、常见问题

2.1JVM virtual machine out of memory

Error: "JavaHotSpot (TM) 64-Bit Server VM warning: INFO: error = 'Cannotallocate memory' (errno = 12)" indicates insufficient memory, configured to jvm.options the config file directory defaults to 2g, can be modified to 1g.

2.2 max_map_count too small

Error "max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]", max_map_count file contains a number of restrictions process can have VMA (virtual memory area), the system default is 65530, modified to 655360.

# In / etc / the sysctl.conf file add the line 
vm.max_map_count = 655360 
# and execute the command 
sysctl -p

 

2.3 max file descriptors过小

Error "max file descriptors [65535] for elasticsearchprocess is too low, increase to at least [65536]", maxfile descriptors for the maximum file descriptor, is set to greater than 65536.

  • The solution is to modify the file /etc/security/limits.conf

After modify to the next source / etc / profile

ulimit -Hn
ulimit -Sn

2.3.2 max number of threads [3818] for user [es] is too low, increase to at least [4096]

  The problem above, the maximum number of threads is too low. Modify the configuration file /etc/security/limits.conf, increase the allocation

*               soft    nproc           4096
*               hard    nproc           4096

View command

Ulimit - Hu 
Ulimit -su

 

Then exit the user to log in, otherwise invalid

 

 

2.4 Starting error

OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N

Modify the parameters jvm.options inside the config directory, some packages start when enabled by default -XX: + AssumeMP lead

 

2.5 external network access settings

Elasticsearch.yml modify files in the config directory

  1. To modify network.host0.0.0.0
  2. To modify discovery.zen.ping.unicast.hosts["0.0.0.0"]

 

Rom 2.6 elasticsearch-head plug

Under modify config directory elasticsearch.yml file, add the following in the last two parameters

http.cors.enabled: true
http.cors.allow-origin: "*"

 

2.7 elasticsearch线程队列不够

修改config目录下elasticsearch.yml文件,在最后新增以下参数

thread_pool.bulk.queue_size: 1000

 

三、启动

3.1 切换新用户

su kebi

3.2 后台运行

进入目录下

bin/elasticsearch -d

 

Guess you like

Origin www.cnblogs.com/lyon91/p/11220312.html