Elasticsearch8.9.0安装配置集群

  1. 下载安装包
    从官网下载8.9.0安装包
# elasticsearch-8.9.0-x86_64.rpm  filebeat-8.9.0-x86_64.rpm  kibana-8.9.0-x86_64.rpm
  1. 安装
    系统环境查看
# cat /etc/redhat-release 
Rocky Linux release 9.3 (Blue Onyx)
# uname -a
Linux Rocky9Es01003089 5.14.0-362.18.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Feb 11 13:49:23 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

本次使用两台主机安装集群
安装elasticsearch

# rpm -ivh elasticsearch-8.9.0-x86_64.rpm 

修改配置文件
node-1

# cat /etc/elasticsearch/elasticsearch.yml 
# 集群名两台主机配置需要一致
cluster.name: my-es
# 本机node名两台主机配置需要不同
node.name: node-1
# 数据路径和日志路径,如果启动失败需要把这两个文件夹的权限设置属组为elasticsearch
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
# 需要设置为0.0.0.0否则集群无法通信
network.host: 0.0.0.0
# 设置集群节点地址,本次有两个节点
discovery.seed_hosts: ["192.168.3.89", "192.168.3.90"]

# 关闭认证,默认以下两处为true
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# 该配置为安装elasticsearch时默认获取配置无需修改
cluster.initial_master_nodes: ["Rocky9Es01003089"]

http.host: 0.0.0.0

node-2

# cat /etc/elasticsearch/elasticsearch.yml 
cluster.name: my-es
node.name: node-2
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
discovery.seed_hosts: ["192.168.3.89", "192.168.3.90"]


xpack.security.enabled: false

xpack.security.enrollment.enabled: false

xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
cluster.initial_master_nodes: ["Rocky9Es02003090"]

http.host: 0.0.0.0

启动

# systemctl daemon-reload
# systemctl start elasticsearch.service 
# systemctl status elasticsearch.service
# systemctl status elasticsearch.service

查看健康集群状态

# curl http://192.168.3.89:9200/_cat/health
1721182822 02:20:22 my-es green 2 2 42 21 0 0 0 0 - 100.0%
  1. kibana配置文件
# sed '/#/d' /etc/kibana/kibana.yml | sed '/^$/d'
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://192.168.3.89:9200"]
logging:
  appenders:
    file:
      type: file
      fileName: /var/log/kibana/kibana.log
      layout:
        type: json
  root:
    appenders:
      - default
      - file
pid.file: /run/kibana/kibana.pid
posted @ 2024-07-17 10:21  minseo  阅读(62)  评论(0编辑  收藏  举报