惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
罗磊的独立博客
人人都是产品经理
人人都是产品经理
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
L
Lohrmann on Cybersecurity
博客园 - 【当耐特】
量子位
Last Week in AI
Last Week in AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Cyber Attacks, Cyber Crime and Cyber Security
腾讯CDC
有赞技术团队
有赞技术团队
Cyberwarzone
Cyberwarzone
T
Tor Project blog
V
V2EX
L
LINUX DO - 热门话题
Security Latest
Security Latest
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
NISL@THU
NISL@THU
C
Cisco Blogs
T
Tailwind CSS Blog
G
GRAHAM CLULEY
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
K
Kaspersky official blog
博客园 - 司徒正美
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
S
Schneier on Security
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
J
Java Code Geeks
博客园 - 聂微东
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
F
Fortinet All Blogs
T
Threat Research - Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网

博客园 - chan_炽烽

J4125 - OPNsense 配置 MGMT(管理口) J4125 - OPNsense 系统配置备份及恢复 J4125 - OPNsense 简单使用 J4125 安装 OPNsense 【VMware Workstation】Debian 13 安装 sing-box(Claaash配置转换sing-box配置) Radxa E20C 安装 飞牛 fnOS Radxa E20C 升级 LEDE(含编译过程) Radxa E20C 安装 LEDE(含编译过程) 【VMware Workstation】Debian 13 桌面版安装 docker-compose + macvlan + Elasticsearch - 9.1.4 + Kibana - 9.1.4 安装 elasticsearch-9.1.4的 IK分词器 Radxa E20C 安装 OpenWrt 【VMware Workstation】Rocky Linux 10 桌面版安装 iStoreOS + 旁路由 + openClash - chan_炽烽 iStoreOS + 旁路由 【推荐 - 源码安装】Redis - 安装 【推荐 - 源码安装】nginx - 安装 fastDFS - 单机部署 + nginx MySQL - 安装时的安全配置 【推荐 - glibc安装】MySQL - 安装 【推荐 - rpm安装】MySQL - 安装 修复PG.conf文件出现的问题 [七月挑选]树莓派Raspberrypi上配置Git [七月挑选]IntelliJ IDEA常用设置
安装 elasticsearch-9.1.4 - 集群 和 kibana-9.1.4
chan_炽烽 · 2025-09-23 · via 博客园 - chan_炽烽

准备 3 台主机,均进行如下操作

  1. 更新系统以及关联软件
yum update
  1. 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/enforcing/disabled/' /etc/selinux/config
setenforce 0
  1. 设置主机名
# lab10 主机设置为
hostnamectl set-hostname lab10

# lab20 主机设置为
hostnamectl set-hostname lab20

# lab30 主机设置为
hostnamectl set-hostname lab30
  1. 编辑本地域名解析
vim /etc/hosts

追加内容如下:

10.1.1.10 lab10
10.1.1.20 lab20
10.1.1.30 lab30
  1. 创建 software 目录
mkdir /opt/software
  1. 创建 module 目录
mkdir /opt/module
  1. 下载 Elasticsearch 文件

下载列表页面:https://www.elastic.co/cn/downloads/past-releases#elasticsearch
文件名称:elasticsearch-9.1.4-linux-x86_64.tar.gz
MD5:20DA05C3A2A7425A658A73D6D9AF8DFE
下载链接:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-9.1.4-linux-x86_64.tar.gz

  1. 拷贝到 /opt/software

  2. 解压

tar -zxvf /opt/software/elasticsearch-9.1.4-linux-x86_64.tar.gz -C /opt/module
  1. 创建 es 用户
useradd es
  1. 设置 es 用户密码
passwd es
  1. 创建 data 目录
mkdir /opt/module/elasticsearch-9.1.4/data
  1. 创建 certs 目录
mkdir /opt/module/elasticsearch-9.1.4/config/certs
  1. 进入 Elasticsearch 目录
