Search in sources :

Example 6 with SKGridConfiguration

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();
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RingID(com.ms.silverking.cloud.dht.daemon.storage.convergence.RingID) RingRegion(com.ms.silverking.cloud.ring.RingRegion) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) RingIDAndVersionPair(com.ms.silverking.cloud.dht.daemon.storage.convergence.RingIDAndVersionPair) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) IOException(java.io.IOException)

Example 7 with SKGridConfiguration

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();
        }
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) ClientException(com.ms.silverking.cloud.dht.client.ClientException)

Example 8 with SKGridConfiguration

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();
        }
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) File(java.io.File) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) ClientException(com.ms.silverking.cloud.dht.client.ClientException)

Example 9 with SKGridConfiguration

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);
}
Also used : ClientDHTConfiguration(com.ms.silverking.cloud.dht.client.ClientDHTConfiguration) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) MetaToolOptions(com.ms.silverking.cloud.management.MetaToolOptions) RingCreationResults(com.ms.silverking.cloud.toporing.StaticRingCreator.RingCreationResults) File(java.io.File)

Example 10 with SKGridConfiguration

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);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) CmdLineException(org.kohsuke.args4j.CmdLineException) NotBoundException(java.rmi.NotBoundException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) CmdLineException(org.kohsuke.args4j.CmdLineException) OperationException(com.ms.silverking.cloud.dht.client.OperationException)

Aggregations

SKGridConfiguration (com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration)22 IOException (java.io.IOException)18 KeeperException (org.apache.zookeeper.KeeperException)11 ClientException (com.ms.silverking.cloud.dht.client.ClientException)10 CmdLineException (org.kohsuke.args4j.CmdLineException)8 CmdLineParser (org.kohsuke.args4j.CmdLineParser)8 RetrievalException (com.ms.silverking.cloud.dht.client.RetrievalException)4 PutException (com.ms.silverking.cloud.dht.client.PutException)3 File (java.io.File)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)2 NamespaceVersionMode (com.ms.silverking.cloud.dht.NamespaceVersionMode)1 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)1 ClientDHTConfiguration (com.ms.silverking.cloud.dht.client.ClientDHTConfiguration)1 OperationException (com.ms.silverking.cloud.dht.client.OperationException)1 WaitForCompletionException (com.ms.silverking.cloud.dht.client.WaitForCompletionException)1 RingID (com.ms.silverking.cloud.dht.daemon.storage.convergence.RingID)1 RingIDAndVersionPair (com.ms.silverking.cloud.dht.daemon.storage.convergence.RingIDAndVersionPair)1 IneligibleServerException (com.ms.silverking.cloud.dht.meta.IneligibleServerException)1 MetaToolOptions (com.ms.silverking.cloud.management.MetaToolOptions)1 RingRegion (com.ms.silverking.cloud.ring.RingRegion)1