一、docker安装

安装docker引擎

# 下载的脚本
curl -fsSL https://get.docker.com -o get-docker.sh
# 给予脚本可执行权限
chmod +x get-docker.sh
# 运行前预览脚本步骤。可以运行脚本,并可以选择--dry-run了解脚本在调用时将运行哪些步骤
sudo sh ./get-docker.sh --dry-run

安装docker-compose

  1. 下载并安装 Docker Compose 独立版

     curl -SL https://github.com/docker/compose/releases/download/v2.32.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
  2. 将可执行权限应用于安装目标路径中的独立二进制文件

    chmod +x /usr/local/bin/docker-compose
  3. 使用测试并执行 Docker Compose 命令docker-compose

二、Elasticsearch安装(elasticsearch-8.15.5

1. 配置虚拟内存参数值为262144

参考连接:http://smartnexus.cn/archives/linuxpei-zhi#%E5%9B%9B%E3%80%81vm.max_map_count:~:text=%E5%9B%9B%E3%80%81-,vm.max_map_count,-vm.max_map_count%20%E6%98%AF

2. 修改文件描述符限制65530

参考连接:http://smartnexus.cn/archives/linuxpei-zhi#%E4%BA%94%E3%80%81%E4%BF%AE%E6%94%B9%E6%96%87%E4%BB%B6%E6%8F%8F%E8%BF%B0%E7%AC%A6%E9%99%90%E5%88%B6:~:text=%E4%BA%94%E3%80%81-,%E4%BF%AE%E6%94%B9%E6%96%87%E4%BB%B6%E6%8F%8F%E8%BF%B0%E7%AC%A6%E9%99%90%E5%88%B6,-%E6%96%87%E4%BB%B6%E6%8F%8F%E8%BF%B0%E7%AC%A6

3.下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.5-linux-x86_64.tar.gz​​​​​​​​​​​​​​​​​​​​​​​
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.5-linux-x86_64.tar.gz.sha512​​​​​​​​​​​​​​​​​​​​​​​​​
shasum - a 512 - c elasticsearch - 8.15.5 - linux - x86_64.tar.gz.sha512​​​​​​​ 
tar - xzf elasticsearch - 8.15.5 - linux - x86_64.tar.gz​​​​​
cd elasticsearch - 8.15.5 /​ 

4. 修改配置

# 启用安全功能
# 注意:当前安全功能被禁用。
xpack.security.enabled: false

# 禁用新安全启用节点的注册。
xpack.security.enrollment.enabled: false

# 为 HTTP API 客户端连接(例如来自 Kibana、Logstash、Agents)启用加密
# 当前,此功能被禁用,这意味着 HTTP 流量未加密。
xpack.security.http.ssl:
  enabled: false
  # 包含 HTTPS 证书和私钥的密钥库路径
  keystore.path: certs/http.p12

# 启用集群节点之间的加密和相互认证
# 此功能也被禁用,这意味着节点间通信不安全。
xpack.security.transport.ssl:
  enabled: false
  # 验证模式设置为证书,但由于已禁用,因此不会生效
  verification_mode: certificate
  # 包含节点证书的密钥库路径
  keystore.path: certs/transport.p12
  # 包含用于相互认证的受信任证书的信任库路径
  truststore.path: certs/transport.p12

# 单节点集群的初始主节点配置
# 未来可以有其他节点加入此集群。
cluster.initial_master_nodes: ["es-node1"]

# 允许任何 IP 地址的 HTTP API 连接
# 注意:由于安全性被禁用,这意味着任何客户端都可以无身份验证连接。
http.host: 0.0.0.0

# 允许其他节点从任何 IP 地址加入集群
# 此设置被注释掉,意味着传输通信目前未为安全配置。
# 不过,在启用加密和相互认证的情况下,将使用此设置允许节点相互连接。
#transport.host: 0.0.0.0

5、运行

./home/elastic/elasticsearch-8.15.5/bin/elasticsearch -d

三、kibana安装(kibana-8.15.5

kibana版本和Elasticsearch版本保持一致

1. 修改配置

server.port: 5601
server.host: "192.168.149.134"
server.ssl.enabled: false
elasticsearch.hosts: ["http://192.168.149.134:9200"]

2. 运行

nohup /home/elastic/kibana-8.15.5/bin/kibana > /home/elastic/kibana-8.15.5/logs/kibana.log 2>&1 &

四、集群配置

es-node2

cluster.name: es-cluster
node.name: es-node2
network.host: 192.168.149.135
http.port: 9981
discovery.seed_hosts: ["192.168.149.135", "192.168.149.136"]
cluster.initial_master_nodes: ["es-node2"]
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: false
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12

es-node3

cluster.name: es-cluster
node.name: es-node3
network.host: 192.168.149.136
http.port: 9982
discovery.seed_hosts: ["192.168.149.135", "192.168.149.136"]
cluster.initial_master_nodes: ["es-node2"]
action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
xpack.security.http.ssl:
  enabled: false
  #keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: false
  #verification_mode: certificate
  #keystore.path: certs/transport.p12
  #truststore.path: certs/transport.p12

注意discovery.seed_hosts 无需加端口号