微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Elasticsearch的安装与启动

Elasticsearch的安装与启动

演示目标

在Linux环境中安装并启动Elasticsearch 7.x版本。

安装与启动

  • 下载ES
    https://www.elastic.co/cn/downloads/elasticsearch
  • 在Linux中使用tar -zxvf命令解压
  • 创建ES用户组及ES用户(ES不能使用Root用户运行):
# 增加ES用户组和ES用户
groupadd es
useradd es -g es
passwd es
# 更改ES文件夹所属的用户组及用户
# 例如ES安装目录是 /opt/elasticsearch-7.13.2/
cd /opt
chown -R es:es elasticsearch-7.13.2
# 启动ES
sh /opt/elasticsearch-7.13.2/bin/elasticsearch
  • 访问http://${ip}:9200若出现以下信息则启动成功
{
  "name" : "node1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "JPWsaiXLRluAOJszGOpAsg",
  "version" : {
    "number" : "7.13.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "4d960a0733be83dd2543ca018aa4ddc42e956800",
    "build_date" : "2021-06-10T21:01:55.251515791Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.2",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You KNow, for Search"
}

配置远程服务器访问

# 编辑 ES_HOME/conf/elasticsearch.yml
# 修改 network.host 为 0.0.0.0
network.host: 0.0.0.0
# 修改cluster.initial_master_nodes为当前node
cluster.initial_master_nodes: ["node1"]

启动时异常与解决方法

  • max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
# 修改/etc/security/limits.conf,增加配置,切换用户或重新登录后生效
*               soft    nofile            655350
*               hard    nofile            655350
  • max number of threads [3818] for user [es] is too low, increase to at least [4096]
# 修改/etc/security/limits.conf,增加配置,切换用户或重新登录后生效
*               hard    nproc           4096
*               soft    nproc           4096
  • max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
# 修改/etc/sysctl.conf,增加如下配置,保存后执行sysctl -p 生效
fs.file-max=655350
  • max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
# 修改/etc/sysctl.conf,增加如下配置,保存后执行sysctl -p 生效
vm.max_map_count=262144

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