报错信息

es@MEPRDAPP01:/root/opt/elastic/elasticsearch-8.1.2> java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
es@MEPRDAPP01:/root/opt/elastic/elasticsearch-8.1.2> sh start.sh
could not find java in ES_JAVA_HOME at /root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java
es@MEPRDAPP01:/root/opt/elastic/elasticsearch-8.1.2> 

从上文中可以看到,全局的java是存在且版本号大于1.8的,并且当前用户非root用户
查看报错的原因:打开elasticsearch elasticsearch-env查看错误原因

可以看到该错误是文件不可执行时才报错,那么我们看下他是调用了ES_HOME的jdk,看下该目录下文件是否可执行

查看ES目录下的jdk是否可执行

es@MEPRDAPP01:/root/opt/elastic/elasticsearch-8.1.2> sh start.sh
could not find java in bundled JDK at /root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java
es@MEPRDAPP01:/root/opt/elastic/elasticsearch-8.1.2> .//root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java -version
bash: .//root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java: 没有那个文件或目录
es@MEPRDAPP01:/root/opt/elastic/elasticsearch-8.1.2> ./root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java -version
bash: ./root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java: 没有那个文件或目录
es@MEPRDAPP01:/root/opt/elastic/elasticsearch-8.1.2> cd /root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java
bash: cd: /root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java: 权限不够

由于root目录是root用户的,不能将root目录的用户和用户组设置为es,因此我们在根目录从新新建一个目录/es,将文件全部移动到/es下

MEPRDAPP01:~/opt # cd  /
MEPRDAPP01:/ # mkdir es
MEPRDAPP01:/ # mv /root/opt/ /es
MEPRDAPP01:/ # chown -R es:es /es
MEPRDAPP01:/ # ll
总用量 80
drwxr-xr-x   2 root root  4096 9月  26 2019 bin
drwxr-xr-x   3 root root  4096 9月  26 2019 boot
drwx------   2 root root   151 9月  26 2019 Desktop
drwxr-xr-x  21 root root  3980 4月   7 22:22 dev
drwxr-xr-x   3 es   es      17 4月  14 13:42 es
drwxr-xr-x 127 root root 12288 4月  14 12:22 etc
drwxr-xr-x   5 root root    49 4月  14 10:40 home

再次执行

es@MEPRDAPP01:/es/opt/elastic/elasticsearch-8.1.2> sh start.sh

查看报文还有报错 错误1

ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
ERROR: Elasticsearch did not exit normally - check the logs at /es/opt/elastic/logs/elasticsearch.log

修改Elastic的配置文件elasticsearch.yml文件

vim /es/opt/elastic/elasticsearch-8.1.2/config/elasticsearch.yml

添加该配置

node.name: node-1

错误2

  • 编辑配置文件limits.conf
MEPRDAPP01:~ # vim /etc/security/limits.conf

添加如下配置

es hard nofile 65536
es soft nofile 65536
  • 编辑配置文件 sysctl.conf
MEPRDAPP01:~ # vim /etc/sysctl.conf

添加如下配置

vm.max_map_count=655360

查看是否更改

sysctl -p

再次启动

注销调用户es重新登录,再次启动es

