private long getBulkQueueSize() { NodesInfoResponse response = client.admin().cluster().prepareNodesInfo().setThreadPool(true).get(); for (NodeInfo node : response.getNodes()) { Iterator<Info> iterator = node.getThreadPool().iterator(); while (iterator.hasNext()) { Info info = iterator.next(); if ("bulk".equals(info.getName())) { return info.getQueueSize().getSingles(); } } } return DEFAULT_BULK_QUEUE_SIZE; } private boolean isBulkProcessorAvailable() {
@Override public String getNodesInfo() { return client.admin().cluster().prepareNodesInfo().get().toString(); }
@Override public NodeInfo[] getNodeInfo(String clusterName) { Set<Node> nodeSet = nodesClusterMap.get(clusterName); if (nodeSet != null) { for (Node node : nodeSet) { ClusterAdminClient client = node.client().admin().cluster(); NodesInfoResponse response = client.prepareNodesInfo().all().execute().actionGet(); return response.getNodes(); } } return null; }
@Override public NodeInfo[] getNodeInfo(String clusterName) { Set<Node> nodeSet = nodesClusterMap.get(clusterName); if (nodeSet != null) { for (Node node : nodeSet) { ClusterAdminClient client = node.client().admin().cluster(); NodesInfoResponse response = client.prepareNodesInfo().all().execute().actionGet(); return response.getNodes(); } } return null; }
@Override public DiscoveryNode call() throws Exception { return client.admin().cluster().prepareNodesInfo().get().getNodes()[0].getNode(); } }
private Map<String, NodeInfo> fetchNodeInfos() { ClusterAdminClient adminClient = this.client.admin().cluster(); NodesInfoResponse nodesInfoResponse = adminClient.nodesInfo(adminClient.prepareNodesInfo().request()).actionGet(); return nodesInfoResponse.getNodesMap(); }
/** * Returns current address to connect to with HTTP client. * @return hostname/port for HTTP connection */ public TransportAddress httpAddress() { Preconditions.checkState(isStarted, "node is not started"); NodesInfoResponse response = client().admin().cluster().prepareNodesInfo() .execute().actionGet(); if (response.getNodes().size() != 1) { throw new IllegalStateException("Expected single node but got " + response.getNodes().size()); } NodeInfo node = response.getNodes().get(0); return node.getHttp().address().boundAddresses()[0]; }
private boolean checkPluginInstalled(Client client) { NodesInfoResponse nodesInfoResponse = client.admin().cluster().prepareNodesInfo().setPlugins(true).get(); for (NodeInfo nodeInfo : nodesInfoResponse.getNodes()) { for (PluginInfo pluginInfo : nodeInfo.getPlugins().getPluginInfos()) { if ("Vertexium".equals(pluginInfo.getName())) { return true; } } } LOGGER.warn("Running without the server side Vertexium plugin will be deprecated in the future."); return false; }
private boolean checkPluginInstalled(Client client) { NodesInfoResponse nodesInfoResponse = client.admin().cluster().prepareNodesInfo().setPlugins(true).get(); for (NodeInfo nodeInfo : nodesInfoResponse.getNodes()) { for (PluginInfo pluginInfo : nodeInfo.getPlugins().getInfos()) { if ("Vertexium".equals(pluginInfo.getName())) { return true; } } } LOGGER.warn("Running without the server side Vertexium plugin will be deprecated in the future."); return false; }
protected static RestClient createRestClient(RestClientBuilder.HttpClientConfigCallback httpClientConfigCallback, String protocol) { NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo().get(); assertFalse(nodesInfoResponse.hasFailures()); return createRestClient(nodesInfoResponse.getNodes(), httpClientConfigCallback, protocol); }
try { client.addTransportAddresses(transportAddresses); NodesInfoResponse nodeInfos = client.admin().cluster().prepareNodesInfo().clear().setSettings(true).setHttp(true).get(); httpAddresses = new InetSocketAddress[nodeInfos.getNodes().size()]; this.clusterName = nodeInfos.getClusterName().value();
private boolean checkPluginInstalled(Client client) { if (config.isForceDisableVertexiumPlugin()) { LOGGER.info("Forcing the vertexium plugin off. Running without the server side Vertexium plugin will disable some features."); return false; } NodesInfoResponse nodesInfoResponse = client.admin().cluster().prepareNodesInfo().setPlugins(true).get(); for (NodeInfo nodeInfo : nodesInfoResponse.getNodes()) { for (PluginInfo pluginInfo : nodeInfo.getPlugins().getPluginInfos()) { if ("vertexium".equals(pluginInfo.getName())) { return true; } } } if (config.isErrorOnMissingVertexiumPlugin()) { throw new VertexiumException("Vertexium plugin cannot be found"); } LOGGER.warn("Running without the server side Vertexium plugin will disable some features."); return false; }
/** * Returns current address to connect to with HTTP client. * @return hostname/port for HTTP connection */ public TransportAddress httpAddress() { Preconditions.checkState(isStarted, "node is not started"); NodesInfoResponse response = client().admin().cluster().prepareNodesInfo() .execute().actionGet(); if (response.getNodes().size() != 1) { throw new IllegalStateException("Expected single node but got " + response.getNodes().size()); } NodeInfo node = response.getNodes().get(0); return node.getHttp().address().boundAddresses()[0]; }
/** * Returns current address to connect to with HTTP client. * * @return hostname/port for HTTP connection */ public TransportAddress httpAddress() { Preconditions.checkState(isStarted, "node is not started"); NodesInfoResponse response = client().admin().cluster().prepareNodesInfo() .execute().actionGet(); if (response.getNodes().size() != 1) { throw new IllegalStateException("Expected single node but got " + response.getNodes().size()); } NodeInfo node = response.getNodes().get(0); return node.getHttp().address().boundAddresses()[0]; }
private boolean checkPluginInstalled(Client client) { if (config.isForceDisableVertexiumPlugin()) { LOGGER.info("Forcing the vertexium plugin off. Running without the server side Vertexium plugin will disable some features."); return false; } NodesInfoResponse nodesInfoResponse = client.admin().cluster().prepareNodesInfo().setPlugins(true).get(); for (NodeInfo nodeInfo : nodesInfoResponse.getNodes()) { for (PluginInfo pluginInfo : nodeInfo.getPlugins().getPluginInfos()) { if ("vertexium".equals(pluginInfo.getName())) { return true; } } } if (config.isErrorOnMissingVertexiumPlugin()) { throw new VertexiumException("Vertexium plugin cannot be found"); } LOGGER.warn("Running without the server side Vertexium plugin will disable some features."); return false; }
public void testPluginIsLoaded() { NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().setPlugins(true).get(); for (NodeInfo node : response.getNodes()) { boolean founded = false; for (PluginInfo pluginInfo : node.getPlugins().getPluginInfos()) { if (pluginInfo.getName().equals(AnalysisOpenKoreanTextPlugin.class.getName())) { founded = true; } } Assert.assertTrue(founded); } } }
ClusterHealthResponse clusterHealthResponse = index.getClient().admin().cluster().prepareHealth().get(); ClusterStatsResponse clusterStatsResponse = index.getClient().admin().cluster().prepareClusterStats().get(); NodesInfoResponse nodesInfoResponse = index.getClient().admin().cluster().prepareNodesInfo().get(); NodesStatsResponse nodesStatsResponse = index.getClient().admin().cluster().prepareNodesStats().get(); ClusterStateResponse clusterStateResponse = index.getClient().admin().cluster().prepareState().get();
@Test public void testPluginLoaded() { NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo().clear().setPlugins(true).get(); assertTrue(nodesInfoResponse.getNodes().length != 0); assertThat(nodesInfoResponse.getNodes()[0].getPlugins().getPluginInfos(), notNullValue()); assertThat(nodesInfoResponse.getNodes()[0].getPlugins().getPluginInfos().size(), not(0)); boolean pluginFound = false; for (PluginInfo pluginInfo : nodesInfoResponse.getNodes()[0].getPlugins().getPluginInfos()) { if (pluginInfo.getName().equals("SirenJoinPlugin")) { pluginFound = true; break; } } assertThat(pluginFound, is(true)); }
@Test public void testPluginLoaded() { NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo().clear().setPlugins(true).get(); assertTrue(nodesInfoResponse.getNodes().length != 0); assertThat(nodesInfoResponse.getNodes()[0].getPlugins().getInfos(), notNullValue()); assertThat(nodesInfoResponse.getNodes()[0].getPlugins().getInfos().size(), not(0)); boolean pluginFound = false; for (PluginInfo pluginInfo : nodesInfoResponse.getNodes()[0].getPlugins().getInfos()) { if (pluginInfo.getName().equals("siren-plugin")) { pluginFound = true; break; } } assertThat(pluginFound, is(true)); }