時間來到了2023年4月,今天和大家一起研究下在虛擬機安裝Elasticsearch 8.7.0單節(jié)點。
首先,就是一個很熟悉的報錯
# ./elasticsearch
[2023-04-07T11:53:16,972][ERROR][o.e.b.Elasticsearch ] [vm-fsdh23re9ff] fatal exception while booting Elasticsearchjava.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.server@8.7.0/org.elasticsearch.bootstrap.Elasticsearch.initializeNatives(Elasticsearch.java:262)
at org.elasticsearch.server@8.7.0/org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:161)
at org.elasticsearch.server@8.7.0/org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:66)
See logs for more details.
ERROR: Elasticsearch did not exit normally - check the logs at /app/elasticsearch-8.7.0/logs/elasticsearch.log
ERROR: Elasticsearch exited unexpectedly
嗯,許久不碰es了,忘了不能使用root用戶運行了。趕緊創(chuàng)建一個普通用戶……
# groupadd app
# useradd -d /app -g app app
# chown -R app:app /app
關(guān)于elasticsearch.yml的配置,8.7.0版本默認(rèn)啟用了xpack.security認(rèn)證。
-bash-4.2$ grep -v "#" elasticsearch.yml
cluster.name: mycluster
node.name: node-1
path.data: /app/elasticsearch-8.7.0/data
path.logs: /app/elasticsearch-8.7.0/logs
bootstrap.memory_lock: false
network.host: 192.168.223.199
http.port: 9200
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["vm-fsdh23re9ff"]
http.host: 0.0.0.0
再次啟動,又出現(xiàn)兩個報錯:1)文件句柄數(shù)設(shè)置太??;2)最大虛擬內(nèi)存設(shè)置太小。
[2023-04-07T14:25:36,912][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2023-04-07T14:25:36,930][ERROR][o.e.b.Elasticsearch ] [node-1] node validation exception
[2] bootstrap checks failed. You must address the points described in the following [2] lines before starting Elasticsearch.
bootstrap check failure [1] of [2]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
bootstrap check failure [2] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2023-04-07T14:25:36,934][INFO ][o.e.n.Node ] [node-1] stopping ...
[2023-04-07T14:25:36,968][INFO ][o.e.n.Node ] [node-1] stopped
[2023-04-07T14:25:36,969][INFO ][o.e.n.Node ] [node-1] closing ...
[2023-04-07T14:25:36,986][INFO ][o.e.n.Node ] [node-1] closed
[2023-04-07T14:25:36,991][INFO ][o.e.x.m.p.NativeController] [node-1] Native controller process has stopped - no new native processes can be started
修改系統(tǒng)最大文件句柄數(shù)(修改后需要重啟系統(tǒng)才能生效)
# vi /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
# vi /etc/security/limits.d/20-nproc.conf
* soft nproc 65535
root soft nproc 65535
# reboot
# ulimit -n
65535
修改最大虛擬內(nèi)存
# vi /etc/sysctl.conf
vm.max_map_count=655360
使用后臺方式啟動
$ cd /app/elasticsearch-8.7.0/bin
$ ./elasticsearch -d
啟動后,使用瀏覽器測試訪問,彈出登陸框,查詢了下,原來需要重置elastic用戶密碼
$ cd /app/elasticsearch-8.7.0/bin
$ ./elasticsearch-reset-password --username elastic
This tool will reset the password of the [elastic] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]y
Password for the [elastic] user successfully reset.
New value: WRRr6nNEYm423uBPzIzW
登錄成功文章來源:http://www.zghlxwxcb.cn/news/detail-505458.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-505458.html
到了這里,關(guān)于【ELK】Elasticsearch 8.7單節(jié)點配置、安裝和運行的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!