通达信期货实时数据接口,接口请求的时候,可以附加一个level参数,指定输出信息以indices还是shards级别显示。一般来说,indices级别就够了。
# curl -XGET http://127.0.0.1:9200/_cluster/health?level=indices
{
'cluster_name': 'jiankunking-log',
'status': 'green',
'timed_out': false,
'number_of_nodes': 3,
'number_of_data_nodes': 3,
'active_primary_shards': 2722,
'active_shards': 5444,
'relocating_shards': 0,
'initializing_shards': 0,
'unassigned_shards': 0,
'delayed_unassigned_shards': 0,
'number_of_pending_tasks': 0,
'number_of_in_flight_fetch': 0,
'task_max_waiting_in_queue_millis': 0,
'active_shards_percent_as_number': 100.0,
'indices': {
'metrics-daily-2018-03-19': {
'status': 'green',
'number_of_shards': 6,
'number_of_replicas': 1,
'active_primary_shards': 6,
'active_shards': 12,
'relocating_shards': 0,
'initializing_shards': 0,
'unassigned_shards': 0
},
'metrics-daily-2018-03-14': {
'status': 'green',
'number_of_shards': 6,
'number_of_replicas': 1,
'active_primary_shards': 6,
'active_shards': 12,
'relocating_shards': 0,
'initializing_shards': 0,
'unassigned_shards': 0
},
//......省略其他index.......
}
}
number_of_nodes集群内的总节点数。number_of_data_nodes集群内的总数据节点数。active_primary_shards集群内所有索引的主分片总数。active_shards集群内所有索引的分片总数。relocating_shards正在迁移中的分片数。initializing_shards正在初始化的分片数。unassigned_shards未分配到具体节点上的分片数。delayed_unassigned_shards延时待分配到具体节点上的分片数。
其他数据解释
状态信息
输出里最重要的就是status这行。很多开源的ES监控脚本,其实就是拿这行数据做报警判断。status有三个可能的值:
green绿灯,所有分片都正确运行,集群非常健康。yellow黄灯,所有主分片都正确运行,但是有副本分片缺失。这种情况意味着ES当前还是正常运行的,但是有一定风险。注意,在Kibana4的server端启监控方案启动逻辑中,即使是黄灯状态,Kibana4也会拒绝启动,死循环等待集群状态变成绿灯后才能继续运行。red红灯,有主分片缺失。这部分数据完全不可用。而考虑到ES在写入端是简单的取余算法,轮到这个分片上的数据也会持续写入报错。
level请求参数
一般来说,集群健康通达信期货实时数据接口,接口,还是只用来简单监控一下集群状态是否正常。一旦收到异常报警,具体确定unassignshard的情况,更推荐使用kopf工具在页面查看。
更加详细的获取集群、index信息的通达信期货实时数据接口,接口,可以下载elk-stack-guide-cpdf来查看。
显然,后面4项在正常情况下,一般都应该是0。
命令示例
# curl -XGET 127.0.0.1:9200/_cluster/health?pretty
{
'cluster_name' : 'jiankunking-log',
'status' : 'green',
'timed_out' : false,
'number_of_nodes' : 3,
'number_of_data_nodes' : 3,
'active_primary_shards' : 2722,
'active_shards' : 5444,
'relocating_shards' : 0,
'initializing_shards' : 0,
'unassigned_shards' : 0,
'delayed_unassigned_shards' : 0,
'number_of_pending_tasks' : 0,
'number_of_in_flight_fetch' : 0,
'task_max_waiting_in_queue_millis' : 0,
'active_shards_percent_as_number' : 100.0
}
文章为作者独立观点,不代表股票交易接口观点