當前位置: 首頁>>代碼示例>>Java>>正文


Java NodesInfoRequest類代碼示例

本文整理匯總了Java中org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest的典型用法代碼示例。如果您正苦於以下問題:Java NodesInfoRequest類的具體用法?Java NodesInfoRequest怎麽用?Java NodesInfoRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NodesInfoRequest類屬於org.elasticsearch.action.admin.cluster.node.info包,在下文中一共展示了NodesInfoRequest類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doCatRequest

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(false).os(false).process(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestResponseListener<NodesInfoResponse>(channel) {
                @Override
                public RestResponse buildResponse(NodesInfoResponse nodesInfoResponse) throws Exception {
                    return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse), channel);
                }
            });
        }
    });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:22,代碼來源:RestNodeAttrsAction.java

示例2: doCatRequest

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) throws Exception {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().plugins(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestResponseListener<NodesInfoResponse>(channel) {
                @Override
                public RestResponse buildResponse(final NodesInfoResponse nodesInfoResponse) throws Exception {
                    return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse), channel);
                }
            });
        }
    });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:22,代碼來源:RestPluginsAction.java

示例3: doRequest

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) throws Exception {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().plugins(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestResponseListener<NodesInfoResponse>(channel) {
                @Override
                public RestResponse buildResponse(final NodesInfoResponse nodesInfoResponse) throws Exception {
                    return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse), channel);
                }
            });
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:22,代碼來源:RestPluginsAction.java

示例4: testNodeClientAllowedWithServerCertificate

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@SuppressWarnings("resource")
@Test
public void testNodeClientAllowedWithServerCertificate() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());

    
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(4, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
開發者ID:floragunncom,項目名稱:search-guard,代碼行數:25,代碼來源:IntegrationTests.java

示例5: testNodeClientDisallowedWithNonServerCertificate

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@SuppressWarnings("resource")
@Test
public void testNodeClientDisallowedWithNonServerCertificate() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());

    
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .put("searchguard.ssl.transport.keystore_filepath", FileHelper.getAbsoluteFilePathFromClassPath("kirk-keystore.jks"))
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS,"kirk")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(1, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
開發者ID:floragunncom,項目名稱:search-guard,代碼行數:27,代碼來源:IntegrationTests.java

示例6: testNodeClientDisallowedWithNonServerCertificate2

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@SuppressWarnings("resource")
@Test
public void testNodeClientDisallowedWithNonServerCertificate2() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());
 
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .put("searchguard.ssl.transport.keystore_filepath", FileHelper.getAbsoluteFilePathFromClassPath("spock-keystore.jks"))
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS,"spock")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(1, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
開發者ID:floragunncom,項目名稱:search-guard,代碼行數:26,代碼來源:IntegrationTests.java

示例7: testTransportClientImpersonationWildcard

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Test
public void testTransportClientImpersonationWildcard() throws Exception {

    final Settings settings = Settings.builder()
            .putList("searchguard.authcz.impersonation_dn.CN=spock,OU=client,O=client,L=Test,C=DE", "*")
            .build();

    
    setup(settings);
    
    Settings tcSettings = Settings.builder()
            .put("searchguard.ssl.transport.keystore_filepath", FileHelper.getAbsoluteFilePathFromClassPath("spock-keystore.jks"))
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS,"spock")
            .put("path.home", ".")
            .put("request.headers.sg_impersonate_as", "worf")
            .build();
    
    try (TransportClient tc = getInternalTransportClient(clusterInfo, tcSettings)) {
        NodesInfoRequest nir = new NodesInfoRequest();
        Assert.assertEquals(3, tc.admin().cluster().nodesInfo(nir).actionGet().getNodes().size());
    }        
}
 
開發者ID:floragunncom,項目名稱:search-guard,代碼行數:23,代碼來源:IntegrationTests.java

