use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.
the class ChecksumTreeDebug method main.
public static void main(String[] args) {
try {
if (args.length < 8) {
System.out.println("args: <gridConfig> <sourceIP> <namespace> <dhtConfigVersion> <ringName> <sourceRing> <targetRing> <ringRegion> [dataVersion]");
} else {
ChecksumTreeDebug ctd;
SKGridConfiguration gc;
IPAndPort sourceNode;
long namespace;
int dhtConfigVersion;
RingID ringID;
Pair<Long, Long> sourceRing;
Pair<Long, Long> targetRing;
ConvergencePoint sourceCP;
ConvergencePoint targetCP;
RingRegion ringRegion;
long dataVersion;
LWTPoolProvider.createDefaultWorkPools();
gc = SKGridConfiguration.parseFile(args[0]);
sourceNode = new IPAndPort(args[1], gc.getClientDHTConfiguration().getPort());
namespace = NamespaceUtil.nameToLong(args[2]);
dhtConfigVersion = Integer.parseInt(args[3]);
ringID = RingID.nameToRingID(args[4]);
sourceRing = getVersionPair(args[5]);
targetRing = getVersionPair(args[6]);
ringRegion = RingRegion.parseZKString(args[7]);
if (args.length >= 9) {
dataVersion = Long.parseLong(args[8]);
} else {
dataVersion = Long.MAX_VALUE;
}
sourceCP = new ConvergencePoint(dhtConfigVersion, new RingIDAndVersionPair(ringID, sourceRing), dataVersion);
targetCP = new ConvergencePoint(dhtConfigVersion, new RingIDAndVersionPair(ringID, targetRing), dataVersion);
ctd = new ChecksumTreeDebug();
ctd.debug(sourceNode, namespace, ringRegion, sourceCP, targetCP);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.
the class RingInfo method main.
public static void main(String[] args) {
if (args.length < 2) {
System.err.println("args: <gridConfig> <ring...>");
} else {
try {
SKGridConfiguration gc;
RingInfo ringInfo;
gc = SKGridConfiguration.parseFile(args[0]);
ringInfo = new RingInfo(gc);
for (int i = 1; i < args.length; i++) {
ringInfo.getRingInfo(getRingAndVersionPair(args[i]));
}
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.
the class ComputeRingStats method main.
public static void main(String[] args) {
if (args.length < 3) {
System.err.println("args: <gridConfig> <sourceRing> <simulations> <serversLost...>");
System.err.println("args: <gridConfig> <sourceRing> <serverFile>");
} else {
try {
ComputeRingStats crs;
SKGridConfiguration gc;
Triple<String, Long, Long> sourceRing;
int simulations;
int[] serversLost;
gc = SKGridConfiguration.parseFile(args[0]);
sourceRing = parseRing(args[1]);
crs = new ComputeRingStats(gc, sourceRing);
if (args.length > 3) {
serversLost = new int[args.length - 3];
simulations = Integer.parseInt(args[2]);
for (int i = 3; i < args.length; i++) {
serversLost[i - 3] = Integer.parseInt(args[i]);
}
crs.computeLossProbability(serversLost, simulations);
} else {
System.out.printf("Result: %s\n", crs.lostData(new File(args[2])));
}
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.
the class StaticDHTCreator method createStaticDHT.
public void createStaticDHT(UUIDBase uuid, int initialHeapSize, int maxHeapSize, String skInstanceLogBaseVar, String dataBaseVar, String skfsConfigurationFile) throws IOException, KeeperException {
String ringName;
String classVarsName;
RingCreationResults rcResults;
MetaClient mc;
mc = new MetaClient(dhtName, zkConfig);
// Create Ring
ringName = ringNameBase + uuid.toString();
rcResults = StaticRingCreator.createStaticRing(ringName, zkConfig, servers, replication, uuid);
// Create class vars
ClassVars classVars;
Map<String, String> varsMap;
MetaToolOptions mto;
classVarsName = "classVars." + uuid.toString();
varsMap = new HashMap<>();
varsMap.put(DHTConstants.initialHeapSizeVar, Integer.toString(initialHeapSize));
varsMap.put(DHTConstants.maxHeapSizeVar, Integer.toString(maxHeapSize));
if (skInstanceLogBaseVar != null) {
varsMap.put(DHTConstants.skInstanceLogBaseVar, skInstanceLogBaseVar);
}
if (dataBaseVar != null) {
varsMap.put(DHTConstants.dataBaseVar, dataBaseVar);
}
classVars = new ClassVars(varsMap, VersionedDefinition.NO_VERSION);
new ClassVarsZK(mc).writeToZK(classVars, classVarsName);
// Create DHTConfig
DHTConfiguration dhtConfig;
dhtConfig = new DHTConfiguration(ringName, port, passiveNodes, nsCreationOptions, ImmutableMap.of(rcResults.hostGroupName, classVarsName), 0, Long.MIN_VALUE, null);
new DHTConfigurationZK(mc).writeToZK(dhtConfig, null);
// Write out curRingAndVersion
new DHTRingCurTargetZK(mc, dhtConfig).setCurRingAndVersionPair(ringName, 0, 0);
new DHTRingCurTargetZK(mc, dhtConfig).setTargetRingAndVersionPair(ringName, 0, 0);
// Write skfs configuration if present
if (skfsConfigurationFile != null) {
writeSKFSConfig(gcName, new File(skfsConfigurationFile));
}
// Write GridConfig
Map<String, String> envMap;
envMap = new HashMap<>();
envMap.put(ClientDHTConfiguration.nameVar, dhtName);
envMap.put(ClientDHTConfiguration.portVar, Integer.toString(port));
envMap.put(ClientDHTConfiguration.zkLocVar, zkConfig.getConnectString());
writeGridConfig(new SKGridConfiguration(gcName, envMap), gridConfigDir, gcName);
System.out.println(gcName);
}
use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.
the class SKAdminShell method main.
public static void main(String[] args) {
try {
CmdLineParser parser;
SKAdminShellOptions options;
SKGridConfiguration gc;
SKAdminShell shell;
args = repairArgs(args);
options = new SKAdminShellOptions();
parser = new CmdLineParser(options);
try {
parser.parseArgument(args);
gc = SKGridConfiguration.parseFile(options.gridConfig);
shell = new SKAdminShell(gc, System.in, System.out, System.err, options.server, options.port);
if (options.commands == null && options.commandFile == null) {
shell.shellLoop();
} else {
if (options.commandFile != null) {
shell.runCommands(options.commandFile);
}
if (options.commands != null) {
shell.runCommands(options.commands);
}
}
System.exit(0);
} catch (CmdLineException cle) {
System.err.println(cle.getMessage());
parser.printUsage(System.err);
System.exit(-1);
}
} catch (Exception e) {
e.printStackTrace();
Log.logErrorSevere(e, SKAdminShell.class.getName(), "main");
System.exit(-1);
}
}
Aggregations