Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1051308
  • 博文数量: 155
  • 博客积分: 5339
  • 博客等级: 大校
  • 技术积分: 1436
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-10 21:41
文章分类

全部博文(155)

文章存档

2016年(3)

2015年(7)

2014年(3)

2013年(1)

2012年(8)

2011年(5)

2010年(1)

2009年(5)

2008年(4)

2007年(26)

2006年(46)

2005年(46)

分类: Python/Ruby

2015-03-02 17:32:18

  • 获取集群健康状况
curl -XGET ''

点击(此处)折叠或打开

  1. {
  2.   "cluster_name" : "elasticsearch",
  3.   "status" : "green",
  4.   "timed_out" : false,
  5.   "number_of_nodes" : 2,
  6.   "number_of_data_nodes" : 2,
  7.   "active_primary_shards" : 21,
  8.   "active_shards" : 42,
  9.   "relocating_shards" : 0,
  10.   "initializing_shards" : 0,
  11.   "unassigned_shards" : 0
  12. }
三种状态:greenyellow or red,green是最佳状态

详细:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-health.html

  • 集群状态
curl -XGET ''

curl -XGET ''

点击(此处)折叠或打开

  1. {
  2.   "timestamp" : 1425287509927,
  3.   "cluster_name" : "elasticsearch",
  4.   "status" : "green",
  5.   "indices" : {
  6.     "count" : 5,
  7.     "shards" : {
  8.       "total" : 42,
  9.       "primaries" : 21,
  10.       "replication" : 1.0,
  11.       "index" : {
  12.         "shards" : {
  13.           "min" : 2,
  14.           "max" : 10,
  15.           "avg" : 8.4
  16.         },
  17.         "primaries" : {
  18.           "min" : 1,
  19.           "max" : 5,
  20.           "avg" : 4.2
  21.         },
  22.         "replication" : {
  23.           "min" : 1.0,
  24.           "max" : 1.0,
  25.           "avg" : 1.0
  26.         }
  27.       }
  28.     },
  29.     "docs" : {
  30.       "count" : 3480946,
  31.       "deleted" : 0
  32.     },
  33.     "store" : {
  34.       "size" : "2.4gb",
  35.       "size_in_bytes" : 2620079375,
  36.       "throttle_time" : "42.1s",
  37.       "throttle_time_in_millis" : 42110
  38.     },
  39.     "fielddata" : {
  40.       "memory_size" : "14.4mb",
  41.       "memory_size_in_bytes" : 15127000,
  42.       "evictions" : 0
  43.     },
  44.     "filter_cache" : {
  45.       "memory_size" : "8.3mb",
  46.       "memory_size_in_bytes" : 8737648,
  47.       "evictions" : 0
  48.     },
  49.     "id_cache" : {
  50.       "memory_size" : "0b",
  51.       "memory_size_in_bytes" : 0
  52.     },
  53.     "completion" : {
  54.       "size" : "0b",
  55.       "size_in_bytes" : 0
  56.     },
  57.     "segments" : {
  58.       "count" : 302,
  59.       "memory" : "15.8mb",
  60.       "memory_in_bytes" : 16608228,
  61.       "index_writer_memory" : "745kb",
  62.       "index_writer_memory_in_bytes" : 762964,
  63.       "index_writer_max_memory" : "215.3mb",
  64.       "index_writer_max_memory_in_bytes" : 225810835,
  65.       "version_map_memory" : "20.7kb",
  66.       "version_map_memory_in_bytes" : 21248,
  67.       "fixed_bit_set" : "0b",
  68.       "fixed_bit_set_memory_in_bytes" : 0
  69.     },
  70.     "percolate" : {
  71.       "total" : 0,
  72.       "get_time" : "0s",
  73.       "time_in_millis" : 0,
  74.       "current" : 0,
  75.       "memory_size_in_bytes" : -1,
  76.       "memory_size" : "-1b",
  77.       "queries" : 0
  78.     }
  79.   },
  80.   "nodes" : {
  81.     "count" : {
  82.       "total" : 2,
  83.       "master_only" : 0,
  84.       "data_only" : 0,
  85.       "master_data" : 2,
  86.       "client" : 0
  87.     },
  88.     "versions" : [ "1.4.4" ],
  89.     "os" : {
  90.       "available_processors" : 10,
  91.       "mem" : {
  92.         "total" : "17.5gb",
  93.         "total_in_bytes" : 18815172608
  94.       },
  95.       "cpu" : [ {
  96.         "vendor" : "Intel",
  97.         "model" : "Xeon",
  98.         "mhz" : 2132,
  99.         "total_cores" : 2,
  100.         "total_sockets" : 1,
  101.         "cores_per_socket" : 2,
  102.         "cache_size" : "4kb",
  103.         "cache_size_in_bytes" : 4096,
  104.         "count" : 2
  105.       } ]
  106.     },
  107.     "process" : {
  108.       "cpu" : {
  109.         "percent" : 51
  110.       },
  111.       "open_file_descriptors" : {
  112.         "min" : 569,
  113.         "max" : 658,
  114.         "avg" : 613
  115.       }
  116.     },
  117.     "jvm" : {
  118.       "max_uptime" : "1.1h",
  119.       "max_uptime_in_millis" : 4113718,
  120.       "versions" : [ {
  121.         "version" : "1.7.0_71",
  122.         "vm_name" : "Java HotSpot(TM) 64-Bit Server VM",
  123.         "vm_version" : "24.71-b01",
  124.         "vm_vendor" : "Oracle Corporation",
  125.         "count" : 2
  126.       } ],
  127.       "mem" : {
  128.         "heap_used" : "333.6mb",
  129.         "heap_used_in_bytes" : 349883472,
  130.         "heap_max" : "1.9gb",
  131.         "heap_max_in_bytes" : 2094268416
  132.       },
  133.       "threads" : 164
  134.     },
  135.     "fs" : {
  136.       "total" : "394.3gb",
  137.       "total_in_bytes" : 423468793856,
  138.       "free" : "357.1gb",
  139.       "free_in_bytes" : 383441518592,
  140.       "available" : "337gb",
  141.       "available_in_bytes" : 361930506240,
  142.       "disk_reads" : 247722,
  143.       "disk_writes" : 7457226,
  144.       "disk_io_op" : 7704948,
  145.       "disk_read_size" : "6.6gb",
  146.       "disk_read_size_in_bytes" : 7187396608,
  147.       "disk_write_size" : "287.7gb",
  148.       "disk_write_size_in_bytes" : 308939509760,
  149.       "disk_io_size" : "294.4gb",
  150.       "disk_io_size_in_bytes" : 316126906368,
  151.       "disk_queue" : "0",
  152.       "disk_service_time" : "4.2"
  153.     },
  154.     "plugins" : [ {
  155.       "name" : "analysis-ik",
  156.       "version" : "${project.version}",
  157.       "description" : "ik analysis",
  158.       "jvm" : true,
  159.       "site" : false
  160.     } ]
  161.   }
  162. }