示例8: getHttpPort

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
private static String getHttpPort(Node node) throws InterruptedException, ExecutionException {
  String nodes =
      node.client().admin().cluster().nodesInfo(new NodesInfoRequest("*")).get().toString();
  Gson gson =
      new GsonBuilder()
          .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
          .create();
  Info info = gson.fromJson(nodes, Info.class);
  if (info.nodes == null || info.nodes.size() != 1) {
    throw new RuntimeException("Cannot extract local Elasticsearch http port");
  }
  Iterator<NodeInfo> values = info.nodes.values().iterator();
  String httpAddress = values.next().httpAddress;
  if (Strings.isNullOrEmpty(httpAddress)) {
    throw new RuntimeException("Cannot extract local Elasticsearch http port");
  }
  if (httpAddress.indexOf(':') < 0) {
    throw new RuntimeException("Seems that port is not included in Elasticsearch http_address");
  }
  return httpAddress.substring(httpAddress.indexOf(':') + 1, httpAddress.length());
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:22,代碼來源:ElasticTestUtils.java

示例9: ElasticsearchInsert

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
public ElasticsearchInsert(KafkaStream stream, String esHost, int threadNum, int bulkSize, String esCluster) {
  this.stream = stream;
  this.threadNum = threadNum;
  this.bulkSize = bulkSize;
  elasticSearchCluster = esCluster;
  elasticSearchHost = esHost;
  Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", elasticSearchCluster).build();
  client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(elasticSearchHost, elasticSearchPort));
  NodesInfoResponse response = client.admin().cluster().nodesInfo(new NodesInfoRequest().timeout("60")).actionGet();
  nodesMap = response.getNodesMap();
  for(String k: nodesMap.keySet()){
    if(!elasticSearchHost.equals(nodesMap.get(k).getHostname())) {
     client.addTransportAddress(new InetSocketTransportAddress(nodesMap.get(k).getHostname(), elasticSearchPort));
    }
  }
  LOG.info("init es");
}
 
開發者ID:wking1986,項目名稱:kafka2elasticsearch,代碼行數:18,代碼來源:ElasticsearchInsert.java

示例10: testNodeBasedClientCanConnectToES

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Test
public void testNodeBasedClientCanConnectToES() {
    System.setProperty(ConfigurationConstants.PROPNAME_ES_CLIENT_TYPE, "node");
    Configuration config = new SystemPropertiesConfiguration();

    esServer = new ElasticSearchServer(clusterName,false);
    assertTrue("Unable to start in memory elastic search", esServer.isSetup());

    try {
        ElasticSearchClientFactory factory = clientFactoryCreator.getElasticSearchClientConnectionFactory(config);
        Client c = factory.getClient();
        assertEquals(config.getStorageClusterName(), c.admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getClusterName().value());

        assertNotNull(c.index(new IndexRequest("test", "test").source("name", "a")).actionGet().getId());
        c.admin().indices().refresh(new RefreshRequest("test").force(true)).actionGet();

        assertEquals(1, c.admin().indices().stats(new IndicesStatsRequest().indices("test")).actionGet().getTotal().docs.getCount());
    } catch(Exception e) {
        e.printStackTrace();
        fail("Unable to connect to elasticsearch: " + e.getMessage());
    }
}
 
開發者ID:tootedom,項目名稱:related,代碼行數:23,代碼來源:NodeOrTransportBasedElasticSearchClientFactoryCreatorTest.java

示例11: getInfoFromEsClient

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
private void getInfoFromEsClient(Client client, Map<Object, Object> ret, String name) {
	try {
		XContentBuilder builder = XContentFactory.jsonBuilder();
		builder.startObject();
		builder.field("nodes_info");
		builder.startObject();
		client.admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet()
				.toXContent(builder, ToXContent.EMPTY_PARAMS);
		builder.endObject();
		builder.endObject();
		builder.close();
		ret.put(name, SearchUtils.convertToJsonMap(builder.string()));
	} catch (Exception e) {
		ret.put(name, e.getMessage());
	}
}
 
開發者ID:searchisko,項目名稱:searchisko,代碼行數:17,代碼來源:SystemInfoService.java

示例12: doCatRequest

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
    final boolean fullId = request.paramAsBoolean("full_id", false);
    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(true).os(true).process(true).http(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(true).os(true).fs(true).indices(true).process(true).script(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(fullId, request, clusterStateResponse, nodesInfoResponse,
                                nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:30,代碼來源:RestNodesAction.java

示例13: doCatRequest

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().process(true).threadPool(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().threadPool(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:29,代碼來源:RestThreadPoolAction.java

示例14: doRequest

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(false).os(false).process(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(false).os(false).fs(false).indices(false).process(false);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:29,代碼來源:RestNodeAttrsAction.java

示例15: doRequest

import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; //導入依賴的package包/類
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(true).os(true).process(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(true).os(true).fs(true).indices(true).process(true).script(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:29,代碼來源:RestNodesAction.java


注:本文中的org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。