当前位置: 首页 > news >正文

安装 elasticsearch-9.1.4 - 集群 和 kibana-9.1.4

准备 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: truekeystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
xpack.security.transport.ssl:enabled: trueverification_mode: certificatekeystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12truststore.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]yPassword 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: truekeystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
xpack.security.transport.ssl:enabled: trueverification_mode: certificatekeystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12truststore.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: truekeystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12truststore.path: /opt/module/elasticsearch-9.1.4/config/certs/elasticsearch-ssl-http/elasticsearch/http.p12
xpack.security.transport.ssl:enabled: trueverification_mode: certificatekeystore.path: /opt/module/elasticsearch-9.1.4/config/certs/elastic-certificates.p12truststore.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】 】】】

http://www.hskmm.com/?act=detail&tid=15178

相关文章:

  • 反码 原码 补码
  • 线性结构常见应用之栈[基于郝斌课程]
  • 实测对比:权威榜单之公众号排版Top 5(含效果对比与适用建议)
  • go的泛型
  • 原码补码反码
  • lc1034-边界着色
  • 【汽车电子】汽车功能安全标准 ISO 26262
  • ISO 26262的不同安全等级:ASIL-D ASIL-C ASIL-B ASIL-A
  • C#学习1
  • 02020405 EF Core基础05-EF Core反向工程、EF Core和ADO.NET Core的联系、EF Core无法做到的事情
  • 02020406 EF Core基础06-EF Core生成的SQL
  • Gemini-2.5-Flash-Image-Preview 与 GPT-4o 图像生成能力技术差异解析​ - 教程
  • 新学期每日总结(第2天)
  • 在CodeBolcks下wxSmith的C++编程教程——使用菜单和组件
  • 单调队列
  • 软工第一次编程
  • 第二次软工作业
  • 9.23总结
  • 日志|力扣|不同路径|最小路径和|动态规划|Javase|IO|File|Javaweb
  • 如何建立 5 μm 精度的视觉检测?不仅仅是相机的事
  • 函数 cmd_info_change_cur_model_group
  • 线程--相关概念、两种创建线程的方式
  • 恢复某个数据文件不适当,导致DataGuard无法open数据库
  • Nginx 部署及配置
  • vite静态资源处理
  • 洛谷B4040 [GESP202409 四级] 黑白方块 题解
  • SerpApi:一站式搜索引擎数据抓取API完全指南
  • 补whk时的鲜花(持续更新)
  • css 使用记录 随笔
  • newDay02