Elasticsearch-8.4.2 集群安装

一、 环境准备

Java环境1.8以上

机器如下

node1 192.168.157.128

node2 192.168.157.129

node3 192.168.157.130

二、下载elasticsearch

Download Elasticsearch | Elastic

三、安装elasticsearch

1. 将安装包上传到/opt/apps目录下

2. 解压

tar -zxvf elasticsearch-8.4.2-linux-x86_64.tar.gz

3. 进入elasticsearch-8.4.2,创建data目录

mkdir data

4. 编辑config目录下得elasticsearch.yml配置文件

node1配置如下,其他节点只需要改变node.name 和 host即可。

cluster.name: es-cluster
node.name: node-1
path.data: /opt/apps/elasticsearch-8.4.2/data
path.logs: /opt/apps/elasticsearch-8.4.2/logs
network.host: 192.168.157.128
network.bind_host: 0.0.0.0
network.publish_host: 192.168.157.128
http.port: 9200
discovery.seed_hosts: ["192.168.157.128", "192.168.157.129", "192.168.157.130"]
cluster.initial_master_nodes: ["node-1"]
xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false

 5. 创建es启动用户

# 创建es组
groupadd es
# 创建es用户并在es组中
useradd es -g es
# 设置es密码
passwd es

6. 其他系统设置

# 修改limits.conf文件
vi /etc/security/limits.conf
es hard nofile 65536
es soft nofile 65536

# 修改sysctl.conf
vi /etc/sysctl.conf 
vm.max_map_count=655360

7. 修改elasticsearch-8.4.2目录所属者和所属组

chown -R es:es /opt/apps/elasticsearch-8.4.2

8. 启动elasticsearch

切换es用户,在bin目录下执行如下命令即可

./elasticsearch

四、验证是否安装完成

使用浏览器访问192.168.157.128:9200/_cat/nodes 查看各个节点信息,打星号的表示为主节点。 

五、问题总结

1. 不能用root启动elasticsearch

2. max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

# 修改limits.conf文件
vi /etc/security/limits.conf
es hard nofile 65536
es soft nofile 65536

# 修改sysctl.conf
vi /etc/sysctl.conf 
vm.max_map_count=655360

3. Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]

xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false

至此elasticsearch集群的搭建就结束了,大家也去试试吧。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值