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();
}
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));
}
}
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();
}
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();
}
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());
}
}
Aggregations