cd /opt/module/elasticsearch-9.1.4
  1. Elasticsearch 目录赋权给 es 用户操作
chown -R es:es /opt/module/elasticsearch-9.1.4

lab10 主机操作

  1. 切换 es 用户
su es
  1. 签发 ca 证书
bin/elasticsearch-certutil ca

操作过程如下

Please enter the desired output file [elastic-stack-ca.p12]:【默认,回车】
Enter password for elastic-stack-ca.p12 :【默认,回车】

完成后证书在 /opt/module/elasticsearch-9.1.4/elastic-stack-ca.p12

  1. 用 ca 证书签发节点证书,设置集群多节点通信密钥
bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12

操作过程如下

Enter password for CA (elastic-stack-ca.p12) :【默认,回车】
Please enter the desired output file [elastic-certificates.p12]:【默认,回车】
Enter password for elastic-certificates.p12 :【默认,回车】

完成后证书在 /opt/module/elasticsearch-9.1.4/elastic-certificates.p12

  1. 移动上述 2 个证书至 cert 目录
mv elastic-stack-ca.p12 elastic-certificates.p12 config/certs
  1. 设置集群多节点 HTTP 证书
bin/elasticsearch-certutil http

操作过程如下:

Generate a CSR? [y/N]N
Use an existing CA? [y/N]y
CA Path: 【certs/elastic-stack-ca.p12】
Password for elastic-certificates.p12:【默认,回车】
For how long should your certificate be valid? [5y] 【默认,回车】
Generate a certificate per node? [y/N]n
When you are done, press <ENTER> once more to move on to the next step.

lab10
lab20
lab30
Is this correct [Y/n]Y
When you are done, press <ENTER> once more to move on to the next step.

10.1.1.10
10.1.1.20
10.1.1.30
Is this correct [Y/n]Y
Do you wish to change any of these options? [y/N]N
Provide a password for the "http.p12" file:  [<ENTER> for none]【默认,回车】
What filename should be used for the output zip file? [/opt/module/elasticsearch-9.1.4/elasticsearch-ssl-http.zip]【默认,回车】

完成后证书在 /opt/module/elasticsearch-9.1.4/elasticsearch-ssl-http.zip

  1. 移动上述 1 个压缩包至 cert 目录
mv elasticsearch-ssl-http.zip config/certs/
  1. 解压
unzip config/certs/elasticsearch-ssl-http.zip -d config/certs/elasticsearch-ssl-http
  1. 删除无用的压缩包
rm -rf /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http.zip
  1. 编辑 elasticsearch.yml 文件
vim /opt/module/elasticsearch-9.1.4/config/elasticsearch.yml

追加内容如下

# 设置 ES 集群名称
cluster.name: es-cluster
# 设置集群中当前节点名称
node.name: es-node-1
# 设置数据,日志文件路径
path.data: /opt/module/elasticsearch-9.1.4/data
path.logs: /opt/module/elasticsearch-9.1.4/logs
# 设置网络访问节点
network.host: lab10
# 设置网络访问端口
http.port: 9200
# 初始节点
discovery.seed_hosts: ["lab10"]
# 安全认证
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
  enabled: true
  keystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
  truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12
  truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12
# 此处需注意,es-node-1 为上面配置的节点名称
cluster.initial_master_nodes: ["es-node-1"]
http.host: [_local_, _site_]
ingest.geoip.downloader.enabled: false
xpack.security.http.ssl.client_authentication: none
  1. 启动 Elasticsearch 集群
bin/elasticsearch
  1. 重建会话,并使用 es 用户登录并且进入 /opt/module/elasticsearch-9.1.4 目录

  2. 重置 elastic 用户密码

bin/elasticsearch-reset-password -u elastic

操作过程如下

[root@lab10 elasticsearch-9.1.4]# su es
[es@lab10 elasticsearch-9.1.4]$ bin/elasticsearch-reset-password -u elastic
This tool will reset the password of the [elastic] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]y


