Elasticsearch的安装与启动

演示目标

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

安装与启动

  • 下载ES
    https://www.elastic.co/cn/downloads/elasticsearch
  • 在Linux中使用tar -zxvf命令解压
  • 创建ES用户组及ES用户(ES不能使用Root用户运行):
# 增加ES用户组和ES用户并修改ES用户密码
groupadd es
useradd es -g es
passwd es
# 更改ES文件夹所属的用户组及用户
cd /opt
chown -R es:es elasticsearch-7.13.2
# 切换到ES用户并启动ES
su 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/config/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            65536
*               hard    nofile            65536
  • 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=65536
  • 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值