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环境部署

原文地址:http://www.cnblogs.com/likaifei/p/16784945.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性