当前位置: 首页>>代码示例>>Java>>正文


Java NodeInfo类代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.cluster.node.info.NodeInfo的典型用法代码示例。如果您正苦于以下问题:Java NodeInfo类的具体用法?Java NodeInfo怎么用?Java NodeInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodeInfo类属于org.elasticsearch.action.admin.cluster.node.info包,在下文中一共展示了NodeInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildTable

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo) {
    boolean fullId = req.paramAsBoolean("full_id", false);

    DiscoveryNodes nodes = state.getState().nodes();
    Table table = getTableWithHeader(req);

    for (DiscoveryNode node : nodes) {
        NodeInfo info = nodesInfo.getNodesMap().get(node.getId());
        for (Map.Entry<String, String> attrEntry : node.getAttributes().entrySet()) {
            table.startRow();
            table.addCell(node.getName());
            table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
            table.addCell(info == null ? null : info.getProcess().getId());
            table.addCell(node.getHostName());
            table.addCell(node.getHostAddress());
            table.addCell(node.getAddress().address().getPort());
            table.addCell(attrEntry.getKey());
            table.addCell(attrEntry.getValue());
            table.endRow();
        }
    }
    return table;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:RestNodeAttrsAction.java

示例2: buildTable

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo) {
    DiscoveryNodes nodes = state.getState().nodes();
    Table table = getTableWithHeader(req);

    for (DiscoveryNode node : nodes) {
        NodeInfo info = nodesInfo.getNodesMap().get(node.getId());

        for (PluginInfo pluginInfo : info.getPlugins().getPluginInfos()) {
            table.startRow();
            table.addCell(node.getId());
            table.addCell(node.getName());
            table.addCell(pluginInfo.getName());
            table.addCell(pluginInfo.getVersion());
            table.addCell(pluginInfo.getDescription());
            table.endRow();
        }
    }

    return table;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:RestPluginsAction.java

示例3: testClusterUpdateSettingsNoAcknowledgement

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
public void testClusterUpdateSettingsNoAcknowledgement() {
    client().admin().indices().prepareCreate("test")
            .setSettings(Settings.builder()
                    .put("number_of_shards", between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS))
                    .put("number_of_replicas", 0)).get();
    ensureGreen();

    // now that the cluster is stable, remove timeout
    removePublishTimeout();

    NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().get();
    String excludedNodeId = null;
    for (NodeInfo nodeInfo : nodesInfo.getNodes()) {
        if (nodeInfo.getNode().isDataNode()) {
            excludedNodeId = nodeInfo.getNode().getId();
            break;
        }
    }
    assertNotNull(excludedNodeId);

    ClusterUpdateSettingsResponse clusterUpdateSettingsResponse = client().admin().cluster().prepareUpdateSettings().setTimeout("0s")
            .setTransientSettings(Settings.builder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get();
    assertThat(clusterUpdateSettingsResponse.isAcknowledged(), equalTo(false));
    assertThat(clusterUpdateSettingsResponse.getTransientSettings().get("cluster.routing.allocation.exclude._id"), equalTo(excludedNodeId));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:AckClusterUpdateSettingsIT.java

示例4: nodeOperation

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
@Override
protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeRequest) {
    NodeInfo nodeInfo = nodeService.info(false, true, false, true, false, true, false, true);
    NodeStats nodeStats = nodeService.stats(CommonStatsFlags.NONE, true, true, true, false, true, false, false, false, false);
    List<ShardStats> shardsStats = new ArrayList<>();
    for (IndexService indexService : indicesService) {
        for (IndexShard indexShard : indexService) {
            if (indexShard.routingEntry() != null && indexShard.routingEntry().active()) {
                // only report on fully started shards
                shardsStats.add(new ShardStats(indexShard.routingEntry(), indexShard.shardPath(), new CommonStats(indexShard, SHARD_STATS_FLAGS), indexShard.commitStats()));
            }
        }
    }

    ClusterHealthStatus clusterStatus = null;
    if (clusterService.state().nodes().localNodeMaster()) {
        clusterStatus = new ClusterStateHealth(clusterService.state()).getStatus();
    }

    return new ClusterStatsNodeResponse(nodeInfo.getNode(), clusterStatus, nodeInfo, nodeStats, shardsStats.toArray(new ShardStats[shardsStats.size()]));

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:TransportClusterStatsAction.java

示例5: testTransportClient

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
public void testTransportClient() throws Exception {
    NodesInfoResponse nodeInfos = client().admin().cluster().prepareNodesInfo().get();
    List<NodeInfo>  nodes = nodeInfos.getNodes();
    assertTrue(nodes.size() > 0);
    TransportAddress publishAddress = randomFrom(nodes).getTransport().address().publishAddress();
    String clusterName = nodeInfos.getClusterName().value();

    Settings settings = Settings.builder()
            .put("cluster.name", clusterName)
            .put(ThreadContext.PREFIX + "." + CustomRealm.USER_HEADER, randomFrom(KNOWN_USERS))
            .put(ThreadContext.PREFIX + "." + CustomRealm.PW_HEADER, PASSWORD)
            .build();
    try (TransportClient client = new PreBuiltXPackTransportClient(settings)) {
        client.addTransportAddress(publishAddress);
        ClusterHealthResponse response = client.admin().cluster().prepareHealth().execute().actionGet();
        assertThat(response.isTimedOut(), is(false));
    }
}
 
开发者ID:elastic,项目名称:shield-custom-realm-example,代码行数:19,代码来源:CustomRealmIT.java

示例6: setUpClient

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
@Before
public void setUpClient() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException {
    NodeInfo[] nodes = admin().cluster().nodesInfo(Requests.nodesInfoRequest()).actionGet().getNodes();
    Assert.assertThat(nodes.length, Matchers.greaterThanOrEqualTo(1));

    TransportAddress transportAddress = nodes[0].getHttp().getAddress().publishAddress();
    Assert.assertEquals(InetSocketTransportAddress.class, transportAddress.getClass());
    InetSocketTransportAddress inetSocketTransportAddress = (InetSocketTransportAddress) transportAddress;
    InetSocketAddress socketAddress = inetSocketTransportAddress.address();

    String url = String.format("http://%s:%d", socketAddress.getHostName(), socketAddress.getPort());
    httpClient = new HttpClient(Collections.singleton(url));

    createIndex("the_index");
    ensureSearchable("the_index");
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:17,代码来源:DeleteIndexActionHandlerTest.java

示例7: nodeOperation

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
@Override
protected NodeRiverExecuteResponse nodeOperation(NodeRiverExecuteRequest request) throws ElasticsearchException {
    NodeInfo nodeInfo = nodeService.info(false, true, false, true, false, false, true, false, true);
    String riverType = request.getRiverType();
    String riverName = request.getRiverName();
    for (Map.Entry<RiverName, River> entry : RiverHelper.rivers(injector).entrySet()) {
        RiverName name = entry.getKey();
        if ((riverName == null || name.getName().equals(riverName))
                && (riverType == null || name.getType().equals(riverType))
                && entry.getValue() instanceof RunnableRiver) {
            RunnableRiver river = (RunnableRiver) entry.getValue();
            river.run();
            return new NodeRiverExecuteResponse(nodeInfo.getNode()).setExecuted(true);
        }
    }
    return new NodeRiverExecuteResponse(nodeInfo.getNode()).setExecuted(false);
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:18,代码来源:TransportRiverExecuteAction.java

示例8: testPluginIsLoaded

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
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);
    }
}
 
开发者ID:open-korean-text,项目名称:elasticsearch-analysis-openkoreantext,代码行数:13,代码来源:AnalysisOpenKoreanTextPluginTest.java

示例9: checkPluginInstalled

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
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 ("memgraph".equals(pluginInfo.getName())) {
                return true;
            }
        }
    }
    if (config.isErrorOnMissingMemgraphPlugin()) {
        throw new MemgraphException("Memgraph plugin cannot be found");
    }
    LOGGER.warn("Running without the server side Memgraph plugin will be deprecated in the future.");
    return false;
}
 