MEPRDAPP01:/es/opt/elastic/elasticsearch-8.1.2 # su es
es@MEPRDAPP01:/es/opt/elastic/elasticsearch-8.1.2> sh start.sh
warning: ignoring JAVA_HOME=/usr/local/java; using bundled JDK
warning: ignoring JAVA_HOME=/usr/local/java; using bundled JDK
warning: ignoring JAVA_HOME=/usr/local/java; using bundled JDK
[2022-04-14T14:23:36,960][INFO ][o.e.n.Node               ] [node-1] version[8.1.2], pid[169299], build[default/tar/31df9689e80bad366ac20176aa7f2371ea5eb4c1/2022-03-29T21:18:59.991429448Z], OS[Linux/4.12.14-94.41-default/amd64], JVM[Eclipse Adoptium/OpenJDK 64-Bit Server VM/17.0.2/17.0.2+8]
[2022-04-14T14:23:36,967][INFO ][o.e.n.Node               ] [node-1] JVM home [/es/opt/elastic/elasticsearch-8.1.2/jdk], using bundled JDK [true]
[2022-04-14T14:23:36,967][INFO ][o.e.n.Node               ] [node-1] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-3763503562971088099, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Xms31744m, -Xmx31744m, -XX:MaxDirectMemorySize=16642998272, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=25, -Des.path.home=/es/opt/elastic/elasticsearch-8.1.2, -Des.path.conf=/es/opt/elastic/elasticsearch-8.1.2/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
[2022-04-14T14:23:39,443][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [aggs-matrix-stats]
[2022-04-14T14:23:39,443][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [analysis-common]
[2022-04-14T14:23:39,444][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [constant-keyword]
[2022-04-14T14:23:39,444][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [data-streams]
[2022-04-14T14:23:39,444][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [frozen-indices]
[2022-04-14T14:23:39,444][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-common]
[2022-04-14T14:23:39,444][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-geoip]
[2022-04-14T14:23:39,445][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-user-agent]
....

修改启动脚本内容为后台启动

MEPRDAPP01:/es/opt/elastic/elasticsearch-8.1.2 # vim start.sh
./bin/elasticsearch -d

其它

  1. 启动后估计四五分钟开始打印的日志出现拒绝连接的情况
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [[::1]:9305], node [null], requesting [false] discovery result: [][[::1]:9305] connect_exception: 拒绝连接: /[0:0:0:0:0:0:0:1]:9305: 拒绝连接
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [[::1]:9303], node [null], requesting [false] discovery result: [][[::1]:9303] connect_exception: 拒绝连接: /[0:0:0:0:0:0:0:1]:9303: 拒绝连接
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [127.0.0.1:9302], node [null], requesting [false] discovery result: [][127.0.0.1:9302] connect_exception: 拒绝连接: /127.0.0.1:9302: 拒绝连接
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [[::1]:9301], node [null], requesting [false] discovery result: [][[::1]:9301] connect_exception: 拒绝连接: /[0:0:0:0:0:0:0:1]:9301: 拒绝连接
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [127.0.0.1:9304], node [null], requesting [false] discovery result: [][127.0.0.1:9304] connect_exception: 拒绝连接: /127.0.0.1:9304: 拒绝连接
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [127.0.0.1:9301], node [null], requesting [false] discovery result: [][127.0.0.1:9301] connect_exception: 拒绝连接: /127.0.0.1:9301: 拒绝连接
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [127.0.0.1:9303], node [null], requesting [false] discovery result: [][127.0.0.1:9303] connect_exception: 拒绝连接: /127.0.0.1:9303: 拒绝连接
[2022-04-14T14:28:12,711][WARN ][o.e.d.PeerFinder         ] [node-1] address [12

修改Elastic的配置文件elasticsearch.yml文件后所有配置如下

cluster.name: my-application
node.name: node-1
path.data: /es/opt/elastic/data
path.logs: /es/opt/elastic/logs
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["127.0.0.1"]
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:enabled: truekeystore.path: certs/http.p12
xpack.security.transport.ssl:enabled: trueverification_mode: certificatekeystore.path: certs/transport.p12truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["MEPRDAPP01"]
  1. 修改启动内存 [由于网上很多配置都是基于系统变量配置的,我们这里是用ES_HOME的java启动的,所有直接设置jvm配置]
vim /es/opt/elastic/elasticsearch-8.1.2/config/jvm.options

清除注释

## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## which should be named with .options suffix, and the min and
## max should be set to the same value. For example, to set the
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
-Xms10g
-Xmx10g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/8.1/heap-size.html
## for more information

could not find java in ES_JAVA_HOME at /root/opt/elastic/elasticsearch-8.1.2/jdk/bin/java相关推荐

  1. ES安装启动及could not find java in bundled jdk at /opt/elasticsearch/elasticsearch-7.9.1/jdk/bin/java报错

    1.首先去es的官网下载ES 然后将下载后的包上传到linux环境指定的目录下面 进行解压 解压命令为:sudo tar -zxvf elasticsearch-7.9.1-linux-aarch64 ...

  2. es启动报错:could not find java in JAVA_HOME at /elk/es/elasticsearch-7.11.1/jdk/bin/java

    es启动报错 错误排查 检查java环境变量是否配置 es启动要使用非root账户 es账户是否授权 如图:我的es账户未授权 通过执行命令解决: chown -R elk:elk /elk/* do ...

  3. Centos7 JDK安装过程中 解决java -version 报错: bash: /home/jdk1.8.0_161/bin/java: Permission denied...

    1.执行Linux命令 -----vim /etc/profile  编辑profile  文件,在里面添加: #set java enviroment JAVA_HOME=/opt/JavaHome ...

  4. AidLearning安装Oracle JDK让Java Swing程序在华为MatePadPro平板上跑起来

    AidLearning安装Oracle JDK让Java Swing程序在华为MatePadPro平板上跑起来 cemike@126.com 入手华为MatePadPro平板以后就有把windows台 ...

  5. bash: /usr/lib/jvm/jdk1.7.0_80/bin/java: No such file or directory 问题

    在安装java的时候,经常会遇到一些奇奇怪怪的问题. 在配置好环境变量之后,执行java -version,出现: bash: /usr/lib/jvm/jdk1.7.0_80/bin/java: N ...

  6. java开发工具包 jdk_什么是JDK? Java开发工具包简介

    java开发工具包 jdk Java开发工具包(JDK)与JVM(Java虚拟机)和JRE(Java运行时环境)一起是Java编程中使用的三个核心技术软件包之一. 重要的是要区分这三种技术,并了解它们 ...

  7. azkaban 与 java任务_azkaban任务报错java.lang.RuntimeException: The root scratch dir: /tmp/hive...

    azkaban运行任务的时候失败报错如下: 23-03-2016 08:16:14 CST analyzer-kafka2hdfs_new ERROR - Exception in thread &q ...

  8. 处理/root/jdk8/jdk1.8.0_241/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or di错误

    今天在华为云服务器上(CentOs 7)安装jdk8的时候出现了一个问题:-bash: /root/jdk8/jdk1.8.0_241/bin/java: /lib/ld-linux.so.2: ba ...

  9. 解决IEDA编译java项目出现 library root ,编译缺少 rt.jar jce.jar

    解决IEDA编译java项目出现 library root ,编译缺少 rt.jar jce.jar 问题 编译项目时,提示找不到rt.jar,编译添加后,出现缺少jce.jar,maven依赖项显示 ...

最新文章

  1. DreamWeaver文件保存时,提示发生共享违例问题的解决方法
  2. 带缓冲的I/O操作和不带缓冲的I/O操作
  3. Java里的稀疏矩阵Sparse Array
  4. 杭电acm2151题java的解法,杭电ACM题型分类
  5. 奇特的恐怖之门:谈周德东的恐怖小说《门》
  6. ios两个app之间传值和跳转实现(转发)
  7. 域用户登录方法在计算机上不被允许,如何解决不能交互式登录的问题
  8. 国内外云服务器运维面板有哪些?运维面板全面汇总
  9. 利用matlab函数创建数组
  10. 通俗易懂的UART协议帧格式
  11. java折线图_如何用java 画折线图
  12. 西瓜书笔记--第三章 线性模型
  13. 个人设计和公司设计,哪个更适合你?
  14. 歌手大奖赛(C语言)
  15. 网易云音乐热评的规律,44万条数据告诉你
  16. Lucene关键字高亮显示
  17. 计算机中多媒体数据如何表示,多媒体数据的表示方法说明.ppt
  18. linux 初始化文件失败,linux(十)之初始化文件
  19. Excel - 学习 - 笔记6: Excel 函数 - filter 函数
  20. C#语言和SQL Server 数据库技术_用表组织数据

热门文章

  1. 贝叶斯系列:(三)贝叶斯网络
  2. React Native 入门实战视频教程(36 个视频)
  3. JDK14打包工具jpackage的使用
  4. 基本从零开始的网页脚本编写学习
  5. Java初学之人机猜拳游戏
  6. VRRPv2和VRRPv3对比区别
  7. 【网站】IIS配置/搭建PHP环境的网站教程
  8. android扫雷需求分析,Android扫雷游戏实现
  9. asp.net gridview ItemTemplate 获得 一行 数据
  10. 海量向量搜索引擎 Milvus 开源啦