释放双眼,带上耳机,听听看~!
es具体启动错误日志如下
root@abcdocker:~# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-11-28 11:37:56 CST; 8s ago
Docs: https://www.elastic.co
Process: 5320 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=78)
Main PID: 5320 (code=exited, status=78)
Nov 28 11:37:43 abcdocker systemd[1]: Starting Elasticsearch...
Nov 28 11:37:43 abcdocker systemd-entrypoint[5320]: Error occurred during initialization of VM
Nov 28 11:37:43 abcdocker systemd-entrypoint[5320]: Initial heap size set to a larger value than the maximum heap size
Nov 28 11:37:55 abcdocker systemd-entrypoint[5320]: ERROR: [1] bootstrap checks failed. You must address the points described in the follow
Nov 28 11:37:55 abcdocker systemd-entrypoint[5320]: bootstrap check failure [1] of [1]: initial heap size [2147483648] not equal to maximum
Nov 28 11:37:55 abcdocker systemd-entrypoint[5320]: ERROR: Elasticsearch did not exit normally - check the logs at /data/elasticsearch/logs
Nov 28 11:37:56 abcdocker systemd[1]: elasticsearch.service: Main process exited, code=exited, status=78/n/a
Nov 28 11:37:56 abcdocker systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Nov 28 11:37:56 abcdocker systemd[1]: Failed to start Elasticsearch.
原因
出现这个的原因是:设置的初始堆大小大于最大堆的值,建议将xms和xmx设置大小一致,或者xmx小于xms
解决方法
修改es启动配置
root@abcdocker:~# vim /usr/lib/systemd/system/elasticsearch.service|grep JAVA
Environment=ES_JAVA_OPTS=-Xms8g -Xmx2g
重启es服务
root@iZ2zeipez8ut08dv6ypru0Z:~# systemctl daemon-reload
root@iZ2zeipez8ut08dv6ypru0Z:~# systemctl restart elasticsearch
服务正常启动
root@abcdocker:~# curl localhost:9200
{
"name" : "node-1",
"cluster_name" : "my-es",
"cluster_uuid" : "NpY5vHfbR0CnRF9EHLYodw",
"version" : {
"number" : "7.15.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "79d65f6e357953a5b3cbcc5e2c7c21073d89aa29",
"build_date" : "2021-09-16T03:05:29.143308416Z",
"build_snapshot" : false,
"lucene_version" : "8.9.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}