ES版本:elasticsearch-7.15.2

Grafana版本:grafana-8.1.2

Mac安装ES

安装es参考Install Elasticsearch from archive on Linux or MacOS | Elasticsearch Guide [7.15] | Elastic


建议:指定data和logs目录

启动

cd elasticsearch-7.15.2;./bin/elasticsearch -d -p pid

验证

curl http://localhost:9200

响应信息

{
  "name" : "MacBook-Pro.local",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "A5JGCshoT-uoYKVyy6L5Xw",
  "version" : {
    "number" : "7.15.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "93d5a7f6192e8a1a12e154a2b81bf6fa7309da0c",
    "build_date" : "2021-11-04T14:04:42.515624022Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

插入数据到ES

curl -XPUT "http://localhost:9200/twitter/tweet/1"; -H 'Content-Type: application/json' -d'
{
    "user" : "kimchy",
    "post_date" : "2021-11-10T14:12:12",
    "message" : "trying out Elasticsearch"
}'

curl -XPUT "http://localhost:9200/twitter/tweet/2"; -H 'Content-Type: application/json' -d'
{
    "user" : "kimchy2",
    "post_date" : "2021-11-11T01:45:12",
    "message" : "trying out Elasticsearch"
}'

curl -XPUT "http://localhost:9200/twitter/tweet/3"; -H 'Content-Type: application/json' -d'
{
    "user" : "kimchy3",
    "post_date" : "2021-11-11T01:45:12",
    "message" : "trying out Elasticsearch"
}'

配置Grafana数据源

  

post_date在插入数据的时候,指定为"2021-11-10T14:12:12" 格式时,在配置数据源中可识别。默认时间为UTC时间。

数据展示

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