use of voldemort.client.ClientConfig in project voldemort by voldemort.
the class AsyncMetadataVersionManagerTest method setUp.
@Before
public void setUp() throws Exception {
servers = new VoldemortServer[cluster.getNodeIds().size()];
int i = 0;
for (Integer nodeId : cluster.getNodeIds()) {
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, storeDefs, new Properties());
VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config);
servers[i++] = server;
}
socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();
bootStrapUrls = new String[1];
bootStrapUrls[0] = socketUrl;
ClientConfig clientConfig = new ClientConfig();
clientConfig.setBootstrapUrls(bootStrapUrls).setClientZoneId(clientZoneId);
SystemStoreClientFactory<String, String> systemStoreFactory = new SystemStoreClientFactory<String, String>(clientConfig);
sysVersionStore = systemStoreFactory.createSystemStore(SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
repository = new SystemStoreRepository(clientConfig);
repository.addSystemStore(sysVersionStore, SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
this.scheduler = new SchedulerService(2, SystemTime.INSTANCE, true);
}
use of voldemort.client.ClientConfig in project voldemort by voldemort.
the class SystemStoreTest method setUp.
@Before
public void setUp() throws Exception {
servers = new VoldemortServer[cluster.getNodeIds().size()];
int i = 0;
for (Integer nodeId : cluster.getNodeIds()) {
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, storeDefs, new Properties());
VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config);
servers[i++] = server;
}
socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();
ClientConfig clientConfig = new ClientConfig().setMaxTotalConnections(4).setMaxConnectionsPerNode(4).setBootstrapUrls(socketUrl);
SocketStoreClientFactory socketFactory = new SocketStoreClientFactory(clientConfig);
bootStrapUrls = new String[1];
bootStrapUrls[0] = socketUrl;
clusterXml = ((AbstractStoreClientFactory) socketFactory).bootstrapMetadataWithRetries(MetadataStore.CLUSTER_KEY);
}
use of voldemort.client.ClientConfig in project voldemort by voldemort.
the class SystemStoreTest method testCustomClusterXmlStore.
@Test
public void testCustomClusterXmlStore() {
try {
ClientConfig clientConfig = new ClientConfig();
clientConfig.setBootstrapUrls(bootStrapUrls).setClientZoneId(this.clientZoneId);
SystemStoreClientFactory<String, String> systemStoreFactory = new SystemStoreClientFactory<String, String>(clientConfig);
SystemStoreClient<String, String> sysVersionStore = systemStoreFactory.createSystemStore(SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name(), this.clusterXml, null);
long storesVersion = 1;
sysVersionStore.putSysStore("stores.xml", Long.toString(storesVersion));
long version = Long.parseLong(sysVersionStore.getValueSysStore("stores.xml"));
assertEquals("Received incorrect version from the voldsys$_metadata_version system store", storesVersion, version);
} catch (Exception e) {
fail("Failed to create System Store with custom cluster Xml: " + e.getMessage());
}
}
use of voldemort.client.ClientConfig in project voldemort by voldemort.
the class ChainedInconsistencyResolverTest method setUp.
@Before
public void setUp() throws IOException {
boolean useNio = false;
int numServers = 2;
VoldemortServer[] servers = new VoldemortServer[numServers];
Cluster cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, null, socketStoreFactory, useNio, null, STORES_XML, new Properties());
// Initialize versioned puts for basic test
v1 = getVersioned(0, 1, 1, 1, 1, 1);
v2 = getVersioned(0, 0, 1, 1, 1, 1);
// Initialize versioned puts for > 1 conflicts
conflict1 = getVersioned(0, 1, 1, 1, 1, 1, 1, 1, 1, 1);
conflict2 = getVersioned(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
conflict3 = getVersioned(0, 0, 0, 1, 1, 1, 1, 1, 1, 1);
conflict4 = getVersioned(0, 0, 0, 0, 1, 1, 1, 1, 1, 1);
conflict5 = getVersioned(0, 0, 0, 0, 0, 1, 1, 1, 1, 1);
conflict6 = getVersioned(0, 0, 0, 0, 0, 0, 1, 1, 1, 1);
Node node = cluster.getNodes().iterator().next();
String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
StoreClientFactory storeClientFactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl));
defaultStoreClient = storeClientFactory.getStoreClient("test");
socketStore = ServerTestUtils.getSocketStore(socketStoreFactory, "test", node.getSocketPort(), RequestFormatType.VOLDEMORT_V1);
}
use of voldemort.client.ClientConfig in project YCSB by brianfrankcooper.
the class VoldemortClient method init.
/**
* Initialize the DB layer. This accepts all properties allowed by the
* Voldemort client. A store maps to a table. Required : bootstrap_urls
* Additional property : store_name -> to preload once, should be same as -t
* {@link ClientConfig}
*/
public void init() throws DBException {
ClientConfig clientConfig = new ClientConfig(getProperties());
socketFactory = new SocketStoreClientFactory(clientConfig);
// Retrieve store name
storeName = getProperties().getProperty("store_name", "usertable");
// Use store name to retrieve client
storeClient = socketFactory.getStoreClient(storeName);
if (storeClient == null) {
throw new DBException("Unable to instantiate store client");
}
}
Aggregations