Search in sources :

Example 6 with AdminClientConfig

use of voldemort.client.protocol.admin.AdminClientConfig in project voldemort by voldemort.

the class ExceededQuotaSlopTest method setGetPutQuotasForEachServer.

public void setGetPutQuotasForEachServer() throws Exception {
    Properties adminProperties = new Properties();
    adminProperties.setProperty("max_connections", "2");
    adminClient = new AdminClient(cluster, new AdminClientConfig().setMaxConnectionsPerNode(2));
    Map<Pair<Integer, QuotaType>, Integer> throughPutMap = new HashMap<Pair<Integer, QuotaType>, Integer>();
    // Set Node0 Quota
    throughPutMap.put(new Pair<Integer, QuotaType>(0, QuotaType.PUT_THROUGHPUT), 5);
    throughPutMap.put(new Pair<Integer, QuotaType>(0, QuotaType.GET_THROUGHPUT), 20);
    // Set Node1 Quota
    throughPutMap.put(new Pair<Integer, QuotaType>(1, QuotaType.PUT_THROUGHPUT), 2);
    throughPutMap.put(new Pair<Integer, QuotaType>(1, QuotaType.GET_THROUGHPUT), 20);
    for (Entry<Pair<Integer, QuotaType>, Integer> throughPut : throughPutMap.entrySet()) {
        int nodeId = throughPut.getKey().getFirst();
        QuotaType type = throughPut.getKey().getSecond();
        int value = throughPut.getValue();
        VectorClock clock = VectorClockUtils.makeClockWithCurrentTime(cluster.getNodeIds());
        NodeValue<ByteArray, byte[]> operationValue = new NodeValue<ByteArray, byte[]>(nodeId, new ByteArray(getKeyBytes(type)), new Versioned<byte[]>(ByteUtils.getBytes(Integer.toString(value), encodingType), clock));
        try {
            adminClient.storeOps.putNodeKeyValue(quotaStoreName, operationValue);
        } catch (Exception e) {
            throw new Exception("Exception when setting put quota for node " + nodeId + " Operation " + type + "." + e.getMessage());
        }
    }
}
Also used : NodeValue(voldemort.store.routed.NodeValue) AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) HashMap(java.util.HashMap) QuotaType(voldemort.store.quota.QuotaType) VectorClock(voldemort.versioning.VectorClock) Properties(java.util.Properties) VoldemortException(voldemort.VoldemortException) IOException(java.io.IOException) ByteArray(voldemort.utils.ByteArray) AdminClient(voldemort.client.protocol.admin.AdminClient) Pair(voldemort.utils.Pair)

Example 7 with AdminClientConfig

use of voldemort.client.protocol.admin.AdminClientConfig in project voldemort by voldemort.

the class SlopPurgeTest method setUp.

@Before
public void setUp() throws Exception {
    cluster = ServerTestUtils.getLocalZonedCluster(6, 3, new int[] { 0, 0, 1, 1, 2, 2 }, new int[][] { { 0 }, { 2 }, { 4 }, { 1 }, { 3 }, { 5 } });
    servers = new VoldemortServer[cluster.getNodes().size()];
    slopSerializer = new SlopSerializer();
    Properties serverProperties = new Properties();
    // Schedule the slop pusher far far far out in the future, so it won't
    // run during the test
    serverProperties.setProperty("slop.frequency.ms", "" + (Integer.MAX_VALUE));
    // Also no auto purging so we are sure that the only thing deleting the
    // slops is the purge job
    serverProperties.setProperty("auto.purge.dead.slops", "false");
    cluster = ServerTestUtils.startVoldemortCluster(servers, null, null, "test/common/voldemort/config/three-stores-with-zones.xml", serverProperties, cluster);
    for (VoldemortServer server : servers) {
        if (server.getIdentityNode().getId() == PURGE_SERVER_ID) {
            purgedServer = server;
            break;
        }
    }
    Properties adminProperties = new Properties();
    adminProperties.setProperty("max_connections", "2");
    adminClient = new AdminClient(servers[0].getMetadataStore().getCluster(), new AdminClientConfig(adminProperties));
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) SlopSerializer(voldemort.serialization.SlopSerializer) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 8 with AdminClientConfig

use of voldemort.client.protocol.admin.AdminClientConfig in project voldemort by voldemort.

the class SlopPusherDeadSlopTest method setUp.

@Before
public void setUp() throws Exception {
    try {
        Properties serverProperties = new Properties();
        serverProperties.setProperty("pusher.type", slopPusherType);
        serverProperties.setProperty("slop.frequency.ms", SLOP_FREQUENCY_MS.toString());
        serverProperties.setProperty("auto.purge.dead.slops", "true");
        serverProperties.setProperty("enable.server.routing", "true");
        servers = new VoldemortServer[2];
        int[][] partitionMap = { { 0, 1 }, { 2, 3 } };
        cluster = ServerTestUtils.startVoldemortCluster(servers, partitionMap, serverProperties, "test/common/voldemort/config/single-store.xml");
        Properties adminProperties = new Properties();
        adminProperties.setProperty("max_connections", "2");
        adminClient = new AdminClient(servers[0].getMetadataStore().getCluster(), new AdminClientConfig(adminProperties));
    } catch (Exception e) {
        logger.error("Error in setup", e);
        throw e;
    }
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) Properties(java.util.Properties) IOException(java.io.IOException) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 9 with AdminClientConfig

use of voldemort.client.protocol.admin.AdminClientConfig in project voldemort by voldemort.

the class ReadOnlyReplicationHelperTest method setUp.

@Before
public void setUp() throws IOException {
    int numServers = 2;
    servers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 } };
    Properties serverProperties = new Properties();
    serverProperties.setProperty("client.max.connections.per.node", "20");
    cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, false, null, storesXmlfile, serverProperties);
    Properties adminProperties = new Properties();
    adminProperties.setProperty("max_connections", "20");
    adminClient = new AdminClient(cluster, new AdminClientConfig(adminProperties));
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) Properties(java.util.Properties) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 10 with AdminClientConfig

use of voldemort.client.protocol.admin.AdminClientConfig in project voldemort by voldemort.

the class OfflineStateTest method setUp.

@Before
public void setUp() throws IOException {
    int numServers = 1;
    servers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0, 1, 2, 3 } };
    // , { 4, 5, 6, 7 } };
    Properties serverProperties = new Properties();
    serverProperties.setProperty("client.max.connections.per.node", "20");
    serverProperties.setProperty("enforce.retention.policy.on.read", Boolean.toString(onlineRetention));
    cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, useNio, null, storesXmlfile, serverProperties);
    storeDefs = new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile));
    Properties adminProperties = new Properties();
    adminProperties.setProperty("max_connections", "20");
    adminClient = new AdminClient(cluster, new AdminClientConfig(adminProperties));
    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);
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) Node(voldemort.cluster.Node) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) File(java.io.File) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Aggregations

AdminClient (voldemort.client.protocol.admin.AdminClient)14 AdminClientConfig (voldemort.client.protocol.admin.AdminClientConfig)14 Properties (java.util.Properties)8 Before (org.junit.Before)8 File (java.io.File)5 Node (voldemort.cluster.Node)5 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)5 VoldemortException (voldemort.VoldemortException)4 ClientConfig (voldemort.client.ClientConfig)4 IOException (java.io.IOException)2 ExecutorService (java.util.concurrent.ExecutorService)2 AdminStoreSwapper (voldemort.store.readonly.swapper.AdminStoreSwapper)2 ByteArray (voldemort.utils.ByteArray)2 Pair (voldemort.utils.Pair)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Future (java.util.concurrent.Future)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1