一、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如下图:
版权声明:本文为weixin_38441544原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。