ElasticSearch 7.10.1部署

ElasticSearch官网
https://www.elastic.co/cn/elasticsearch/

注意:在用户目录下操作,比如ltx用户在/home/ltx目录下操作
1.安装elasticsearch
下载:elasticsearch-7.10.1-linux-x86_64.tar.gz
https://www.elastic.co/cn/downloads/elasticsearch
2.解压安装
tar -zxf elasticsearch-7.10.1-linux-x86_64.tar.gz
3.修改配置文件elasticsearch.yml
vi config/elasticsearch.yml
# 修改
# 使用默认
node.name: node-1
cluster.name: elasticsearch
network.host: 0.0.0.0
# 修改
cluster.initial_master_nodes: ["node-1"]

4.配置使用ES内置的jdk
# /home/soft/elasticsearch-7.10.1/jdk/ 为elastic路径
vi bin/elasticsearch
export JAVA_HOME=/home/soft/elasticsearch-7.10.1/jdk/
export PATH=$JAVA_HOME/bin:$PATH

#添加jdk判断
if [ -x "$JAVA_HOME/bin/java" ]; then
    JAVA="$JAVA_HOME/bin/java"
else
    JAVA=`which java`
fi

5.启动elasticsearch, 不能用root启动
nohup ./bin/elasticsearch > /dev/null 2>&1 &
把soft文件夹及其内容授权给litingxu用户
sudo chown -R litingxu soft

6.处理这几个异常
异常1:
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
原因:每个进程最大同时打开文件数太小,可通过下面2个命令查看当前数量
ulimit -Hn
ulimit -Sn
修改sudo vi /etc/security/limits.conf文件,增加配置,用户退出后重新登录生效
* soft nofile 65536
* hard nofile 65536

异常2:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
1.修改/etc/sysctl.conf文件,增加配置vm.max_map_count=262144
sudo vi /etc/sysctl.conf
2.执行命令sudo sysctl -p生效

异常3:
the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
原因:[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]这3个选项必须配置一个
cluster.initial_master_nodes: ["node-1"]

异常4:
max number of threads [1024] for user [litingxu] is too low, increase to at least [4096]
sudo vi /etc/security/limits.d/90-nproc.conf
#修改这个值
*          soft    nproc     4096
root       soft    nproc     unlimited
#重新登录,查看结果
ulimit -a

异常5:
[litingxu@node241 bin]$ ./elasticsearch
bash: ./elasticsearch: 权限不够
chmod +x elasticsearch

异常6:
[1]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[2021-01-09T17:00:45,810][WARN ][o.e.b.JNANatives         ] [node241] unable to install syscall filter: 
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
        at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:342) ~[elasticsearch-7.10.1.jar:7.10.1]
原因: ElasticSearch集群启动错误,错误的原因是:因为Centos6不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动解决:修改elasticsearch.yml
解决: 在所有节点的elasticsearch.yml配置文件中加入:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

7.验证
http://ip:9200/

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小小绿豆

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值