1. ElasticSearch 下载
Get Started with Elasticsearch, Kibana, and the Elastic Stack | Elastic
当然你也可以下载Kabana
2. 下载后解压
3. 打开config/elasticsearch.yml文件,修改下面参数为false
xpack.security.enabled: false
4. 通过下面命令启动ElasticSearch.
binelasticsearch
5. 通过访问下面URL查看ElasticEearch是否运行正常.
http://localhost:9200/
6. 查看集群健康: localhost:9200/_cat/health?v
我们可以看到,我们命名为“elasticsearch”的集群现在是green状态。
无论何时我们请求集群健康时,我们会得到green, yellow, 或者 red 这三种状态。
Green : everything is good(一切都很好)(所有功能正常)Yellow : 所有数据都是可用的,但有些副本还没有分配(所有功能正常)Red : 有些数据不可用(部分功能正常)
从上面的响应中我们可以看到,集群"elasticsearch"总共有1个节点,0个分片因为还没有数据。
7. 下面看一下集群的节点列表:
http://localhost:9200/_cat/nodes?v
可以看到集群中只有一个节点,它的名字是“DESKTOP-T4TU7JE”
8. 查看全部索引
localhost:9200/_cat/indices?v
9.查看索引的设置参数
http://localhost:9200/.ds-metrics-2022-02-2022.02.13-000001?pretty
10. 查看具体某个索引的内容
http://localhost:9200/micrometer-metrics-2022-02/_search?pretty.ds-metrics-2022-02-2022.02.13-000001http://localhost:9200/micrometer-metrics-2022-02/_search?pretty
安装Kibana
启动Kibana:
binkibana.bat
访问Kibana
http://localhost:5601/
如果你用Spring boot, 在pom.xml加入依赖。
io.micrometer micrometer-registry-elastic
在application.properties加入
management.metrics.export.elastic.enabled=true
management.metrics.export.elastic.host=http://localhost:9200
management.metrics.export.elastic.index=micrometer-metrics1
management.metrics.export.elastic.userName=***
management.metrics.export.elastic.password=***
启动项目就后,既可以看到ElasticSearch里有索引micrometer-metrics1创建了
参考资料
Elasticsearch 快速开始 - 废物大师兄 - 博客园