Password for the [elastic] user successfully reset.
New value: 1m+yge3yEAkwcetxua-o
[es@lab10 elasticsearch-9.1.4]$ 
  1. 使用浏览器访问:https://10.1.1.10:9200,默认账号为:elastic,密码为 1m+yge3yEAkwcetxua-o,得到如下图所示

elasticsearch-install-1

  1. 使用谷歌浏览器的 Elasticsearch Tools 插件查看 Elasticsearch 状态

elasticsearch-install-2

  1. 使用谷歌浏览器的 Elasticvue 插件查看 Elasticsearch 状态

elasticsearch-install-3

lab20 主机操作

  1. 将 lab10主机 /opt/module/elasticsearch-9.1.4/config/certs 目录拷贝至本机的 /opt/module/elasticsearch-9.1.4/config/certs 目录

  2. Elasticsearch 目录赋权给 es 用户操作(需要root用户权限操作)

chown -R es:es /opt/module/elasticsearch-9.1.4
  1. 切换 es 用户
su es
  1. 编辑 elasticsearch.yml 文件
vim /opt/module/elasticsearch-9.1.4/config/elasticsearch.yml

追加内容如下

# 设置 ES 集群名称
cluster.name: es-cluster
# 设置集群中当前节点名称
node.name: es-node-2
# 设置数据,日志文件路径
path.data: /opt/module/elasticsearch-9.1.4/data
path.logs: /opt/module/elasticsearch-9.1.4/logs
# 设置网络访问节点
network.host: lab20
# 设置网络访问端口
http.port: 9200
# 初始节点
discovery.seed_hosts: ["lab10"]
# 安全认证
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
  enabled: true
  keystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
  truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12
  truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12
# 此处需注意,es-node-1 为上面配置的节点名称
cluster.initial_master_nodes: ["es-node-1"]
http.host: [_local_, _site_]
ingest.geoip.downloader.enabled: false
xpack.security.http.ssl.client_authentication: none
  1. 进入 Elasticsearch 目录
cd /opt/module/elasticsearch-9.1.4
  1. 后台启动 Elasticsearch 集群
bin/elasticsearch -d
  1. 使用谷歌浏览器的 Elasticsearch Tools 插件查看 Elasticsearch 状态

elasticsearch-install-4

  1. 使用谷歌浏览器的 Elasticvue 插件查看 Elasticsearch 状态

elasticsearch-install-5

lab30 主机操作

  1. 将 lab10主机 /opt/module/elasticsearch-9.1.4/config/certs 目录拷贝至本机的 /opt/module/elasticsearch-9.1.4/config/certs 目录

  2. Elasticsearch 目录赋权给 es 用户操作(需要root用户权限操作)

chown -R es:es /opt/module/elasticsearch-9.1.4
  1. 切换 es 用户
su es
  1. 编辑 elasticsearch.yml 文件
vim /opt/module/elasticsearch-9.1.4/config/elasticsearch.yml

追加内容如下

# 设置 ES 集群名称
cluster.name: es-cluster
# 设置集群中当前节点名称
node.name: es-node-3
# 设置数据,日志文件路径
path.data: /opt/module/elasticsearch-9.1.4/data
path.logs: /opt/module/elasticsearch-9.1.4/logs
# 设置网络访问节点
network.host: lab30
# 设置网络访问端口
http.port: 9200
# 初始节点
discovery.seed_hosts: ["lab10"]
# 安全认证
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
  enabled: true
  keystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
  truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12
  truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12
# 此处需注意,es-node-1 为上面配置的节点名称
cluster.initial_master_nodes: ["es-node-1"]
http.host: [_local_, _site_]
ingest.geoip.downloader.enabled: false
xpack.security.http.ssl.client_authentication: none
  1. 进入 Elasticsearch 目录
cd /opt/module/elasticsearch-9.1.4
  1. 后台启动 Elasticsearch 集群
bin/elasticsearch -d
  1. 使用谷歌浏览器的 Elasticsearch Tools 插件查看 Elasticsearch 状态

