当前位置:   article > 正文

Windows 部署 Elasticsearch + kibana 8.0 指南

elasticsearch.serviceaccounttoken

以下内容图示为主,主要探讨和早期版本的不同,给大家升级 8.0 或者更高版本铺路。

一、Windows 单节点集群部署

1、步骤1:下载并解压 elasticsearch、kibana 安装包。

9a3f892b430a21e38a961f07d754ba52.png

2、步骤2:启动 elasticsearch。

注意!!!!!

不要修改任何配置,一会我会讲为什么。

启动 elasticsearch 后,记录命令行提示的信息。如下:

  1. -> Elasticsearch security features have been automatically configured!
  2. -> Authentication is enabled and cluster connections are encrypted.
  3. ->  Password for the elastic user (reset with bin/elasticsearch-reset-password -u elastic):
  4.   E28HdAOZEdumJU7A9wL7
  5. ->  HTTP CA certificate SHA-256 fingerprint:
  6.   264b58e0f92f1e7492cc4cd407aac886012b026af6a20d777a05cd0ddccb43b4
  7. ->  Configure Kibana to use this cluster:
  8. * Run Kibana and click the configuration link in the terminal when Kibana starts.
  9. * Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
  10.   eyJ2ZXIiOiI4LjAuMCIsImFkciI6WyIxNzIuMjAuNi4yMjU6OTIwMCIsIjE5Mi4xNjguMTAxLjU6OTIwMCJdLCJmZ3IiOiIyNjRiNThlMGY5MmYxZTc0OTJjYzRjZDQwN2FhYzg4NjAxMmIwMjZhZjZhMjBkNzc3YTA1Y2QwZGRjY2I0M2I0Iiwia2V5IjoiWUdxX0IzOEI3enY2MVdWT2pDeUI6ak1zZ3o3a1FUSE9pMHd1aHFfUjNvZyJ9
  11. ->  Configure other nodes to join this cluster:
  12. * On this node:
  13.   - Create an enrollment token with bin/elasticsearch-create-enrollment-token -s node.
  14.   - Uncomment the transport.host setting at the end of config/elasticsearch.yml.
  15.   - Restart Elasticsearch.
  16. * On other nodes:
  17.   - Start Elasticsearch with bin/elasticsearch --enrollment-token <token>, using the enrollment token that you generated.

步骤3、启动 Kibana

注意下面的提示信息,提示我们浏览器访问,并完成配置。

  1. i Kibana has not been configured.
  2. Go to http://localhost:5601/?code=368039 to get started.

4、步骤4:完成 Kibana 配置

b25714e1ad30f9dbd1fcff1eca735ab5.png

295691f8c4bf6c80fa21f3a90c25dc08.png

3c868005489cbb0c516bbb556a211d9c.png

e789e2d1efac78ac5700b70cf6db941d.png

49ef9de33e7c3b087aafb790a934e558.png

2bef659af8b9b2300527f38d1da8e8fb.png

二、8.X 的安装配置简化体现在哪里?

铭毅的观察:

  • 节点无需任何安全配置,即可实现 TLS 加密通信、Https 加密通信。

  • TLS 应用于 节点间的通信。

  • Https 应用于 Http访问,例如:浏览器访问 elasticsearch。

在第一次启动之后,elasticsearch 下的elasticsearch.yml 文件自动新增配置如下:

  1. Enable security features
  2. xpack.security.enabled: true
  3. xpack.security.enrollment.enabled: true
  4. Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
  5. xpack.security.http.ssl:
  6.   enabled: true
  7.   keystore.path: certs/http.p12
  8. Enable encryption and mutual authentication between cluster nodes
  9. xpack.security.transport.ssl:
  10.   enabled: true
  11.   verification_mode: certificate
  12.   keystore.path: certs/transport.p12
  13.   truststore.path: certs/transport.p12
  14. Create a new cluster with the current node only
  15. Additional nodes can still join the cluster later
  16. cluster.initialmasternodes: ["DESKTOP-TKQF337"]
  17. Allow HTTP API connections from localhost and local networks
  18. Connections are encrypted and require user authentication
  19. http.host: [local, site]
  20. Allow other nodes to join the cluster from localhost and local networks
  21. Connections are encrypted and mutually authenticated
  22. #transport.host: [local, site]
  23. #----------------------- END SECURITY AUTO CONFIGURATION -------------------------

而 Kibana 下的配置在浏览器配置完毕后,自动新增配置如下

  1. # This section was automatically generated during setup.
  2. elasticsearch.hosts: ['https://172.20.6.225:9200']
  3. elasticsearch.serviceAccountToken: AAEAAWVsYXN0aWMva2liYW5hL2Vucm9sbC1wcm9jZXNzLXRva2VuLTE2NDUxMDI3NzQyOTg6VWszUEc1YUtTMkdXT1lxMkNaUVdXdw
  4. elasticsearch.ssl.certificateAuthorities: ['D:\2.es_install\kibana-8.0.0-windows-x86_64\kibana-8.0.0\data\ca_1645102775117.crt']
  5. xpack.fleet.outputs: [{id: fleet-default-output, name: default, is_default: true, is_default_monitoring: truetype: elasticsearch, hosts: ['https://172.20.6.225:9200'], ca_trusted_fingerprint: 264b58e0f92f1e7492cc4cd407aac886012b026af6a20d777a05cd0ddccb43b4}]

三、更新了哪些认知?

这和早期版本使用不太一样的。

我习惯配置成本地 ip 地址,然后再访问的,包括云服务的我也是先改配置再访问。

  • 优点:这种自动化的方式,单节点本机无需配置即可启动,非常方便。

  • 缺点:对于云服务器方式,这种方式是不凑效的,为啥?

关于云服务器的不生效,本质原因,看官方文档:

https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-stack-security.html

When Elasticsearch starts for the first time, the security auto-configuration process binds the HTTP layer to both _site_ and _local_, but only binds the transport layer to _local_. This intended behavior ensures that you can start a single-node cluster with security enabled by default without any additional configuration.

什么是_site_?

  • site

Any site-local addresses on the system, for example 192.168.0.1.

什么是_local_?

  • local

Any loopback addresses on the system, for example 127.0.0.1.

目前看 linux 云服务器在无图形化桌面浏览器的情况下无法通过浏览器实现。

724e71f3dc030d427797b6ced5b68cf2.png

那么云服务器的 Elasticsearch 怎么搞起来?且听下回分解。

下一篇:云服务器 Centos7 部署 Elasticsearch 8.0 + Kibana 8.0 指南

发文时间:2022-02-17

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/煮酒与君饮/article/detail/746539
推荐阅读
相关标签
  

闽ICP备14008679号