Elasticsearch 和 Kibana 安装

Elasticsearch 和 Kibana 安装

  • 操作系统:Windows 10
  • Elastic Stack 版本:8.4.3

安装 Elasticsearch

下载 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.4.3-windows-x86_64.zip

运行 Elasticsearch:

cd elasticsearch-8.4.3
bin\elasticsearch.bat

第一次启动会生成以下安全配置:

  • 超级用户 elastic 以及密码
  • 用于加密传输和 HTTP 的密钥和证书
  • 用于 Kibana 连接 Elasticsearch 的,有效期为 30 分钟的 token
  • 将 TSL 配置信息写到配置文件 config\elasticsearch.yml
The generated password for the elastic built-in superuser is:
<password>

The enrollment token for Kibana instances, valid for the next 30 minutes:
<enrollment-token>

The hex-encoded SHA-256 fingerprint of the generated HTTPS CA DER-encoded certificate:
<fingerprint>

You can complete the following actions at any time:
Reset the password of the elastic built-in superuser with
'bin\elasticsearch-reset-password -u elastic'.

Generate an enrollment token for Kibana instances with
'bin\elasticsearch-create-enrollment-token -s kibana'.

Generate an enrollment token for Elasticsearch nodes with
'bin\elasticsearch-create-enrollment-token -s node'.

确认启动成功:

curl --ssl-no-revoke --cacert config\certs\http_ca.crt -u elastic https://localhost:9200

客户端连接 Elasticsearch

第一次启动 Elasticsearch 会生成加密 HTTP 的 CA 证书:

config/certs/http_ca.crt

同时会在控制台打印证书的 SHA-256 指纹

客户端需要使用指纹或 CA 证书来和 Elasticsearch 建立 HTTPS 连接

可以通过 Git Bash 来获取证书指纹:

openssl x509 -fingerprint -sha256 -in config/certs/http_ca.crt

不支持指纹的客户端可以使用证书:

config\certs\http_ca.crt

安装 Kibana

下载 https://artifacts.elastic.co/downloads/kibana/kibana-8.4.3-windows-x86_64.zip

运行 Kibana:

cd kibana-8.4.3
bin\kibana.bat

点击控制台打印的连接:

i Kibana has not been configured.

Go to http://localhost:5601/?code=755303 to get started.

输入 Elasticsearch 生成的 token

输入用户 elastic 以及 Elasticsearch 生成的密码

重置 token 和 密码:

# 重置 token
bin\elasticsearch-create-enrollment-token -s kibana

# 重置密码
bin\elasticsearch-reset-password -u elastic

参阅

posted @ 2022-10-15 22:46  廖子博  阅读(436)  评论(0编辑  收藏  举报