ERROR: [2] bootstrap checks failed.You must address the points described in the following [2] lines before starting Elasticsearch.
bootstrap checks failed [1] of [2]: memory locking requested for elasticsearch process but memory is not locked
bootstrap checks failed [1] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /a/es/logs/cluster.log
系统:centos7.6 (vm虚拟机)
软件:java-1.8、elasticsearch-5.6.16-1.noarch
错误信息:
[2019-11-21T00:29:51,557][ERROR][o.e.b.Bootstrap ] [elk-1] node validation exception
[1] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
解决方法一(关闭bootstrap.memory_lock:,会影响性能):
vim /etc/elasticsearch/elasticsearch.yml // 设置成false就正常运行了。
bootstrap.memory_lock: false
解决方法二(开启bootstrap.memory_lock:):
- 修改文件/etc/elasticsearch/elasticsearch.yml,上面那个报错就是开启后产生的,如果开启还要修改其它系统配置文件
bootstrap.memory_lock: true
- 修改文件/etc/security/limits.conf,最后添加以下内容。
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 32000
* hard nproc 32000
* hard memlock unlimited
* soft memlock unlimited
- 修改文件 /etc/systemd/system.conf ,分别修改以下内容。
DefaultLimitNOFILE=65536
DefaultLimitNPROC=32000
DefaultLimitMEMLOCK=infinity
改好后重启下系统。再启动elasticsearch就没报错了 。
es7.13.2启动报错:
bootstrap checks failed [1] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vim /etc/sysctl.conf
vm.max_map_count=262144
sysctl -p
集群配置
cluster.name: clustername
node.name: nodename1
path.data: data
path.logs: logs
network.host: "0.0.0.0"
http.port: 9200
discovery.seed_hosts: ["ip1", "ip2", "ip3"]
cluster.initial_master_nodes: ["ip1", "ip2", "ip3"]
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
#xx代表config目录下的xx目录
xpack.security.transport.ssl.keystore.path: xx/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: xx/elastic-certificates.p12
生成证书步骤
- 使用命令
./elasticsearch-certutil ca
生成名为 elastic-stack-ca.p12 的 CA 文件,密码留空。
- 使用命令
./elasticsearch-certutil cert --ca elastic-stack-ca.p12
为节点颁发证书,生成名为 elastic-certificates.p12 的证书,
过程中直接按 Enter 即可,输出文件包含节点证书、节点密钥和 CA 证书。
es设置密码:
./elasticsearch-setup-passwords interactive
系统启动
/path/to/your/elasticsearch 为es安装目录
[Unit]
Description=Elasticsearch
[Service]
WorkingDirectory=/path/to/your/elasticsearch
Environment=ES_HOME=/path/to/your/elasticsearch
Environment=ES_CONFIG=/path/to/your/elasticsearch/config
Environment=PID_DIR=/var/run/elasticsearch
EnvironmentFile=-/etc/default/elasticsearch
ExecStart=/path/to/your/elasticsearch/bin/elasticsearch
ExecStop=/path/to/your/elasticsearch/bin/elasticsearch-stop
ExecReload=/bin/kill -HUP $MAINPID
User=elasticsearch
Restart=always
[Install]
WantedBy=default.target