开发者ID:mware-solutions,项目名称:memory-graph,代码行数:16,代码来源:Elasticsearch5SearchIndex.java

示例10: testDifferentPorts

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
public void testDifferentPorts() throws Exception {
    if (!NetworkUtils.SUPPORTS_V6) {
        return;
    }
    logger.info("--> starting a node on ipv4 only");
    Settings ipv4Settings = Settings.builder().put("network.host", "127.0.0.1").build();
    String ipv4OnlyNode = internalCluster().startNode(ipv4Settings); // should bind 127.0.0.1:XYZ

    logger.info("--> starting a node on ipv4 and ipv6");
    Settings bothSettings = Settings.builder().put("network.host", "_local_").build();
    internalCluster().startNode(bothSettings); // should bind [::1]:XYZ and 127.0.0.1:XYZ+1

    logger.info("--> waiting for the cluster to declare itself stable");
    ensureStableCluster(2); // fails if port of publish address does not match corresponding bound address

    logger.info("--> checking if boundAddress matching publishAddress has same port");
    NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo().get();
    for (NodeInfo nodeInfo : nodesInfoResponse.getNodes()) {
        BoundTransportAddress boundTransportAddress = nodeInfo.getTransport().getAddress();
        if (nodeInfo.getNode().getName().equals(ipv4OnlyNode)) {
            assertThat(boundTransportAddress.boundAddresses().length, equalTo(1));
            assertThat(boundTransportAddress.boundAddresses()[0].getPort(), equalTo(boundTransportAddress.publishAddress().getPort()));
        } else {
            assertThat(boundTransportAddress.boundAddresses().length, greaterThan(1));
            for (TransportAddress boundAddress : boundTransportAddress.boundAddresses()) {
                assertThat(boundAddress, instanceOf(TransportAddress.class));
                TransportAddress inetBoundAddress = (TransportAddress) boundAddress;
                if (inetBoundAddress.address().getAddress() instanceof Inet4Address) {
                    // IPv4 address is preferred publish address for _local_
                    assertThat(inetBoundAddress.getPort(), equalTo(boundTransportAddress.publishAddress().getPort()));
                }
            }
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:36,代码来源:Netty4TransportPublishAddressIT.java

示例11: testReindexFromRemote

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
public void testReindexFromRemote() throws Exception {
    NodeInfo nodeInfo = client().admin().cluster().prepareNodesInfo().get().getNodes().get(0);
    TransportAddress address = nodeInfo.getHttp().getAddress().publishAddress();
    RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null,
        null, emptyMap(), RemoteInfo.DEFAULT_SOCKET_TIMEOUT, RemoteInfo.DEFAULT_CONNECT_TIMEOUT);
    ReindexRequestBuilder request = ReindexAction.INSTANCE.newRequestBuilder(client()).source("source").destination("dest")
            .setRemoteInfo(remote);
    testCase(ReindexAction.NAME, request, matcher().created(DOC_COUNT));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:RetryTests.java

示例12: info

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
public NodeInfo info(boolean settings, boolean os, boolean process, boolean jvm, boolean threadPool,
            boolean transport, boolean http, boolean plugin, boolean ingest, boolean indices) {
    return new NodeInfo(Version.CURRENT, Build.CURRENT, discovery.localNode(),
            settings ? settingsFilter.filter(this.settings) : null,
            os ? monitorService.osService().info() : null,
            process ? monitorService.processService().info() : null,
            jvm ? monitorService.jvmService().info() : null,
            threadPool ? this.threadPool.info() : null,
            transport ? transportService.info() : null,
            http ? (httpServerTransport == null ? null : httpServerTransport.info()) : null,
            plugin ? (pluginService == null ? null : pluginService.info()) : null,
            ingest ? (ingestService == null ? null : ingestService.info()) : null,
            indices ? indicesService.getTotalIndexingBufferBytes() : null
    );
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:NodeService.java

示例13: nodeOperation

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
@Override
protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeRequest) {
    NodeInfo nodeInfo = nodeService.info(true, true, false, true, false, true, false, true, false, false);
    NodeStats nodeStats = nodeService.stats(CommonStatsFlags.NONE, true, true, true, false, true, false, false, false, false, false, false);
    List<ShardStats> shardsStats = new ArrayList<>();
    for (IndexService indexService : indicesService) {
        for (IndexShard indexShard : indexService) {
            if (indexShard.routingEntry() != null && indexShard.routingEntry().active()) {
                // only report on fully started shards
                shardsStats.add(
                    new ShardStats(
                        indexShard.routingEntry(),
                        indexShard.shardPath(),
                        new CommonStats(indicesService.getIndicesQueryCache(), indexShard, SHARD_STATS_FLAGS),
                        indexShard.commitStats(),
                        indexShard.seqNoStats()));
            }
        }
    }

    ClusterHealthStatus clusterStatus = null;
    if (clusterService.state().nodes().isLocalNodeElectedMaster()) {
        clusterStatus = new ClusterStateHealth(clusterService.state()).getStatus();
    }

    return new ClusterStatsNodeResponse(nodeInfo.getNode(), clusterStatus, nodeInfo, nodeStats, shardsStats.toArray(new ShardStats[shardsStats.size()]));

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:TransportClusterStatsAction.java

示例14: ClusterStatsNodes

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
ClusterStatsNodes(List<ClusterStatsNodeResponse> nodeResponses) {
    this.versions = new HashSet<>();
    this.fs = new FsInfo.Path();
    this.plugins = new HashSet<>();

    Set<InetAddress> seenAddresses = new HashSet<>(nodeResponses.size());
    List<NodeInfo> nodeInfos = new ArrayList<>();
    List<NodeStats> nodeStats = new ArrayList<>();
    for (ClusterStatsNodeResponse nodeResponse : nodeResponses) {
        nodeInfos.add(nodeResponse.nodeInfo());
        nodeStats.add(nodeResponse.nodeStats());
        this.versions.add(nodeResponse.nodeInfo().getVersion());
        this.plugins.addAll(nodeResponse.nodeInfo().getPlugins().getPluginInfos());

        // now do the stats that should be deduped by hardware (implemented by ip deduping)
        TransportAddress publishAddress = nodeResponse.nodeInfo().getTransport().address().publishAddress();
        final InetAddress inetAddress = publishAddress.address().getAddress();
        if (!seenAddresses.add(inetAddress)) {
            continue;
        }
        if (nodeResponse.nodeStats().getFs() != null) {
            this.fs.add(nodeResponse.nodeStats().getFs().getTotal());
        }
    }
    this.counts = new Counts(nodeInfos);
    this.os = new OsStats(nodeInfos, nodeStats);
    this.process = new ProcessStats(nodeStats);
    this.jvm = new JvmStats(nodeInfos, nodeStats);
    this.networkTypes = new NetworkTypes(nodeInfos);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:ClusterStatsNodes.java

示例15: OsStats

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; //导入依赖的package包/类
/**
 * Build the stats from information about each node.
 */
private OsStats(List<NodeInfo> nodeInfos, List<NodeStats> nodeStatsList) {
    this.names = new ObjectIntHashMap<>();
    int availableProcessors = 0;
    int allocatedProcessors = 0;
    for (NodeInfo nodeInfo : nodeInfos) {
        availableProcessors += nodeInfo.getOs().getAvailableProcessors();
        allocatedProcessors += nodeInfo.getOs().getAllocatedProcessors();

        if (nodeInfo.getOs().getName() != null) {
            names.addTo(nodeInfo.getOs().getName(), 1);
        }
    }
    this.availableProcessors = availableProcessors;
    this.allocatedProcessors = allocatedProcessors;

    long totalMemory = 0;
    long freeMemory = 0;
    for (NodeStats nodeStats : nodeStatsList) {
        if (nodeStats.getOs() != null) {
            long total = nodeStats.getOs().getMem().getTotal().getBytes();
            if (total > 0) {
                totalMemory += total;
            }
            long free = nodeStats.getOs().getMem().getFree().getBytes();
            if (free > 0) {
                freeMemory += free;
            }
        }
    }
    this.mem = new org.elasticsearch.monitor.os.OsStats.Mem(totalMemory, freeMemory);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:35,代码来源:ClusterStatsNodes.java


注:本文中的org.elasticsearch.action.admin.cluster.node.info.NodeInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。