Elasticstack学习随笔——系统部署

Elastic stack

elasticsearch

为什么当今开发者这么喜欢使用elasticsearch?

  • Horizontal Scale (可以很好支持横向扩展)
  • High Avaliability (可以配置多个副本集,保证高可用性)
  • Flexible Data Model (灵活的数据模型)
  • Rapid Query Execution (快速执行)
  • Sophisticated Query Language (支持复杂的聚合查询语言)
  • Schemaless

部署(elasticsearch和kibana)

方式一:安装包本地部署

安装包下载地址:

https://www.elastic.co/cn/downloads/elasticsearch

https://www.elastic.co/cn/downloads/kibana

1、下载好安装包后解压

[root@elasticsearch opt]# ls -lh
total 4.0K
lrwxrwxrwx  1 root root   20 Oct 12 08:47 elasticsearch -> elasticsearch-8.4.3/
drwxr-xr-x  9 root root  155 Oct  4 15:24 elasticsearch-8.4.3
lrwxrwxrwx  1 root root   13 Oct 12 10:40 kibana -> kibana-8.4.3/
drwxr-xr-x 11 root root 4.0K Oct 12 10:39 kibana-8.4.3

2、启动elasticsearch

[root@elasticsearch opt]# groupadd es
[root@elasticsearch opt]# useradd es -g es
[root@elasticsearch opt]# echo "es" | passwd es --stdin
Changing password for user es.
passwd: all authentication tokens updated successfully.
[root@elasticsearch opt]# chown -R es:es elasticsearch*
[root@elasticsearch opt]# chown -R es:es kibana*
[root@elasticsearch opt]# su - es
[es@elasticsearch ~]$ cd /opt/
# 第一次启动记得保存elasticsearch和kibana登录密钥和token
[es@elasticsearch opt]$ ./elasticsearch/bin/elasticsearch
......
✅ Elasticsearch security features have been automatically configured!
✅ Authentication is enabled and cluster connections are encrypted.

ℹ️  Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
  sw+ZjdL4qytAQZmGM4At

ℹ️  HTTP CA certificate SHA-256 fingerprint:
  716e3315ea9c6baf594683f3d61f21e0c00e8bceafa50124ec82c30ef6b242a3

ℹ️  Configure Kibana to use this cluster:
• Run Kibana and click the configuration link in the terminal when Kibana starts.
• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
  eyJ2ZXIiOiI4LjQuMyIsImFkciI6WyIxOTIuMTY4LjAuMTkwOjkyMDAiXSwiZmdyIjoiNzE2ZTMzMTVlYTljNmJhZjU5NDY4M2YzZDYxZjIxZTBjMDBlOGJjZWFmYTUwMTI0ZWM4MmMzMGVmNmIyNDJhMyIsImtleSI6IllyeWx5b01CZjVpczdzel9xWWF3OlpYeVE3amJGVHNTZ3hPWUM0VXU5d1EifQ==

ℹ️  Configure other nodes to join this cluster:
• On this node:
  ⁃ Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`.
  ⁃ Uncomment the transport.host setting at the end of config/elasticsearch.yml.
  ⁃ Restart Elasticsearch.
• On other nodes:
  ⁃ Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated.

3、验证

[es@elasticsearch elasticsearch]$ curl --cacert config/certs/http_ca.crt https://localhost:9200 -u elastic
Enter host password for user 'elastic':
{
  "name" : "elasticsearch",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "H-8IIEaaTKm8Lwb_sldclA",
  "version" : {
    "number" : "8.4.3",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "42f05b9372a9a4a470db3b52817899b99a76ee73",
    "build_date" : "2022-10-04T07:17:24.662462378Z",
    "build_snapshot" : false,
    "lucene_version" : "9.3.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

4、启动kibana

# 修改配置文件 config/kibana.yml
server.host: "192.168.0.190"
i18n.locale: "zh-CN"

[es@elasticsearch opt]$ ./kibana/bin/kibana
······
Go to http://192.168.0.190:5601/?code=834817 to get started.
······

打开浏览器,输入上面保存的enrollment token。token保存时间为30分钟,当过期之后,重新生成即可:

[es@elasticsearch opt]$ ./elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana -- url "https://127.0.0.1:9200"
eyJ2ZXIiOiI4LjQuMyIsImFkciI6WyIxOTIuMTY4LjAuMTkwOjkyMDAiXSwiZmdyIjoiNzE2ZTMzMTVlYTljNmJhZjU5NDY4M2YzZDYxZjIxZTBjMDBlOGJjZWFmYTUwMTI0ZWM4MmMzMGVmNmIyNDJhMyIsImtleSI6ImpQTkV5NE1CSjRjd3VLUm1YYW5SOjhiMmp1bEhxUXZDSW9QcTBxeExTTEEifQ==

完成之后,进入登陆界面:

用户密码为elasticsearch的密码,登陆

方式二:docker方式部署

方式三:K8s环境部署

作者:likaifei

出处:https://www.cnblogs.com/likaifei/p/16784945.html

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

posted @   adai_kfl  阅读(114)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
more_horiz
keyboard_arrow_up light_mode palette
选择主题
点击右上角即可分享
微信分享提示