详细:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-state.html
   http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-stats.html
  • 节点状态
curl -XGET ''
curl -XGET ''

点击(此处)折叠或打开

  1. {
  2.   "cluster_name" : "elasticsearch",
  3.   "nodes" : {
  4.     "ix5k_7JEQLGlKzIWCRgeEg" : {
  5.       "timestamp" : 1425288033283,
  6.       "name" : "Maxam",
  7.       "transport_address" : "inet[/192.168.167.1:9300]",
  8.       "host" : "host1",
  9.       "ip" : [ "inet[/192.168.167.1:9300]", "NONE" ],
  10.       "os" : {
  11.         "timestamp" : 1425288033283,
  12.         "uptime_in_millis" : 5380471,
  13.         "load_average" : [ 0.28, 0.43, 0.43 ],
  14.         "cpu" : {
  15.           "sys" : 2,
  16.           "user" : 20,
  17.           "idle" : 77,
  18.           "usage" : 22,
  19.           "stolen" : 0
  20.         },
  21.         "mem" : {
  22.           "free_in_bytes" : 92459008,
  23.           "used_in_bytes" : 2011693056,
  24.           "free_percent" : 34,
  25.           "used_percent" : 65,
  26.           "actual_free_in_bytes" : 721952768,
  27.           "actual_used_in_bytes" : 1382199296
  28.         },
  29.         "swap" : {
  30.           "used_in_bytes" : 158756864,
  31.           "free_in_bytes" : 4136202240
  32.         }
  33.       },
  34.       "process" : {
  35.         "timestamp" : 1425288033284,
  36.         "open_file_descriptors" : 557,
  37.         "cpu" : {
  38.           "percent" : 26,
  39.           "sys_in_millis" : 108140,
  40.           "user_in_millis" : 1093120,
  41.           "total_in_millis" : 1201260
  42.         },
  43.         "mem" : {
  44.           "resident_in_bytes" : 439296000,
  45.           "share_in_bytes" : 13516800,
  46.           "total_virtual_in_bytes" : 2728906752
  47.         }
  48.       }
  49.     },
  50.     "SKk2NEreQ2GiTnm_U176Wg" : {
  51.       "timestamp" : 1425288078666,
  52.       "name" : "Vindaloo",
  53.       "transport_address" : "inet[/192.168.167.2:9300]",
  54.       "host" : "host2",
  55.       "ip" : [ "inet[/192.168.167.2:9300]", "NONE" ],
  56.       "os" : {
  57.         "timestamp" : 1425288078666,
  58.         "uptime_in_millis" : 5685033,
  59.         "load_average" : [ 0.04, 0.21, 0.17 ],
  60.         "cpu" : {
  61.           "sys" : 0,
  62.           "user" : 2,
  63.           "idle" : 96,
  64.           "usage" : 2,
  65.           "stolen" : 0
  66.         },
  67.         "mem" : {
  68.           "free_in_bytes" : 7614054400,
  69.           "used_in_bytes" : 9096966144,
  70.           "free_percent" : 80,
  71.           "used_percent" : 19,
  72.           "actual_free_in_bytes" : 13409837056,
  73.           "actual_used_in_bytes" : 3301183488
  74.         },
  75.         "swap" : {
  76.           "used_in_bytes" : 0,
  77.           "free_in_bytes" : 8589926400
  78.         }
  79.       },
  80.       "process" : {
  81.         "timestamp" : 1425288078667,
  82.         "open_file_descriptors" : 660,
  83.         "cpu" : {
  84.           "percent" : 23,
  85.           "sys_in_millis" : 98870,
  86.           "user_in_millis" : 1269750,
  87.           "total_in_millis" : 1368620
  88.         },
  89.         "mem" : {
  90.           "resident_in_bytes" : 497192960,
  91.           "share_in_bytes" : 17502208,
  92.           "total_virtual_in_bytes" : 5988392960
  93.         }
  94.       }
  95.     }
  96.   }
  97. }

