public static void main(String args[]) { Config.setClientMode(true); LoaderOptions options = LoaderOptions.parseArgs(args); OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug); SSTableLoader loader = new SSTableLoader( options.directory, new ExternalClient( options.hosts, options.rpcPort, options.user, options.passwd, options.transportFactory, options.storagePort, options.sslStoragePort, options.serverEncOptions), handler); DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle); StreamResultFuture future = null; try { if (options.noProgress) future = loader.stream(options.ignores); else future = loader.stream(options.ignores, new ProgressIndicator()); } catch (Exception e) { System.err.println(e.getMessage()); if (e.getCause() != null) System.err.println(e.getCause()); if (options.debug) e.printStackTrace(System.err); else System.err.println("Run with --debug to get full stack trace or --help to get help."); System.exit(1); } handler.output(String.format("Streaming session ID: %s", future.planId)); try { future.get(); System.exit(0); // We need that to stop non daemonized threads } catch (Exception e) { System.err.println("Streaming to the following hosts failed:"); System.err.println(loader.getFailedHosts()); System.err.println(e); if (options.debug) e.printStackTrace(System.err); System.exit(1); } }
@Override public void start() throws Exception { if (_app != null) { initThreadUncaughtExceptionHandler(); initServer(); initSysClientFactory(); _server.start(); // only data node needs to poll the cluster's address change if (!_coordinator.isControlNode()) { _clusterPoller.start(); } startNewVersionCheck(); startUpgradeManager(); startSecretsManager(); startPropertyManager(); startVdcManager(); startIpReconfigManager(); // config cassandra as client mode to avoid load yaml file Config.setClientMode(true); DrUtil drUtil = _coordinator.getDrUtil(); if (drUtil.isActiveSite()) { _recoveryMgr.init(); startSystemAudit(_dbClient); } _svcBeacon.start(); if (drUtil.isActiveSite()) { startNetworkMonitor(); } } else { throw new Exception("No app found."); } }
static { Config.setClientMode(true); Option optKey = new Option(KEY_OPTION, true, "Partition key"); // Number of times -k <key> can be passed on the command line. optKey.setArgs(500); options.addOption(optKey); Option excludeKey = new Option(EXCLUDE_KEY_OPTION, true, "Excluded partition key"); // Number of times -x <key> can be passed on the command line. excludeKey.setArgs(500); options.addOption(excludeKey); Option optEnumerate = new Option(ENUMERATE_KEYS_OPTION, false, "enumerate partition keys only"); options.addOption(optEnumerate); Option debugOutput = new Option(DEBUG_OUTPUT_OPTION, false, "CQL row per line internal representation"); options.addOption(debugOutput); Option rawTimestamps = new Option(RAW_TIMESTAMPS, false, "Print raw timestamps instead of iso8601 date strings"); options.addOption(rawTimestamps); }