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 -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
其它
[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: 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: ["MEPRDAPP01"]
- 修改启动内存 [由于网上很多配置都是基于系统变量配置的,我们这里是用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
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。