curl -XGET ''
curl -XGET ''
curl -XGET ''
curl -XGET ''

详细:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html
   http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html
  • 本机节点查询
curl -XGET 'localhost:9200/_nodes/_local?pretty'
curl -XGET 'localhost:9200/_nodes/_local/network?pretty'

点击(此处)折叠或打开

  1. {
  2.   "cluster_name" : "elasticsearch",
  3.   "nodes" : {
  4.     "ix5k_7JEQLGlKzIWCRgeEg" : {
  5.       "name" : "Maxam",
  6.       "transport_address" : "inet[/192.168.167.1:9300]",
  7.       "host" : "host1",
  8.       "ip" : "192.168.167.1",
  9.       "version" : "1.4.4",
  10.       "build" : "c88f77f",
  11.       "http_address" : "inet[/192.168.167.1:9200]",
  12.       "network" : {
  13.         "refresh_interval_in_millis" : 5000,
  14.         "primary_interface" : {
  15.           "address" : "192.168.167.1",
  16.           "name" : "bond0",
  17.           "mac_address" : "00:56:50:94:63:12"
  18.         }
  19.       }
  20.     }
  21.   }
  22. }

以上所有查询都可以针对json节点的子节点进行查询,关键词如:settingsosprocessjvmthread_poolnetworktransporthttp , plugins
例如:
curl -XGET ''
curl -XGET ''
curl -XGET ''
curl -XGET ''


阅读(18637) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~