你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
jianjianhe
赞同来自: luohuanfeng
//获取单个索引总容量 public String getTotalDisk(String index){ IndicesStatsResponse response = ESUtils .ES_UTILS.getClient().admin().indices().prepareStats(index).execute().actionGet(); CommonStats stats = response.getTotal(); return stats.getStore().getSize().toString(); } //获取主分片总容量 public String getPrimariesDisk(String index){ IndicesStatsResponse response = ESUtils .ES_UTILS.getClient().admin().indices().prepareStats(index).execute().actionGet(); CommonStats commonStats = response.getPrimaries(); return commonStats.getStore().getSize().toString(); }
//获取主/副本分片个数 public Map<String, String> getShardsNum(String index){ Map<String, String> shardsNum = new HashMap<>(); GetSettingsResponse response = ESUtils.ES_UTILS.getClient().admin().indices().prepareGetSettings(index).get(); ImmutableOpenMap<String, Settings> map = response.getIndexToSettings(); for (ObjectObjectCursor<String, Settings> cursor : map) { shardsNum.put("number_of_shards",cursor.value.get("index.number_of_shards")); shardsNum.put("number_of_replicas",cursor.value.get("index.number_of_replicas")); } return shardsNum; }
luohuanfeng
赞同来自:
要回复问题请先登录或注册
3 个回复
jianjianhe
赞同来自: luohuanfeng
jianjianhe
赞同来自: luohuanfeng
luohuanfeng
赞同来自:
这个吗