Elasticsearch不删原有jdk8导致的系列安装和启动问题

以前在空机器直接装elasticsearch,没有遇到什么问题。今天在现有JDK上安装,遇到的问题记录一下:

1. JDK的环境变量配置与我原有的不一致报如下错误: 

[estest@ZK-DES-I root]$ /usr/elasticsearch/bin/elasticsearch
could not find java in JAVA_HOME or bundled at /usr/java/jdk1.8.0_102//bin/java

root用户下的是:

而estest用户下是:

解决方式:修改estest用户下的java_home:

[estest@ZK-DES-I root]$ export JAVA_HOME=/usr/java/jdk1.8.0_241-amd64
[estest@ZK-DES-I root]$ echo $JAVA_HOME
/usr/java/jdk1.8.0_241-amd64

 2. JDK版本匹配问题,报如下错误:

[estest@ZK-DES-I root]$ /usr/elasticsearch/bin/elasticsearch
future versions of Elasticsearch will require Java 11; your Java version from [/usr/java/jdk1.8.0_241-amd64/jre] does not meet this requirement
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /usr/elasticsearch/config/elasticsearch.keystore
Likely root cause: java.nio.file.AccessDeniedException: /usr/elasticsearch/config/elasticsearch.keystore
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:361)
    at java.nio.file.Files.newByteChannel(Files.java:407)
    at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:77)
    at org.elasticsearch.common.settings.KeyStoreWrapper.load(KeyStoreWrapper.java:218)
    at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:234)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:305)
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
    at org.elasticsearch.cli.Command.main(Command.java:90)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Refer to the log for complete error details.
 

 解决方式:

屏蔽vi /usr/elasticsearch/bin/elasticsearch-env部分代码,使用自带的JDK;

 3. jvm内存模型问题,9删掉UseConcMarkSweepGCre这个jvm参数,所以需要修改对应的参数。

并且,还存在文件的权限问题。

[estest@ZK-DES-I root]$ /usr/elasticsearch/bin/elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /usr/elasticsearch/config/elasticsearch.keystore
Likely root cause: java.nio.file.AccessDeniedException: /usr/elasticsearch/config/elasticsearch.keystore
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:373)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:424)
    at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:77)
    at org.elasticsearch.common.settings.KeyStoreWrapper.load(KeyStoreWrapper.java:218)
    at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:234)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:305)
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
    at org.elasticsearch.cli.Command.main(Command.java:90)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Refer to the log for complete error details.
 

 解决方式:

(1)修改GC:/usr/elasticsearch/config/jvm.options

(2)文件的权限问题:删除该文件,下次启动es时会自动创建。

rm -rf elasticsearch.keystore

结束:

[estest@ZK-DES-I config]$ /usr/elasticsearch/bin/elasticsearch
[2024-05-21T11:46:15,369][INFO ][o.e.e.NodeEnvironment    ] [node-1] using [1] data paths, mounts [[/ (/dev/mapper/zkos-root)]], net usable_space [193gb], net total_space [216gb], types [xfs]
[2024-05-21T11:46:15,374][INFO ][o.e.e.NodeEnvironment    ] [node-1] heap size [1gb], compressed ordinary object pointers [true]
[2024-05-21T11:46:15,377][INFO ][o.e.n.Node               ] [node-1] node name [node-1], node ID [Cep1Bsm0QQi_4UqlWY5gow], cluster name [elasticsearch]
[2024-05-21T11:46:15,379][INFO ][o.e.n.Node               ] [node-1] version[7.3.0], pid[10736], build[default/tar/de777fa/2019-07-24T18:30:11.767338Z], OS[Linux/3.10.0-1160.31.1.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/12.0.1/12.0.1+12]
[2024-05-21T11:46:15,380][INFO ][o.e.n.Node               ] [node-1] JVM home [/usr/elasticsearch/jdk]
[2024-05-21T11:46:15,381][INFO ][o.e.n.Node               ] [node-1] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseG1GC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-5306095514978348496, -XX:+HeapDumpOnOutOfMemoryError, -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, -Djava.locale.providers=COMPAT, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/usr/elasticsearch, -Des.path.conf=/usr/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
[2024-05-21T11:46:16,981][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [aggs-matrix-stats]
[2024-05-21T11:46:16,981][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [analysis-common]
[2024-05-21T11:46:16,981][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [data-frame]
[2024-05-21T11:46:16,982][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [flattened]
[2024-05-21T11:46:16,982][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-common]
[2024-05-21T11:46:16,982][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-geoip]
[2024-05-21T11:46:16,983][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-user-agent]
[2024-05-21T11:46:16,983][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-expression]
[2024-05-21T11:46:16,983][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-mustache]
[2024-05-21T11:46:16,983][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-painless]
[2024-05-21T11:46:16,984][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [mapper-extras]
[2024-05-21T11:46:16,984][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [parent-join]
[2024-05-21T11:46:16,984][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [percolator]
[2024-05-21T11:46:16,985][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [rank-eval]
[2024-05-21T11:46:16,985][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [reindex]
[2024-05-21T11:46:16,985][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [repository-url]
[2024-05-21T11:46:16,985][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty4]
[2024-05-21T11:46:16,986][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [vectors]
[2024-05-21T11:46:16,986][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-ccr]
[2024-05-21T11:46:16,986][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-core]
[2024-05-21T11:46:16,987][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-deprecation]
[2024-05-21T11:46:16,987][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-graph]
[2024-05-21T11:46:16,987][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-ilm]
[2024-05-21T11:46:16,988][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-logstash]
[2024-05-21T11:46:16,988][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-ml]
[2024-05-21T11:46:16,988][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-monitoring]
[2024-05-21T11:46:16,989][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-rollup]
[2024-05-21T11:46:16,989][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-security]
[2024-05-21T11:46:16,989][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-sql]
[2024-05-21T11:46:16,989][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-voting-only-node]
[2024-05-21T11:46:16,990][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [x-pack-watcher]
[2024-05-21T11:46:16,990][INFO ][o.e.p.PluginsService     ] [node-1] no plugins loaded
[2024-05-21T11:46:20,434][INFO ][o.e.x.s.a.s.FileRolesStore] [node-1] parsed [0] roles from file [/usr/elasticsearch/config/roles.yml]
[2024-05-21T11:46:20,982][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [node-1] [controller/10843] [Main.cc@110] controller (64 bit): Version 7.3.0 (Build ff2f774f78ce63) Copyright (c) 2019 Elasticsearch BV
[2024-05-21T11:46:21,349][DEBUG][o.e.a.ActionModule       ] [node-1] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2024-05-21T11:46:21,671][INFO ][o.e.d.DiscoveryModule    ] [node-1] using discovery type [zen] and seed hosts providers [settings]
[2024-05-21T11:46:22,410][INFO ][o.e.n.Node               ] [node-1] initialized
[2024-05-21T11:46:22,411][INFO ][o.e.n.Node               ] [node-1] starting ...
[2024-05-21T11:46:22,522][INFO ][o.e.t.TransportService   ] [node-1] publish_address {192.168.0.146:9300}, bound_addresses {192.168.0.146:9300}
[2024-05-21T11:46:22,528][INFO ][o.e.b.BootstrapChecks    ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2024-05-21T11:46:22,546][INFO ][o.e.c.c.Coordinator      ] [node-1] cluster UUID [Z2yUq7JMRumorsrrAxll7g]
[2024-05-21T11:46:22,673][INFO ][o.e.c.s.MasterService    ] [node-1] elected-as-master ([1] nodes joined)[{node-1}{Cep1Bsm0QQi_4UqlWY5gow}{9EWeByLlROKIeCa4z-KSUQ}{192.168.0.146}{192.168.0.146:9300}{dim}{ml.machine_memory=8124235776, xpack.installed=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 3, version: 19, reason: master node changed {previous [], current [{node-1}{Cep1Bsm0QQi_4UqlWY5gow}{9EWeByLlROKIeCa4z-KSUQ}{192.168.0.146}{192.168.0.146:9300}{dim}{ml.machine_memory=8124235776, xpack.installed=true, ml.max_open_jobs=20}]}
[2024-05-21T11:46:22,731][INFO ][o.e.c.s.ClusterApplierService] [node-1] master node changed {previous [], current [{node-1}{Cep1Bsm0QQi_4UqlWY5gow}{9EWeByLlROKIeCa4z-KSUQ}{192.168.0.146}{192.168.0.146:9300}{dim}{ml.machine_memory=8124235776, xpack.installed=true, ml.max_open_jobs=20}]}, term: 3, version: 19, reason: Publication{term=3, version=19}
[2024-05-21T11:46:22,790][INFO ][o.e.h.AbstractHttpServerTransport] [node-1] publish_address {192.168.0.146:9200}, bound_addresses {192.168.0.146:9200}
[2024-05-21T11:46:22,791][INFO ][o.e.n.Node               ] [node-1] started
[2024-05-21T11:46:22,957][INFO ][o.e.l.LicenseService     ] [node-1] license [726fb8e9-c347-4ab8-9a07-e130870d53b7] mode [basic] - valid
[2024-05-21T11:46:22,958][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [node-1] Active license is now [BASIC]; Security is disabled
[2024-05-21T11:46:22,967][INFO ][o.e.g.GatewayService     ] [node-1] recovered [0] indices into cluster_state

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值