Elasticsearch安装配置问题

1、配置服务 ip 和 端口

进入 elasticsearch 安装目录,打开 config/elasticsearch.yml 配置 net.host 和 http.port

 

net.host: 0.0.0.0

http.port: 9200

 kibana 外网访问设置:

# vi kibana-7.3.0-linux-x86_64/config/kibana.yml

server.host: "0.0.0.0"

2、坑

(1)用户
Linux 下不要使用 root 用户运行 Elasticsearch, 否则会报异常 can not run elasticsearch as root

(2)引导检查

如果你是使用 .zip 或 .tar.gz 安装包,有些配置需要手工配置,否则将导致启动失败,如:

ERROR: [3] bootstrap checks failed
[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

在 Elasticsearch 以前的版本中,其中的一些配置错误被记录为警告信息。可以理解的是,用户有时会忽略这些日志消息。为了确保这些设置受到应有的重视,Elasticsearch在启动之前会做一些检查 Bootstrap Checks | Elasticsearch Reference [7.0] | Elastic。这些 启动检查 Important Elasticsearch configuration | Elasticsearch Reference [7.0] | Elastic 会检测 Elasticsearch 和系统的各种设置,并比较与那些为值是否是 Elasticsearch 的操作安全值。如果 Elasticsearch 处于开发模式,任何启动检失败被记录为 Elasticsearch 警告日志。如果 Elasticsearch 是在生产模式下,任何启动检查失败会导致 Elasticsearch 拒绝启动。

要解决以上问题,需进行如下配置:

  • 文件描述符配置
    • 临时生效
      • 使用 root 用户
      • 运行 ulimit -n 65536
    • 永久生效
      • 使用 root 用户
      • 进入 /etc/security/limits.conf
      • 添加一行 user - nofile 65536
  • 虚拟内存配置
    • 临时生效
      • 使用 root 用户
      • 运行 sysctl -w vm.max_map_count=262144
    • 永久生效
      • 使用 root 用户
      • 进入 /etc/sysctl.conf
      • 添加或更新一行 vm.max_map_count=262144
  • 自动发现配置
    • 单节点
    • 进入 elasticsearch 安装目录,打开 config/elasticsearch.yml
    • 添加或更新一行 discovery.type: single-node

 3、JVM内存大小指定太大,但本机内存不够用(主要还是没钱):

[root@file elasticsearch-7.1.1]# ./bin/elasticsearch
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory' (errno
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid27766.log

解决:

# 修改jvm.options文件配置即可,从1g改成了100m

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms100m
-Xmx100m

 

转载于:https://www.cnblogs.com/liugp/p/11381193.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值