elasticsearch安装

本文介绍了Elasticsearch 6.2.3版本的安装步骤,包括下载、解压、配置及启动过程,并列举了在CentOS环境下可能遇到的问题及其解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 安装

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz

tar -xvzf elasticsearch-6.2.3.tar.gz

使用非root账号运行

adduser es
passwd es

然后输入密码
创建成功后

chown -R es:es elasticsearch-6.2.3
su es

2. 配置

cd elasticsearch-6.2.3/config
vim elasticsearch.yml

根据需要配置

network.host: 0.0.0.0   #允许任意ip访问

3. 运行

cd elasticsearch-6.2.3/bin
bin/elasticsearch 

后台运行

nohup ./elasticsearch > elasticLog.log &
或
bin/elasticsearch -d

浏览器访问

ip地址:端口号   #端口号默认9200

返回一下内容表示启动成功

{
  "name" : "nQjQYj2",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "h7oqDUO1Q8me_iSdN1ztag",
  "version" : {
    "number" : "6.2.3",
    "build_hash" : "c59ff00",
    "build_date" : "2018-03-13T10:06:29.741383Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

4. 可能出现的问题和解决方法

1. system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
  • 问题原因:因为Centos6不支持SecComp,而ES5.2.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见:https://github.com/elastic/elasticsearch/issues/22899

  • 解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false
2. max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]

  • 解决方法:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf

添加如下内容:

soft nofile 65536
hard nofile 131072
soft nproc 2048
hard nproc 4096
3. max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
  • 解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf

修改如下内容:

soft nproc 1024

修改为

soft nproc 2048
4. max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
  • 解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值