elasticsearch-install-6

  1. 使用谷歌浏览器的 Elasticvue 插件查看 Elasticsearch 状态

elasticsearch-install-7

【【【 以上完成【安装 elasticsearch-9.1.4 - 集群】 】】】
【【【 以上完成【安装 elasticsearch-9.1.4 - 集群】 】】】
【【【 以上完成【安装 elasticsearch-9.1.4 - 集群】 】】】

lab10 主机操作

  1. 下载Kibana 文件

下载列表页面:https://www.elastic.co/cn/downloads/past-releases#elasticsearch
文件名称:kibana-9.1.4-linux-x86_64.tar.gz
MD5:188D1DEE8DE1AD02116C26404B877C16
下载链接:https://artifacts.elastic.co/downloads/kibana/kibana-9.1.4-linux-x86_64.tar.gz

  1. 拷贝到 /opt/software

  2. 解压

tar -zxvf /opt/software/kibana-9.1.4-linux-x86_64.tar.gz -C /opt/module/
  1. 进入 Elasticsearch 目录
cd /opt/module/elasticsearch-9.1.4
  1. 在 ES 服务器中生成证书
bin/elasticsearch-certutil csr -name kibana -dns lab10

操作过程

Please enter the desired output file [csr-bundle.zip]: 【默认配置,回车】

生成成功后的证书路径在 /opt/module/elasticsearch-9.1.4/csr-bundle.zip

  1. 移动证书至 /opt/module/kibana-9.1.4/config
mv /opt/module/elasticsearch-9.1.4/csr-bundle.zip /opt/module/kibana-9.1.4/config/
  1. 解压
unzip /opt/module/kibana-9.1.4/config/csr-bundle.zip -d /opt/module/kibana-9.1.4/config/csr-bundle
  1. 删除无用的压缩包
rm -rf /opt/module/kibana-9.1.4/config/csr-bundle.zip
  1. 进入证书目录
cd /opt/module/kibana-9.1.4/config/csr-bundle/kibana
  1. 生成 crt 文件
openssl x509 -req -in kibana.csr -signkey kibana.key -out kibana.crt
  1. 编辑 kibana.yml 文件
vim /opt/module/kibana-9.1.4/config/kibana.yml

内容如下

# 服务端口
server.port: 5601
# 服务主机名
server.host: "lab10"
# 国际化 - 中文
i18n.locale: "zh-CN"
# ES 服务主机地址
elasticsearch.hosts: ["https://lab10:9200"]
# 访问 ES 服务的账号密码
elasticsearch.username: "kibana"
# 需要使用es用户,使用命令 bin/elasticsearch-reset-password -u kibana 获取密码
elasticsearch.password: "hloTe9BBk-4gB8DUwmbY"
elasticsearch.ssl.verificationMode: none
elasticsearch.ssl.certificateAuthorities: [ "/opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/kibana/elasticsearch-ca.pem" ]
server.ssl.enabled: true
server.ssl.certificate: /opt/module/kibana-9.1.4/config/csr-bundle/kibana/kibana.crt
server.ssl.key: /opt/module/kibana-9.1.4/config/csr-bundle/kibana/kibana.key
  1. /opt/module/kibana-8.1.0/ 目录给 es 用户赋予权限
chown -R es:es /opt/module/kibana-9.1.4/
  1. 切换 es 用户
su es
  1. 切换工作目录
cd /opt/module/kibana-9.1.4/
  1. 启动 kibana
bin/kibana

或者

nohup /opt/module/kibana-9.1.4/bin/kibana >kibana.log 2>&1 &
  1. 浏览器访问 https://10.1.1.10:5601/,默认账号为 elastic,默认密码为控制台输出为准,成功登录后的图片

kibana-install-1

【【【 以上完成【kibana-9.1.4】 】】】
【【【 以上完成【kibana-9.1.4】 】】】
【【【 以上完成【kibana-9.1.4】 】】】