Package voldemort.cluster

Examples of voldemort.cluster.Node


        int nodeId = 0;
        for(int zoneId = 0; zoneId < zoneToHostNames.size(); zoneId++) {
            List<String> hostNames = zoneToHostNames.get(zoneId);

            for(int i = 0; i < cluster.getNumberOfNodes(); i++) {
                Node node = cluster.getNodeById(nodeId);
                String hostName = hostNames.get(i);
                List<Integer> partitions = node.getPartitionIds();

                ClusterNodeDescriptor cnd = new ClusterNodeDescriptor();
                cnd.setHostName(hostName);
                cnd.setId(nodeId);
                cnd.setSocketPort(node.getSocketPort());
                cnd.setHttpPort(node.getHttpPort());
                cnd.setAdminPort(node.getAdminPort());
                cnd.setPartitions(partitions);
                cnd.setZoneId(zoneId);

                nodeId++;
                list.add(cnd);
View Full Code Here


    protected Cluster updateCluster(Cluster template) {
        List<Node> nodes = new ArrayList<Node>();
        for(Map.Entry<Integer, String> entry: nodeIdsInv.entrySet()) {
            int nodeId = entry.getKey();
            String hostName = entry.getValue();
            Node tmplNode = template.getNodeById(nodeId);
            Node node = new Node(nodeId,
                                 hostName,
                                 tmplNode.getHttpPort(),
                                 tmplNode.getSocketPort(),
                                 tmplNode.getAdminPort(),
                                 tmplNode.getPartitionIds());
View Full Code Here

                                                                 ec2RebalanceTestConfig);
        List<Node> nodes = new ArrayList<Node>();
        for(Map.Entry<String, Integer> entry: nodeIds.entrySet()) {
            String hostName = entry.getKey();
            int nodeId = entry.getValue();
            Node tmplNode = template.getNodeById(nodeId);
            Node node = new Node(nodeId,
                                 hostName,
                                 tmplNode.getHttpPort(),
                                 tmplNode.getSocketPort(),
                                 tmplNode.getAdminPort(),
                                 tmplNode.getPartitionIds());
View Full Code Here

                                                               socketStoreFactory,
                                                               true,
                                                               null,
                                                               STORES_XML,
                                                               new Properties());
            Node node = srcCluster.getNodeById(0);
            srcBootStrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();

            int dstPartitionMap[][] = { { 0 }, { 1 }, { 2 } };
            dstServers = new VoldemortServer[3];
            dstCluster = ServerTestUtils.startVoldemortCluster(3,
                                                               dstServers,
                                                               dstPartitionMap,
                                                               socketStoreFactory,
                                                               true,
                                                               null,
                                                               STORES_XML,
                                                               new Properties());
            node = dstCluster.getNodeById(0);
            dstBootStrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();

            kvPairs = ServerTestUtils.createRandomKeyValueString(100);
            int keyCount = 0;
            for(String key: kvPairs.keySet()) {
                if(keyCount == 0)
View Full Code Here

        // Test with empty node list
        assertEquals(Utils.nodeListToNodeIdList(nodes).size(), 0);

        // Add one node
        nodes.add(new Node(0, "localhost", 1, 2, 3, new ArrayList<Integer>()));
        assertEquals(Utils.nodeListToNodeIdList(nodes).size(), 1);
        assertEquals(Utils.nodeListToNodeIdList(nodes).get(0).intValue(), 0);
    }
View Full Code Here

        for(int nodeId = 0; nodeId < 4; nodeId++) {
            List<Integer> partitionIds = Lists.newArrayList();
            for(int partitionId = nodeId * 5; partitionId < (nodeId + 1) * 5; partitionId++) {
                partitionIds.add(partitionId);
            }
            Node node = new Node(nodeId, "b", 0, 1, 2, 0, partitionIds);
            nodes.add(node);
        }
        Cluster newCluster = new Cluster(cluster.getName(),
                                         nodes,
                                         Lists.newArrayList(cluster.getZones()));
View Full Code Here

        return rv;
    }

    private List<Integer> getPartitions(int nodeId) {
        Cluster cluster = adminClient.getAdminClientCluster();
        Node node = cluster.getNodeById(nodeId);
        return node.getPartitionIds();
    }
View Full Code Here

        int nodeId = 0; // Needed because node IDs must be contiguous?
        for(Node node: cluster.getNodes()) {
            // Do *not* add node from zone 1.
            if(node.getZoneId() != 1) {
                Node newNode = new Node(nodeId,
                                        node.getHost(),
                                        node.getHttpPort(),
                                        node.getSocketPort(),
                                        node.getAdminPort(),
                                        node.getZoneId(),
View Full Code Here

    }

    private void printNodeList(List<Node> nodes, FailureDetector failureDetector) {
        if(nodes.size() > 0) {
            for(int i = 0; i < nodes.size(); i++) {
                Node node = nodes.get(i);
                commandOutput.println("Node " + node.getId());
                commandOutput.println("host:  " + node.getHost());
                commandOutput.println("port: " + node.getSocketPort());
                commandOutput.println("available: "
                                      + (failureDetector.isAvailable(node) ? "yes" : "no"));
                commandOutput.println("last checked: " + failureDetector.getLastChecked(node)
                                      + " ms ago");
                commandOutput.println();
View Full Code Here

    @Override
    public String test(FailureDetector failureDetector) throws Exception {
        final int threads = 20;

        Node node = Iterables.get(failureDetectorConfig.getCluster().getNodes(), 0);
        CountDownLatch countDownLatch = new CountDownLatch(1);
        Listener listener = new Listener();
        failureDetector.addFailureDetectorListener(listener);

        long start = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of voldemort.cluster.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.