首页  

elasticsearch5.0启动检查     所属分类 elasticsearch 浏览量 1553
根据原文翻译整理
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/bootstrap-checks.html



Collectively, we have a lot of experience with users suffering unexpected issues because they have not configured important settings. 
In previous versions of Elasticsearch, 
misconfiguration of some of these settings were logged as warnings. 
Understandably, users sometimes miss these log messages. 
To ensure that these settings receive the attention that they deserve, 
Elasticsearch has bootstrap checks upon startup.

总的来说,有很多用户因没有配置重要的设置,遇到很多意外问题。
在以前的版本中,其中一些设置的错误配置被记录为警告。用户有时会错过这些日志消息。为了确保这些设置得到应有的关注,在启动时进行了引导检查。


These bootstrap checks inspect a variety of Elasticsearch and system settings 
and compare them to values that are safe for the operation of Elasticsearch. 
If Elasticsearch is in development mode, any bootstrap checks that fail appear as warnings in the Elasticsearch log. 
If Elasticsearch is in production mode, any bootstrap checks that fail will cause Elasticsearch to refuse to start.

开发模式,检查失败会记录警告日志,
生产模式,检查失败会拒绝启动

By default, Elasticsearch binds to localhost for HTTP and transport (internal) communication. 

To form a cluster, Elasticsearch instances must be reachable via transport communication so they must bind transport to an external interface.

 in production mode if it does bind transport to an external interface. 
 
 Note that HTTP can be configured independently of transport via http.host and transport.host; 
 this can be useful for configuring a single instance to be reachable via HTTP for testing purposes without triggering production mode.
 

http.host 
transport.host

Heap size check
File descriptor check
Memory lock check
Maximum number of threads check
Maximum size virtual memory check
Maximum map count check
Client JVM check
Use serial collector check
OnError and OnOutOfMemoryError checks


Heap size check
jvm调整堆大小 ,容易引起暂停,最好配置 初始堆大小等于最大堆大小
memory_lock启用后,JVM将在启动时锁定堆的初始大小。如果初始堆大小不等于最大堆大小,那么在调整大小之后,JVM堆不会全部锁定在内存中。

 bootstrap.memory_lock
-Xms2g  -Xmx2g

File descriptor check
everything is a file.
"files" could be a physical file, a virtual file (e.g., /proc/loadavg), or network sockets. 
ES需要打开大量的文件,
every shard is composed of multiple segments and other files, plus connections to other nodes
分片段文件 其他文件   加上到其他节点的连接
 set ulimit -n 65536 as root before starting Elasticsearch, 
 or set nofile to 65536 in /etc/security/limits.conf.
 
查看打开文件数限制
http://127.0.0.1:9200/_nodes/stats/process?filter_path=**.max_file_descriptors

Memory lock check

When the JVM does a major garbage collection it touches every page of the heap. 
If any of those pages are swapped out to disk they will have to be swapped back in to memory. 
当JVM进行一次fullGC 时,会触及堆的每个页面。如果这些页面中的任何一个被交换到磁盘,那么它们将不得不被交换回内存中。
That causes lots of disk thrashing
这会导致大量的磁盘抖动

There are several ways to configure a system to disallow swapping. 
禁用 内存交换
One way is by requesting the JVM to lock the heap in memory through mlockall (Unix) or virtual lock (Windows). 

bootstrap.memory_lock

Elasticsearch is not able to lock the heap ( if the elasticsearch user does not have memlock unlimited).

http://127.0.0.1:9200/_nodes?filter_path=**.mlockall

 
Maximum number of threads check

Elasticsearch executes requests by breaking the request down into stages 
and handing those stages off to different thread pool executors. 
There are different thread pool executors for a variety of tasks within Elasticsearch.
将请求分成几个阶段来执行,并将这些阶段交给不同的线程池执行
各种任务线程池  创建大量的线程
This check is enforced only on Linux.
/etc/security/limits.conf 
nproc


Maximum size virtual memory check

Elasticsearch and Lucene use mmap to great effect to map portions of an index into the Elasticsearch address space. 
This keeps certain index data off the JVM heap but in memory for blazing fast access. 
For this to be effective, the Elasticsearch should have unlimited address space. 
The maximum size virtual memory check enforces that the Elasticsearch process has unlimited address space 
and is enforced only on Linux. To pass the maximum size virtual memory check, 
you must configure your system to allow the Elasticsearch process the ability to have unlimited address space. 
This can be done via /etc/security/limits.conf using the as setting to unlimited

ES和Lucene使用mmap将索引的部分映射到地址空间中,效果非常好。这使某些索引数据远离JVM堆,但保存在内存中,以便进行快速访问。
需要 无限的地址空间
as   address space 

Maximum map count check

to use mmap effectively, ES  also requires the ability to create many memory-mapped areas.
configure vm.max_map_count via sysctl to be at least 262144.

Client JVM check
the client JVM and the server JVM
JVM 客户端和服务端模式
These JVMs use different compilers for producing executable machine code from Java bytecode. 
The client JVM is tuned for startup time and memory footprint while the server JVM is tuned for maximizing performance. 
客户机JVM 针对启动时间和内存占用做了优化,而服务器JVM针对性能优化。

The difference in performance between the two VMs can be substantial. 
这两者之间的性能差异很大

 you must start Elasticsearch with the server VM
 On modern systems and operating systems, the server VM is the default. 
 
ES必须使用server 模式



Use serial collector check
you must not start Elasticsearch with the serial collector 
不能使用串行收集器启动ES  默认使用 CMS收集器。
显示指定 串行收集器 -XX:+UseSerialGC  , 这将无法启动ES


OnError and OnOutOfMemoryError checks

The JVM options OnError and OnOutOfMemoryError enable executing arbitrary commands 
if the JVM encounters a fatal error (OnError) or an OutOfMemoryError (OnOutOfMemoryError).
JVM遇到致命错误(OnError)或OutOfMemoryError (OnOutOfMemoryError),JVM选项OnError和OnOutOfMemoryError允许执行任意命令。

默认情况下,ES系统调用过滤器(seccomp)是启用的
 using OnError or OnOutOfMemoryError and system call filters are incompatible
 不兼容
 防止同时启动这两个特性 
 The OnError and OnOutOfMemoryError checks prevent Elasticsearch from starting 
 if either of these JVM options are used and system call filters are enabled. 
 
 This check is always enforced.

上一篇     下一篇
elasticsearch5.0安装

elasticsearch5.0配置

elasticsearch5.0的重要配置

elasticsearch5.0重要系统配置

elasticsearch5.0API约定

elasticsearch5.0文档索引API