Search in sources :

Example 81 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class HintedHandoffTestEnvironment method stopServer.

/**
     * Stop a server
     * 
     * @param nodeId The node of server to stop
     */
public void stopServer(int nodeId) {
    if (logger.isInfoEnabled())
        logger.info("Stopping server of node [" + nodeId + "]");
    VoldemortServer server = voldemortServers.get(nodeId);
    server.stop();
}
Also used : VoldemortServer(voldemort.server.VoldemortServer)

Example 82 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class HintedHandoffTestEnvironment method startServer.

/**
     * Start a server How it works:
     * 
     * 1. create a server using test utilities
     * 
     * 2.Inject prepared test store and storage engine
     * 
     * 3. Inject prepared slop store and storage engine
     * 
     * @param nodeId The node of server to start
     * @throws IOException
     */
public void startServer(int nodeId) throws IOException {
    if (logger.isInfoEnabled())
        logger.info("Starting server of node [" + nodeId + "]");
    SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
    List<StoreDefinition> stores = new ArrayList<StoreDefinition>();
    stores.add(storeDef);
    // start a voldemort server
    VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, stores, new Properties());
    config.setNioAdminConnectorSelectors(1);
    config.setNioConnectorSelectors(5);
    config.setSlopFrequencyMs(DEFAULT_SLOP_PUSH_INTERVAL_S * 1000);
    config.setSlopStoreType("memory");
    config.setFailureDetectorAsyncRecoveryInterval(DEFAULT_ASYNC_RECOVERY_INTERVAL_S * 1000);
    VoldemortServer vs = ServerTestUtils.startVoldemortServer(socketStoreFactory, config);
    socketStoreFactory.close();
    voldemortServers.put(nodeId, vs);
    VoldemortService vsrv = vs.getService(ServiceType.STORAGE);
    StoreRepository sr = ((StorageService) vsrv).getStoreRepository();
    // storage engine injection
    sr.removeLocalStore(STORE_NAME);
    sr.addLocalStore(sleepyStores.get(nodeId));
    sr.removeStorageEngine(STORE_NAME);
    sr.addStorageEngine((StorageEngine<ByteArray, byte[], byte[]>) realStores.get(nodeId));
    // slop stores caching and injection
    if (!slopStorageEngines.containsKey(nodeId)) {
        SlopStorageEngine slopStorageEngine = sr.getSlopStore();
        slopStorageEngines.put(nodeId, slopStorageEngine);
    } else {
        sr.removeStorageEngine("slop");
        sr.removeLocalStore("slop");
        sr.addStorageEngine(slopStorageEngines.get(nodeId));
        sr.addLocalStore(slopStorageEngines.get(nodeId));
        sr.setSlopStore(slopStorageEngines.get(nodeId));
    }
}
Also used : ArrayList(java.util.ArrayList) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) StoreRepository(voldemort.server.StoreRepository) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig) StorageService(voldemort.server.storage.StorageService) VoldemortService(voldemort.common.service.VoldemortService) ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) StoreDefinition(voldemort.store.StoreDefinition) ByteArray(voldemort.utils.ByteArray)

Example 83 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class EndToEndRebootstrapTest method tearDown.

@After
public void tearDown() throws Exception {
    for (VoldemortServer server : servers) {
        ServerTestUtils.stopVoldemortServer(server);
    }
    scheduler.stop();
    sysRepository.close();
}
Also used : VoldemortServer(voldemort.server.VoldemortServer) After(org.junit.After)

Example 84 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class QuotaResetterTest method tearDown.

@After
public void tearDown() throws IOException {
    adminClient.close();
    for (VoldemortServer server : servers) {
        ServerTestUtils.stopVoldemortServer(server);
    }
    socketStoreFactory.close();
}
Also used : VoldemortServer(voldemort.server.VoldemortServer) After(org.junit.After)

Example 85 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class ReplaceNodeTest method setUp.

@Before
public void setUp() throws IOException {
    final boolean USE_NIO = true;
    Properties serverProperties = new Properties();
    serverProperties.setProperty("client.max.connections.per.node", "20");
    serverProperties.setProperty("slop.frequency.ms", "8000");
    int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 }, { 16, 17, 18, 19 }, { 20, 21, 22, 23 } };
    originalServers = new VoldemortServer[TOTAL_SERVERS];
    originalCluster = ServerTestUtils.startVoldemortCluster(TOTAL_SERVERS, originalServers, partitionMap, originalSocketStoreFactory, USE_NIO, null, ORIGINAL_STORES_XML, serverProperties);
    Node node = originalCluster.getNodeById(this.healthyNode);
    originalBootstrapUrl = getAdminUrl(node);
    finalServers = new HashMap<Integer, VoldemortServer>();
    for (VoldemortServer server : originalServers) {
        finalServers.put(server.getIdentityNode().getId(), server);
    }
    int replacementServerCount = 1;
    int[][] replacementPartitionMap = { { 0, 1, 2, 3 } };
    Properties otherServerProperties = new Properties();
    otherServerProperties.putAll(serverProperties);
    otherServerProperties.put(VoldemortConfig.ENABLE_NODE_ID_DETECTION, Boolean.toString(this.autoDetectNodeId));
    otherServers = new VoldemortServer[replacementServerCount];
    ServerTestUtils.startVoldemortCluster(replacementServerCount, otherServers, replacementPartitionMap, replacementSocketStoreFactory, USE_NIO, null, EMPTY_STORES_XML, otherServerProperties);
    if (this.autoDetectNodeId) {
        setHostMatcher(otherServers[0].getVoldemortConfig());
    }
}
Also used : Node(voldemort.cluster.Node) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) Before(org.junit.Before)

Aggregations

VoldemortServer (voldemort.server.VoldemortServer)86 Properties (java.util.Properties)36 VoldemortConfig (voldemort.server.VoldemortConfig)24 Test (org.junit.Test)23 Node (voldemort.cluster.Node)23 Before (org.junit.Before)21 SocketStoreFactory (voldemort.store.socket.SocketStoreFactory)20 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)18 ClientConfig (voldemort.client.ClientConfig)17 ByteArray (voldemort.utils.ByteArray)17 ArrayList (java.util.ArrayList)16 After (org.junit.After)15 StoreDefinition (voldemort.store.StoreDefinition)15 SocketStoreClientFactory (voldemort.client.SocketStoreClientFactory)14 Cluster (voldemort.cluster.Cluster)14 IOException (java.io.IOException)11 HashMap (java.util.HashMap)11 AdminClient (voldemort.client.protocol.admin.AdminClient)11 VectorClock (voldemort.versioning.VectorClock)10 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)9