Search in sources :

Example 6 with VoldemortConfig

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());
    }
}
Also used : BdbRuntimeConfig(voldemort.store.bdb.BdbRuntimeConfig) Versioned(voldemort.versioning.Versioned) EnvironmentConfig(com.sleepycat.je.EnvironmentConfig) Props(voldemort.utils.Props) VoldemortConfig(voldemort.server.VoldemortConfig) PartitionPrefixedBdbStorageEngine(voldemort.store.bdb.PartitionPrefixedBdbStorageEngine) BdbStorageEngine(voldemort.store.bdb.BdbStorageEngine) PartitionPrefixedBdbStorageEngine(voldemort.store.bdb.PartitionPrefixedBdbStorageEngine) Database(com.sleepycat.je.Database) Environment(com.sleepycat.je.Environment) ByteArray(voldemort.utils.ByteArray) File(java.io.File) StringSerializer(voldemort.serialization.StringSerializer) DatabaseConfig(com.sleepycat.je.DatabaseConfig) Pair(voldemort.utils.Pair)

Example 7 with VoldemortConfig

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));
}
Also used : InMemoryStorageConfiguration(voldemort.store.memory.InMemoryStorageConfiguration) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) Node(voldemort.cluster.Node) SlowStorageConfiguration(voldemort.store.slow.SlowStorageConfiguration) Logger(org.apache.log4j.Logger) VoldemortServer(voldemort.server.VoldemortServer) Properties(java.util.Properties) ClientConfig(voldemort.client.ClientConfig) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 8 with VoldemortConfig

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);
}
Also used : StoreDefinition(voldemort.store.StoreDefinition) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) File(java.io.File) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 9 with VoldemortConfig

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;
}
Also used : Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig)

Example 10 with VoldemortConfig

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();
}
Also used : TestSocketStoreFactory(voldemort.store.socket.TestSocketStoreFactory) Node(voldemort.cluster.Node) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) TestSocketStoreFactory(voldemort.store.socket.TestSocketStoreFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Aggregations

VoldemortConfig (voldemort.server.VoldemortConfig)53 Properties (java.util.Properties)29 VoldemortServer (voldemort.server.VoldemortServer)24 Before (org.junit.Before)18 Node (voldemort.cluster.Node)16 StoreDefinition (voldemort.store.StoreDefinition)16 File (java.io.File)15 Props (voldemort.utils.Props)14 SocketStoreFactory (voldemort.store.socket.SocketStoreFactory)13 ByteArray (voldemort.utils.ByteArray)12 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)11 Cluster (voldemort.cluster.Cluster)7 Test (org.junit.Test)6 ClientConfig (voldemort.client.ClientConfig)6 SocketStoreClientFactory (voldemort.client.SocketStoreClientFactory)6 BdbStorageConfiguration (voldemort.store.bdb.BdbStorageConfiguration)6 AdminClient (voldemort.client.protocol.admin.AdminClient)5 OptionParser (joptsimple.OptionParser)4 OptionSet (joptsimple.OptionSet)4 ObsoleteVersionException (voldemort.versioning.ObsoleteVersionException)4