zombodb 几个方便的_cat api

zombodb 暴露所有es _cat/ api 为视图,我们可以通过视图方便的查询es 的信息,默认在zdb的schema 中

包含的视图

几个方便的view

  • 查看索引统计信息zdb.index_stats
select * from zdb.index_stats;
-[ RECORD 1 ]----+-------------------------------------------
alias | postgres.public.products.idxproducts-17176
index_name | 12358.2200.17166.17176-91249167
url | http://elasticsearch:9200/
table_name | products
es_docs | 5
es_size | 23 kB
es_size_bytes | 23297
pg_docs_estimate | 0
pg_size | 32 kB
pg_size_bytes | 32768
shards | 5
replicas | 0
doc_count | 5
aborted_xids | 0
  • 查询es 集群文档信息 zdb.cat_count
select * from zdb.cat_count;
-[ RECORD 1 ]-------------------------
url | http://elasticsearch:9200/
epoch | 1554168344
timestamp | 01:25:44
count | 5
  • 查询es集群状态cat_health
select * from zdb.cat_health;
-[ RECORD 1 ]---------+---------------------------
url | http://elasticsearch:9200/
epoch | 1554168541
timestamp | 01:29:01
cluster | docker-cluster
status | green
node.total | 1
node.data | 1
shards | 5
pri | 5
relo | 0
init | 0
unassign | 0
pending_tasks | 0
max_task_wait_time |
active_shards_percent | 100.0%
  • 查看索引信息 zdb.cat_indices
select * from zdb.cat_indices;
-[ RECORD 1 ]--+-------------------------------------------
url | http://elasticsearch:9200/
health | green
status | open
alias | postgres.public.products.idxproducts-17176
index | 12358.2200.17166.17176-91249167
uuid | 2H5Q20ctSMGrkpIoWSL5ow
pri | 5
rep | 0
docs.count | 5
docs.deleted | 0
store.size | 23297
pri.store.size | 23297
  • es 集群节点属性信息zdb.cat_nodeattrs
-[ RECORD 1 ]---------------------
url | http://elasticsearch:9200/
node | YYRl4wX
host | 172.18.0.2
ip | 172.18.0.2
relo | 0
-[ RECORD 1 ]---------------------
url | http://elasticsearch:9200/
node | YYRl4wX
host | 172.18.0.2
ip | 172.18.0.2
attr | ml.machine_memory
value | 2095869952
-[ RECORD 2 ]---------------------
url | http://elasticsearch:9200/
node | YYRl4wX
host | 172.18.0.2
ip | 172.18.0.2
attr | xpack.installed
value | true
-[ RECORD 3 ]---------------------
url | http://elasticsearch:9200/
node | YYRl4wX
host | 172.18.0.2
ip | 172.18.0.2
attr | ml.max_open_jobs
value | 20
-[ RECORD 4 ]---------------------
url | http://elasticsearch:9200/
node | YYRl4wX
host | 172.18.0.2
ip | 172.18.0.2
attr | ml.enabled
value | true
  • es 集群节点拓扑查看zdb.cat_nodes
select * from zdb.cat_nodes;
url | http://elasticsearch:9200/
id | YYRl
pid | 1
ip | 172.18.0.2
port | 9300
http_address | 172.18.0.2:9200
version | 6.6.0
build | a9861f4
jdk | 11.0.1
disk.total | 62722478080
disk.used | 6214967296
disk.avail | 56507510784
disk.used_percent | 9.91
heap.current | 212820616
heap.percent | 41
heap.max | 518979584
ram.current | 2018529280
ram.percent | 96
ram.max | 2095869952
file_desc.current | 237
file_desc.percent | 0
file_desc.max | 1048576
cpu | 1
.....

说明

zombodb 暴露的视图还是比较多,同时对于es 的信息展示还是很全的

参考资料

https://github.com/zombodb/zombodb/blob/master/CAT-API.md

原文地址:https://www.cnblogs.com/rongfengliang/p/10640774.html