Search in sources :

Example 16 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class RecoverOldAttr method main.

public static void main(String[] args) {
    if (args.length != 3) {
        System.out.println("args: <gridConfig> <file> <version>");
    } else {
        try {
            RecoverOldAttr roa;
            SKGridConfiguration gc;
            String file;
            long version;
            gc = SKGridConfiguration.parseFile(args[0]);
            file = args[1];
            version = Long.parseLong(args[2]);
            roa = new RecoverOldAttr(gc);
            roa.recover(file, version);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) PutException(com.ms.silverking.cloud.dht.client.PutException) IOException(java.io.IOException) RetrievalException(com.ms.silverking.cloud.dht.client.RetrievalException) ClientException(com.ms.silverking.cloud.dht.client.ClientException)

Example 17 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class DirReader method main.

public static void main(String[] args) {
    if (args.length != 2) {
        System.out.println("<gridConfig> <dir>");
    } else {
        try {
            DirReader dirReader;
            SKGridConfiguration gc;
            String dirName;
            gc = SKGridConfiguration.parseFile(args[0]);
            dirName = args[1];
            dirReader = new DirReader(gc);
            dirReader.displayDir(dirName);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) IOException(java.io.IOException) RetrievalException(com.ms.silverking.cloud.dht.client.RetrievalException) ClientException(com.ms.silverking.cloud.dht.client.ClientException)

Example 18 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class DHTRingMaster method main.

// End RecoverData implementation
// /////////////////////////////////
public static void main(String[] args) {
    try {
        CmdLineParser parser;
        DHTRingMasterOptions options;
        SKGridConfiguration gc;
        DHTRingMaster dhtRingMaster;
        Log.initAsyncLogging();
        options = new DHTRingMasterOptions();
        parser = new CmdLineParser(options);
        try {
            int intervalMillis;
            parser.parseArgument(args);
            gc = SKGridConfiguration.parseFile(options.gridConfig);
            LogStreamConfig.configureLogStreams(gc, logFileName);
            intervalMillis = options.watchIntervalSeconds * 1000;
            LWTPoolProvider.createDefaultWorkPools();
            dhtRingMaster = new DHTRingMaster(gc.getClientDHTConfiguration().getZKConfig(), gc.getClientDHTConfiguration().getName(), intervalMillis, options.mode);
            Log.warningAsync("DHTRingMaster created");
            dhtRingMaster.start();
            Log.warningAsync("DHTRingMaster running");
            ThreadUtil.sleepForever();
        } catch (CmdLineException cle) {
            System.err.println(cle.getMessage());
            parser.printUsage(System.err);
            System.exit(-1);
        }
    } catch (Exception e) {
        e.printStackTrace();
        Log.logErrorSevere(e, DHTRingMaster.class.getName(), "main");
        System.exit(-1);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) CmdLineException(org.kohsuke.args4j.CmdLineException) CmdLineException(org.kohsuke.args4j.CmdLineException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) AlreadyBoundException(java.rmi.AlreadyBoundException)

Example 19 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class DebugKey method main.

public static void main(String[] args) {
    if (args.length < 4) {
        System.err.println("args: <gridConfig> <ns> <sourceRing> <destRing> <key...>");
    } else {
        try {
            DebugKey dk;
            SKGridConfiguration gc;
            String namespace;
            Pair<Long, Long> sourceRing;
            Pair<Long, Long> targetRing;
            String[] keys;
            gc = SKGridConfiguration.parseFile(args[0]);
            namespace = args[1];
            sourceRing = getVersionPair(args[2]);
            targetRing = getVersionPair(args[3]);
            dk = new DebugKey(gc, namespace);
            keys = Arrays.copyOfRange(args, 4, args.length);
            for (String key : keys) {
                dk.debugConvergence(key, sourceRing, targetRing);
            }
            System.exit(0);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) ClientException(com.ms.silverking.cloud.dht.client.ClientException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException)

Example 20 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class SKAdmin method main.

// /////////////////////////////////////////
public static void main(String[] args) {
    boolean success;
    success = false;
    try {
        SKAdmin skAdmin;
        SKAdminOptions options;
        CmdLineParser parser;
        SKGridConfiguration gc;
        SKAdminCommand[] commands;
        LWTPoolProvider.createDefaultWorkPools();
        LWTThreadUtil.setLWTThread();
        options = new SKAdminOptions();
        parser = new CmdLineParser(options);
        try {
            parser.parseArgument(args);
        } catch (CmdLineException cle) {
            System.err.println(cle.getMessage());
            parser.printUsage(System.err);
            System.exit(-1);
        }
        fillDefaultOptions(options);
        sanityCheckOptions(options);
        if (options.gridConfigBase != null) {
            gc = SKGridConfiguration.parseFile(new File(options.gridConfigBase), options.gridConfig);
        } else {
            gc = SKGridConfiguration.parseFile(options.gridConfig);
        }
        if (options.forceInclusionOfUnsafeExcludedServers) {
            Log.countdownWarning("Options requesting unsafe excluded servers. This may result in data loss", unsafeWarningCountdown);
        }
        skAdmin = new SKAdmin(gc, options);
        commands = SKAdminCommand.parseCommands(options.commands);
        success = skAdmin.execCommand(commands);
    } catch (IneligibleServerException ise) {
        throw ise;
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(-1);
    }
    Log.warning("SKAdmin exiting success=" + success);
    if (exitOnCompletion) {
        System.exit(success ? 0 : -1);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) IneligibleServerException(com.ms.silverking.cloud.dht.meta.IneligibleServerException) File(java.io.File) CmdLineException(org.kohsuke.args4j.CmdLineException) CmdLineException(org.kohsuke.args4j.CmdLineException) IneligibleServerException(com.ms.silverking.cloud.dht.meta.IneligibleServerException) ClientException(com.ms.silverking.cloud.dht.client.ClientException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException)

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