Search in sources :

Example 1 with AdminClientConfig

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

the class AdminServiceBasicTest 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");
    serverProperties.setProperty("enforce.retention.policy.on.read", Boolean.toString(onlineRetention));
    serverProperties.setProperty(VoldemortConfig.DEFAULT_STORAGE_SPACE_QUOTA_IN_KB, Long.toString(defaultStoreQuota));
    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)

Example 2 with AdminClientConfig

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

the class VoldemortBuildAndPushJob method createAdminClient.

private AdminClient createAdminClient(String url, boolean fetchAllStoresXml, int connectionTimeoutSec, int socketTimeoutSec) {
    ClientConfig config = new ClientConfig().setBootstrapUrls(url).setConnectionTimeout(connectionTimeoutSec, TimeUnit.SECONDS).setFetchAllStoresXmlInBootstrap(fetchAllStoresXml);
    AdminClientConfig adminConfig = new AdminClientConfig().setAdminSocketTimeoutSec(socketTimeoutSec);
    return new AdminClient(adminConfig, config);
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) ClientConfig(voldemort.client.ClientConfig) AdminClient(voldemort.client.protocol.admin.AdminClient)

Example 3 with AdminClientConfig

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

the class VerifyOrAddStoreTest method setUp.

@Before
public void setUp() throws IOException {
    servers = new VoldemortServer[NUM_SERVERS];
    int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } };
    cluster = ServerTestUtils.startVoldemortCluster(servers, partitionMap, serverProps, storesXmlfile);
    newStoreDef = new StoreDefinitionsMapper().readStoreList(new File(readOnlyXmlFilePath)).get(0);
    newStoreName = newStoreDef.getName();
    Node node = cluster.getNodeById(0);
    String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
    clientConfig.setBootstrapUrls(bootstrapUrl);
    adminClient = new AdminClient(new AdminClientConfig(), clientConfig);
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) Node(voldemort.cluster.Node) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) File(java.io.File) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 4 with AdminClientConfig

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

the class QuotaResetterTest 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");
    serverProperties.setProperty("enforce.retention.policy.on.read", Boolean.toString(false));
    cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, true, null, storesXmlfile, serverProperties);
    List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile));
    this.storeNames = Sets.newHashSet();
    for (StoreDefinition storeDef : storeDefs) {
        storeNames.add(storeDef.getName());
    }
    Properties adminProperties = new Properties();
    adminProperties.setProperty("max_connections", "20");
    adminClient = new AdminClient(cluster, new AdminClientConfig(adminProperties));
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) StoreDefinition(voldemort.store.StoreDefinition) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) File(java.io.File) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 5 with AdminClientConfig

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

the class AdminToolUtils method getAdminClient.

/**
     * Utility function that constructs AdminClient.
     * 
     * @param url URL pointing to the bootstrap node
     * @return Newly constructed AdminClient
     */
public static AdminClient getAdminClient(String url) {
    ClientConfig config = new ClientConfig().setBootstrapUrls(url).setConnectionTimeout(5, TimeUnit.SECONDS);
    AdminClientConfig adminConfig = new AdminClientConfig().setAdminSocketTimeoutSec(5);
    return new AdminClient(adminConfig, config);
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) ClientConfig(voldemort.client.ClientConfig) AdminClient(voldemort.client.protocol.admin.AdminClient)

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