Elasticsearch踩坑日记

场景

ubuntu环境下使用apt-get install elasticsearch安装es,一路掉坑,做个简单记录,避免再次踩坑。systemctl start elasticsearch 方式启动,通过 journalctl -xe 和 查看 elasticsearch日志进行排错。当前的elasticserch版本是8.6,日志默认位置在/var/log/elasticsearch/elasticsearch.log.优先使用es官网搜索答案,其次参考网络其他答案。

1. node.master 和 node.data 无法识别

elasticsearch unknown setting [node.master] please check that any required plugins are installed
...
elasticsearch unknown setting [node.data] please check that any required plugins are installed
解决方案
#/etc/elasticsearch/elasticsearch.yml

#删除node.master和node.data,改为 node.roles
#node.master:true
#node.data:true
node.roles: [ master,data]

2. tmp目录没有权限

JNA temporary directory ‘/tmp’ is not writable

解决方案

# /usr/share/elasticsearch下创建目录tmp /etc/profile追加
export ES_TMPDIR=/usr/share/elasticsearch/tmp
export ES_JAVA_OPTS="-Djna.tmpdir=/usr/share/elasticsearch/tmp"

3. --enable-preview错误

To make full use of MMapDirectory, please pass '--enable-preview' to the Java command line

解决方案

#/etc/elasticsearch/jvm.options.d 目录下创建 jvm.options
-Djava.io.tmpdir=/usr/share/elasticsearch/tmp
-Djna.tmpdir=/usr/share/elasticsearch/tmp
--enable-preview
-Xms256m
-Xmx256m
-Des.enforce.bootstrap.checks=true

4. jvm.options中的Xms和Xmx保持一致,不然会报下面的错误

initial heap size [268435456] not equal to maximum heap size [1933574144]; this can cause resize pauses
5. timeout错误
elasticsearch.service: Failed with result 'timeout'.
解决方案
#/usr/lib/systemd/system/elasticsearch.service

##原始值75,调大一点
TimeoutStartSec=500

6. cluster.initial_master_nodes 错误

this node is locked into cluster UUID [LkG38jKHQu2JwB2wE-Wnbw] but [cluster.initial_master_nodes] is set to [lawrence-Lenovo-B4450s]; remove this setting to avoid possible data loss caused by subsequent cluster bootstrap attempts

解决方案
#/etc/elasticsearch/elasticsearch.yml 约115行注释掉 cluster.initial_master_nodes

#cluster.initial_master_nodes: ["lawrence-Lenovo-B4450s"]
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

107.2M

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值