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