could not find java in bundled JDK at /tmp/elasticsearch-7.15.2/jdk/bin/java

踩坑记录

chown -R es:es /tmp/elasticsearch-7.15.2
chown -R /tmp/elasticsearch-7.15.2/bin/elasticsearch
chown -R  es:es /tmp/elasticsearch-7.15.2/bin/elasticsearch


下载安装包,解压
来到解压目录的bin目录,直接./elasticsearch启动
如果是root,会提示不能用root启动,切个用户来启动,正常情况,你可以通过localhost:9200来访问了
but,如果你想通过网络来访问,你一定是要ip+port来访问的,这时就访问不到了,要改下配置
conf/elasticsearch.yml
找到network.host: xxx.xxx.xxx.xxx,把ip配进来,保存退出

这时再运行bin/elasticsearch,系统会报下面三个错

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
ERROR: Elasticsearch did not exit normally - check the logs at /opt/elasticsearch-7.8.1/logs/elasticsearch.log

1、可创建文件描述的数量太低,至少需要65536
有多种改法,有临时的,有永久的,不废话,直接改配置文件重启,永久生效
vim /etc/security/limits.conf
文件最后加上
* soft nofile 65536
* hard nofile 65536

其中*表示所有用户  nofile表示最大文件句柄数,表示能够打开的最大文件数目
保存退出,reboot

2、vm.max_map_count太小
vim /etc/sysctl.conf
增加
vm.max_map_count=262144
保存退出
sysctl -p

3、默认的discovery settings不适用于生产环境
这个还是要改conf/elasticsearch.yml
a)找到node.name: node-1,把注释放开
b)找到discovery.seed_hosts: ["host1","host2"],去掉注释,内容换成discovery.seed_hosts: ["你的ip"]
c)找到cluster.initial_master_nodes: ["node-1", "node-2"],放开注释,改成cluster.initial_master_nodes: ["node-1"],node-1对应的就a步骤的name

保存退出,再次调用bin/elasticsearch,启动成功
————————————————
版权声明:本文为CSDN博主「lzfxpuugv」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lzfxpuugv/article/details/108006001