Package voldemort.cluster

Examples of voldemort.cluster.Node


                                                                true,
                                                                null,
                                                                STORES_XML,
                                                                new Properties());

        Node node = cluster.getNodeById(0);
        String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
        AdminClient adminClient = new AdminClient(bootstrapUrl,
                                                  new AdminClientConfig(),
                                                  new ClientConfig());

        byte[] value = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
View Full Code Here


                                                            partitionIds,
                                                            null,
                                                            null);
        adminClient.rpcOps.waitForCompletion(1, req, 5, TimeUnit.SECONDS);
        Versioned<Cluster> versionedCluster = adminClient.metadataMgmtOps.getRemoteCluster(0);
        Node node0 = versionedCluster.getValue().getNodeById(0);
        Node node1 = versionedCluster.getValue().getNodeById(1);
        Node newNode0 = new Node(node0.getId(),
                                 node0.getHost(),
                                 node0.getHttpPort(),
                                 node0.getSocketPort(),
                                 node0.getAdminPort(),
                                 ImmutableList.<Integer> of());
        Node newNode1 = new Node(node1.getId(),
                                 node1.getHost(),
                                 node1.getHttpPort(),
                                 node1.getSocketPort(),
                                 node1.getAdminPort(),
                                 ImmutableList.of(0, 1));
View Full Code Here

        return adminClient;
    }

    @Override
    protected Store<ByteArray, byte[], byte[]> getStore(int nodeId, String storeName) {
        Node node = cluster.getNodeById(nodeId);

        return ServerTestUtils.getSocketStore(socketStoreFactory, storeName, node.getSocketPort());
    }
View Full Code Here

                                                                    socketStoreFactory,
                                                                    true,
                                                                    null,
                                                                    STORES_XML,
                                                                    new Properties());
            Node node = cluster.getNodeById(0);
            return "tcp://" + node.getHost() + ":" + node.getSocketPort();
        } catch(IOException e) {
            e.printStackTrace();
            fail("Unexpected exception");
        }
View Full Code Here

    @Test
    public void testSingleNodeOffline() throws Exception {
        // 1. Get the node that we're going to take down...
        String offlineHostName = getRandomHostName();
        Node offlineNode = getNodeByHostName(offlineHostName, failureDetector);

        // 2. Hit the stores enough that we can reasonably assume that they're
        // up and reachable.
        test(store);
        assertEquals(hostNamePairs.size(), failureDetector.getAvailableNodeCount());
        assertTrue(failureDetector.isAvailable(offlineNode));

        // 3. Stop our node, then test enough that we can cause the node to be
        // marked as unavailable...
        stopClusterNode(offlineHostName, ec2FailureDetectorTestConfig);
        test(store);
        assertEquals(hostNamePairs.size() - 1, failureDetector.getAvailableNodeCount());
        assertFalse(failureDetector.isAvailable(offlineNode));

        // 4. Now start the node up, test, and make sure everything's OK.
        startClusterNode(offlineHostName, ec2FailureDetectorTestConfig, offlineNode.getId());
        failureDetector.waitForAvailability(offlineNode);
        test(store);
        assertEquals(hostNamePairs.size(), failureDetector.getAvailableNodeCount());
        assertTrue(failureDetector.isAvailable(offlineNode));
    }
View Full Code Here

                try {
                    Random random = new Random();

                    while(isRunning.get()) {
                        String offlineHostName = getRandomHostName();
                        Node offlineNode = getNodeByHostName(offlineHostName, failureDetector);

                        stopClusterNode(offlineHostName, ec2FailureDetectorTestConfig);
                        Thread.sleep(random.nextInt(10000));
                        startClusterNode(offlineHostName,
                                         ec2FailureDetectorTestConfig,
                                         offlineNode.getId());
                        Thread.sleep(random.nextInt(10000));
                    }
                } catch(Exception e) {
                    if(logger.isEnabledFor(Level.ERROR))
                        logger.error(e);
View Full Code Here

                                                                      cluster);
            vservers.put(nodeId, vs);
            socketStoreFactories.put(nodeId, socketStoreFactory);
            Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository()
                    .getLocalStore(storeDef.getName());
            Node node = cluster.getNodeById(nodeId);

            VectorClock version1 = new VectorClock();
            version1.incrementVersion(0, System.currentTimeMillis());
            VectorClock version2 = version1.incremented(0, System.currentTimeMillis());

            if(node.getZoneId() == clientZoneId) {
                // local zone
                store.put(new ByteArray(k1_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
                store.put(new ByteArray(k2_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
            } else {
                // remote zone
View Full Code Here

        JsonReader reader = makeTestDataReader(data, baseDir);

        // set up definitions for cluster and store
        List<Node> nodes = new ArrayList<Node>();
        for(int i = 0; i < numNodes; i++) {
            nodes.add(new Node(i,
                               "localhost",
                               8080 + i,
                               6666 + i,
                               7000 + i,
                               Arrays.asList(4 * i, 4 * i + 1, 4 * i + 2, 4 * i + 3)));
View Full Code Here

        adminProperties.setProperty("max_connections", "20");
        adminClient = new AdminClient(cluster,
                                      new AdminClientConfig(adminProperties),
                                      new ClientConfig());

        Node node = cluster.getNodeById(0);
        String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
        StoreClientFactory storeClientFactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl));
        storeClient = storeClientFactory.getStoreClient(STORE_NAME);

    }
View Full Code Here

     * @param key specifies the metadata key to retrieve
     * @return String representation of the value associated with the metadata
     *         key
     */
    private String bootstrapMetadata(String metadataKey) {
        Node serverNode = servers[0].getIdentityNode();
        Store<ByteArray, byte[], byte[]> remoteStore = socketStoreFactory.create(MetadataStore.METADATA_STORE_NAME,
                                                                                 serverNode.getHost(),
                                                                                 serverNode.getSocketPort(),
                                                                                 RequestFormatType.VOLDEMORT_V2,
                                                                                 RequestRoutingType.NORMAL);
        Store<String, String, byte[]> store = SerializingStore.wrap(remoteStore,
                                                                    new StringSerializer("UTF-8"),
                                                                    new StringSerializer("UTF-8"),
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.