use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.
the class RebalancePlanCLI method main.
public static void main(String[] args) throws Exception {
setupParser();
OptionSet options = getValidOptions(args);
// Required args
String currentClusterXML = (String) options.valueOf("current-cluster");
String currentStoresXML = (String) options.valueOf("current-stores");
String finalClusterXML = (String) options.valueOf("final-cluster");
// Required args for some use cases
String finalStoresXML = new String(currentStoresXML);
if (options.has("final-stores")) {
finalStoresXML = (String) options.valueOf("final-stores");
}
Cluster currentCluster = new ClusterMapper().readCluster(new File(currentClusterXML));
List<StoreDefinition> currentStoreDefs = new StoreDefinitionsMapper().readStoreList(new File(currentStoresXML));
Cluster finalCluster = new ClusterMapper().readCluster(new File(finalClusterXML));
List<StoreDefinition> finalStoreDefs = new StoreDefinitionsMapper().readStoreList(new File(finalStoresXML));
// Optional args
int batchSize = CmdUtils.valueOf(options, "batch-size", RebalancePlan.BATCH_SIZE);
String outputDir = null;
if (options.has("output-dir")) {
outputDir = (String) options.valueOf("output-dir");
}
new RebalancePlan(currentCluster, currentStoreDefs, finalCluster, finalStoreDefs, batchSize, outputDir);
}
use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.
the class ReplaceNodeCLI method init.
private void init() {
this.adminClient = new AdminClient(this.url);
this.newAdminClient = new AdminClient(this.newUrl);
this.cluster = adminClient.getAdminClientCluster();
// Validate node exists in the old cluster
this.cluster.getNodeById(nodeId);
this.newCluster = newAdminClient.getAdminClientCluster();
if (newCluster.getNumberOfNodes() > 1) {
newNodeId = nodeId;
} else {
newNodeId = newCluster.getNodeIds().iterator().next().intValue();
}
this.clusterXml = getClusterXML();
// Update your cluster XML based on the consensus
this.cluster = new ClusterMapper().readCluster(new StringReader(clusterXml));
this.storesXml = getStoresXML();
this.storeDefinitions = new StoreDefinitionsMapper().readStoreList(new StringReader(storesXml), false);
}
use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.
the class StreamingSlopPusherTest method replaceOneNode.
private void replaceOneNode(int nodeId) throws IOException {
Cluster oldCluster = cluster;
cluster = ServerTestUtils.getLocalClusterWithOneNodeReplaced(cluster, nodeId);
metadataStore = ServerTestUtils.createMetadataStore(cluster, new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile)));
String newClusterXml = new ClusterMapper().writeCluster(cluster);
AdminClient adminClient = ServerTestUtils.getAdminClient(oldCluster);
for (Integer remoteNodeId : oldCluster.getNodeIds()) {
try {
adminClient.metadataMgmtOps.updateRemoteMetadata(remoteNodeId, MetadataStore.CLUSTER_KEY, newClusterXml);
} catch (UnreachableStoreException e) {
}
}
}
use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.
the class StreamingSlopPusherTest method setUp.
@Before
public void setUp() throws Exception {
cluster = ServerTestUtils.getLocalCluster(NUM_SERVERS);
servers = new VoldemortServer[NUM_SERVERS];
props = new Properties();
metadataStore = ServerTestUtils.createMetadataStore(cluster, new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile)));
props.put("pusher.type", "streaming");
props.put("slop.frequency.ms", "1000000");
configs = new VoldemortConfig[NUM_SERVERS];
for (int i = 0; i < NUM_SERVERS; i++) {
configs[i] = ServerTestUtils.createServerConfig(true, i, TestUtils.createTempDir().getAbsolutePath(), null, storesXmlfile, props);
}
}
use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.
the class DataCleanupJobTest method updateStoreDef.
private void updateStoreDef(int retentionDays) {
StoreDefinition storeDef = getStoreDef(retentionDays);
StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
String storeStr = mapper.writeStoreList(Arrays.asList(storeDef));
VectorClock clock = new VectorClock(System.currentTimeMillis());
clock.incrementVersion(0, System.currentTimeMillis());
Versioned<byte[]> storeSerialized = new Versioned<byte[]>(ByteUtils.getBytes(storeStr, "UTF-8"), clock);
metadataStore.updateStoreDefinitions(storeSerialized);
}
Aggregations