use of voldemort.server.VoldemortConfig in project voldemort by voldemort.
the class CatBdbStore method main.
public static void main(String[] args) throws Exception {
if (args.length != 2)
Utils.croak("USAGE: java " + CatBdbStore.class.getName() + " bdb_dir" + " storeName" + " server.properties.path");
String bdbDir = args[0];
String storeName = args[1];
String serverProperties = args[2];
VoldemortConfig config = new VoldemortConfig(new Props(new File(serverProperties)));
EnvironmentConfig environmentConfig = new EnvironmentConfig();
environmentConfig.setDurability(Durability.COMMIT_NO_SYNC);
environmentConfig.setAllowCreate(true);
environmentConfig.setTransactional(config.isBdbWriteTransactionsEnabled());
Environment environment = new Environment(new File(bdbDir), environmentConfig);
DatabaseConfig databaseConfig = new DatabaseConfig();
databaseConfig.setAllowCreate(true);
databaseConfig.setTransactional(config.isBdbWriteTransactionsEnabled());
databaseConfig.setSortedDuplicates(false);
Database database = environment.openDatabase(null, storeName, databaseConfig);
StorageEngine<ByteArray, byte[], byte[]> store = null;
if (config.getBdbPrefixKeysWithPartitionId()) {
store = new PartitionPrefixedBdbStorageEngine(storeName, environment, database, new BdbRuntimeConfig(), TestUtils.makeSingleNodeRoutingStrategy());
} else {
store = new BdbStorageEngine(storeName, environment, database, new BdbRuntimeConfig());
}
StorageEngine<String, String, String> stringStore = SerializingStorageEngine.wrap(store, new StringSerializer(), new StringSerializer(), new StringSerializer());
Iterator<Pair<String, Versioned<String>>> iter = stringStore.entries();
while (iter.hasNext()) {
Pair<String, Versioned<String>> entry = iter.next();
System.out.println(entry.getFirst() + " => " + entry.getSecond().getValue());
}
}
use of voldemort.server.VoldemortConfig in project voldemort by voldemort.
the class E2ENonblockingCheckoutTest method setUp.
@Before
public void setUp() throws Exception {
// PatternLayout patternLayout = new
// PatternLayout("%d{ABSOLUTE} %-5p [%t/%c]: %m%n");
Logger logger;
/*-
// To analyze whether checkout/checkin paths are blocking add
// log4j.trace statements to KeyedResourcePool checkout/checkin methods.
*/
logger = Logger.getLogger("voldemort.store.socket.clientrequest.ClientRequestExecutorPool");
logger.setLevel(Level.TRACE);
logger = Logger.getLogger("voldemort.utils.pool.KeyedResourcePool");
logger.setLevel(Level.TRACE);
logger = Logger.getLogger("voldemort.utils.pool.QueuedKeyedResourcePool");
logger.setLevel(Level.TRACE);
logger = Logger.getLogger("voldemort.store.socket.SocketStore");
logger.setLevel(Level.DEBUG);
logger = Logger.getLogger("voldemort.store.routed.action.PerformParallelPutRequests");
logger.setLevel(Level.DEBUG);
logger = Logger.getLogger("voldemort.store.routed.action.PerformSerialPutRequests");
logger.setLevel(Level.DEBUG);
cluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 3 }, { 1, 4 }, { 2, 5 } });
servers = new ArrayList<VoldemortServer>();
Properties p = new Properties();
String storageConfigs = BdbStorageConfiguration.class.getName() + "," + InMemoryStorageConfiguration.class.getName() + "," + SlowStorageConfiguration.class.getName();
p.setProperty("storage.configs", storageConfigs);
p.setProperty("testing.slow.queueing.put.ms", Long.toString(SLOW_PUT_MS));
p.setProperty("client.connection.timeout.ms", Integer.toString(CONNECTION_TIMEOUT_MS));
p.setProperty("client.routing.timeout.ms", Integer.toString(ROUTING_TIMEOUT_MS));
for (int i = 0; i < 3; i++) {
VoldemortConfig voldemortConfig = ServerTestUtils.createServerConfigWithDefs(this.useNio, i, TestUtils.createTempDir().getAbsolutePath(), cluster, getStoreDef(i), p);
VoldemortServer voldemortServer = ServerTestUtils.startVoldemortServer(socketStoreFactory, voldemortConfig);
servers.add(voldemortServer);
}
Node node = cluster.getNodeById(0);
String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
storeClientFactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl).setMaxConnectionsPerNode(CONNECTIONS_PER_NODE).setConnectionTimeout(CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS));
}
use of voldemort.server.VoldemortConfig in project voldemort by voldemort.
the class AdminServiceFilterTest method setUp.
@Override
@Before
public void setUp() throws IOException {
cluster = ServerTestUtils.getLocalCluster(2);
VoldemortConfig config = ServerTestUtils.createServerConfig(useNio, 0, TestUtils.createTempDir().getAbsolutePath(), null, storesXmlfile, new Properties());
config.setEnableNetworkClassLoader(true);
List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile));
storeDef = StoreDefinitionUtils.getStoreDefinitionWithName(storeDefs, testStoreName);
server = new VoldemortServer(config, cluster);
server.start();
adminClient = ServerTestUtils.getAdminClient(cluster);
}
use of voldemort.server.VoldemortConfig in project voldemort by voldemort.
the class AbstractRebalanceTest method startServers.
// This method is susceptible to BindException issues due to TOCTOU
// problem with getLocalCluster (which is used to construct cluster that is
// passed in).
// TODO: (refactor) AbstractRebalanceTest to take advantage of
// ServerTestUtils.startVoldemortCluster.
protected Cluster startServers(Cluster cluster, String storeXmlFile, List<Integer> nodeToStart, Map<String, String> configProps) throws Exception {
for (int node : nodeToStart) {
Properties properties = new Properties();
if (null != configProps) {
for (Entry<String, String> property : configProps.entrySet()) {
properties.put(property.getKey(), property.getValue());
}
}
// turn proxy puts on
properties.put("proxy.puts.during.rebalance", "true");
properties.put("bdb.cache.size", "" + (5 * 1024 * 1024));
properties.put("bdb.one.env.per.store", "true");
VoldemortConfig config = ServerTestUtils.createServerConfig(true, node, TestUtils.createTempDir().getAbsolutePath(), null, storeXmlFile, properties);
VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster);
serverMap.put(node, server);
}
return cluster;
}
use of voldemort.server.VoldemortConfig in project voldemort by voldemort.
the class ZoneShrinkageEndToEndTest method setup.
@Before
public void setup() throws IOException {
// setup and start servers
for (Node node : cluster.getNodes()) {
String tempFolderPath = TestUtils.createTempDir().getAbsolutePath();
// setup servers
SocketStoreFactory ssf = new TestSocketStoreFactory();
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, node.getId(), tempFolderPath, cluster, storeDefs, new Properties());
Assert.assertTrue(config.isSlopEnabled());
Assert.assertTrue(config.isSlopPusherJobEnabled());
Assert.assertTrue(config.getAutoPurgeDeadSlops());
config.setSlopFrequencyMs(10000L);
VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
vservers.put(node.getId(), vs);
socketStoreFactories.put(node.getId(), ssf);
voldemortConfigs.put(node.getId(), config);
}
for (Node node : cluster.getNodes()) {
if (node.getZoneId() != droppingZoneId) {
survivingNodes.add(node);
}
}
bootstrapURL = survivingNodes.get(0).getSocketUrl().toString();
}
Aggregations