ElasticSearch的部署及使用:一、ElastciSearch环境搭建

本文详细介绍如何在CentOS上安装配置JDK1.8及ElasticSearch 6.4.0,并解决常见启动错误,包括调整系统配置及ElasticSearch配置文件。

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

一、ElasticSearch单点模式搭建

 准备jdk1.8.0_171.zip、elasticsearch-6.4.0.tar.gz

(1)安装JDK1.8并配置环境变量

   略

(2)安装elasticsearch

       创建用户elastic (elasticsearch 不能使用root用户启动,会报错)

useradd -g root -p password elastic 

su elastic

     解压elasticsearch-6.4.0.tar.gz并复制到/use/local/elastic目录

 

mkdir -p /usr/local/elastic

tar -zxvf /home/elasticsearch-6.4.0.tar.gz
 
cp -r /home/elasticsearch-6.4.0/*  /usr/local/elastic

 修改config目录下elasticsearch.yml文件

cluster.name: WLF-ES 集群名称

node.name: WLF-ES01 节点名称

path.data: 数据文件的路径

path.logs 日志文件的路径

bootstrap.memory_lock: true 启动时是否锁内存,建议锁内存

network.host 绑定ip地址,默认0.0.0.0表示所有地址,绑定了ip地址,将暴露在公网中,注意安全防护

http.port 端口号

  修改config目录下jvm.options,设置jvm 参数

  (3)启动elasticsearch

cd /usr/local/elastic
./bin/elasticsearch 

    如果出现以下报错:

ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

切换到root用户,修改/etc/sysctl.conf,执行sysctl -p

vi /etc/sysctl.conf 

vm.max_map_count = 262144
vm.swappiness = 1



sysctl -p
ERROR: bootstrap checks failed
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.x.x默认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

ERROR: bootstrap checks failed
memory locking requested for elasticsearch process but memory is not locked

切换到root用户,修改/etc/security/limits.conf

 vim /etc/security/limits.conf 

 * soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096
* hard memlock unlimited
* soft memlock unlimited
*  - as unlimited

访问http://localshost:9200如下图:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值