@Override public void execute(final String[] args) throws KeeperException, InterruptedException { ServerContext context = new ServerContext(new SiteConfiguration()); System.out.println("monitor: " + MonitorUtil.getLocation(context)); System.out.println("masters: " + context.getMasterLocations()); System.out.println("zookeepers: " + context.getZooKeepers()); }
public synchronized ServerContext getServerContext() { if (context == null) { if (instance == null) { context = new ServerContext(new SiteConfiguration()); } else { context = new ServerContext(new SiteConfiguration(), getClientProperties()); } } return context; } }
public synchronized ServerContext getServerContext() { if (context == null) { if (instance == null) { context = new ServerContext(new SiteConfiguration()); } else { context = new ServerContext(new SiteConfiguration(), getClientProperties()); } } return context; } }
public static void main(String[] args) throws Exception { listVolumes(new ServerContext(new SiteConfiguration())); }
@Override public void execute(String[] args) throws Exception { try (ServerContext context = new ServerContext(new SiteConfiguration())) { AccumuloConfiguration config = context.getServerConfFactory().getSystemConfiguration(); Authenticator authenticator = AccumuloVFSClassLoader.getClassLoader() .loadClass(config.get(Property.INSTANCE_SECURITY_AUTHENTICATOR)) .asSubclass(Authenticator.class).newInstance(); List<Set<TokenProperty>> tokenProps = new ArrayList<>(); for (Class<? extends AuthenticationToken> tokenType : authenticator .getSupportedTokenTypes()) { tokenProps.add(tokenType.newInstance().getProperties()); } System.out .println("Supported token types for " + authenticator.getClass().getName() + " are : "); for (Class<? extends AuthenticationToken> tokenType : authenticator .getSupportedTokenTypes()) { System.out .println("\t" + tokenType.getName() + ", which accepts the following properties : "); for (TokenProperty tokenProperty : tokenType.newInstance().getProperties()) { System.out.println("\t\t" + tokenProperty); } System.out.println(); } } }
public static void main(String[] args) { try (ServerContext context = new ServerContext(new SiteConfiguration())) { context.getServerConfFactory().getSystemConfiguration(); } }
public static void main(String args[]) { ServerContext context = new ServerContext(new SiteConfiguration()); getInstance(context).printProblems(); }
/** * Utility program that will change the goal state for the master from the command line. */ public static void main(String[] args) throws Exception { if (args.length != 1 || MasterGoalState.valueOf(args[0]) == null) { System.err.println( "Usage: accumulo " + SetGoalState.class.getName() + " [NORMAL|SAFE_MODE|CLEAN_STOP]"); System.exit(-1); } ServerContext context = new ServerContext(new SiteConfiguration()); SecurityUtil.serverLogin(context.getConfiguration()); ServerUtil.waitForZookeeperAndHdfs(context); context.getZooReaderWriter().putPersistentData( context.getZooKeeperRoot() + Constants.ZMASTER_GOAL_STATE, args[0].getBytes(UTF_8), NodeExistsPolicy.OVERWRITE); }
@Override public void execute(final String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(ZooKeeperMain.class.getName(), args); try (ServerContext context = new ServerContext(new SiteConfiguration())) { FileSystem fs = context.getVolumeManager().getDefaultVolume().getFileSystem(); String baseDir = ServerConstants.getBaseUris(context)[0]; System.out.println("Using " + fs.makeQualified(new Path(baseDir + "/instance_id")) + " to lookup accumulo instance"); if (opts.servers == null) { opts.servers = context.getZooKeepers(); } System.out.println("The accumulo instance id is " + context.getInstanceID()); if (!opts.servers.contains("/")) opts.servers += "/accumulo/" + context.getInstanceID(); org.apache.zookeeper.ZooKeeperMain .main(new String[] {"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)}); } } }
try (ServerContext context = new ServerContext(siteConfig)) {
public static void main(String[] args) throws Exception { try (ServerContext context = new ServerContext(new SiteConfiguration())) { String tserverPath = context.getZooKeeperRoot() + Constants.ZTSERVERS; Opts opts = new Opts(); opts.parseArgs(TabletServerLocks.class.getName(), args); ZooCache cache = context.getZooCache(); ZooReaderWriter zoo = context.getZooReaderWriter(); if (opts.list) { List<String> tabletServers = zoo.getChildren(tserverPath); for (String tabletServer : tabletServers) { byte[] lockData = ZooLock.getLockData(cache, tserverPath + "/" + tabletServer, null); String holder = null; if (lockData != null) { holder = new String(lockData, UTF_8); } System.out.printf("%32s %16s%n", tabletServer, holder); } } else if (opts.delete != null) { ZooLock.deleteLock(zoo, tserverPath + "/" + args[1]); } else { System.out.println( "Usage : " + TabletServerLocks.class.getName() + " -list|-delete <tserver lock>"); } } }
try (ServerContext context = new ServerContext(new SiteConfiguration())) { final String zkRoot = context.getZooKeeperRoot(); String path = zkRoot + Constants.ZFATE;
opts.parseArgs(CleanZookeeper.class.getName(), args); try (ServerContext context = new ServerContext(new SiteConfiguration())) {
public static void main(String[] args) throws Exception { final String app = "tracer"; ServerOpts opts = new ServerOpts(); opts.parseArgs(app, args); ServerContext context = new ServerContext(opts.getSiteConfiguration()); loginTracer(context.getConfiguration()); MetricsSystemHelper.configure(TraceServer.class.getSimpleName()); ServerUtil.init(context, app); try (TraceServer server = new TraceServer(context, opts.getAddress())) { server.run(); } finally { log.info("tracer stopping"); context.getZooReaderWriter().getZooKeeper().close(); } }
public static void main(String[] args) throws Exception { final String app = "master"; ServerOpts opts = new ServerOpts(); opts.parseArgs(app, args); ServerContext context = new ServerContext(opts.getSiteConfiguration()); context.setupServer(app, Master.class.getName(), opts.getAddress()); try { Master master = new Master(context); master.run(); } finally { context.teardownServer(); } }
public static void main(String[] args) { final String app = "gc"; Opts opts = new Opts(); opts.parseArgs(app, args); ServerContext context = new ServerContext(opts.getSiteConfiguration()); context.setupServer(app, SimpleGarbageCollector.class.getName(), opts.getAddress()); try { SimpleGarbageCollector gc = new SimpleGarbageCollector(opts, context); gc.run(); } finally { context.teardownServer(); } }
try (ServerContext context = new ServerContext(siteConfig)) { if (isInitialized(fs, siteConfig, hadoopConfig)) { if (!opts.forceResetSecurity) {
public static void main(String[] args) { final String app = "monitor"; ServerOpts opts = new ServerOpts(); opts.parseArgs(app, args); Monitor.context = new ServerContext(opts.getSiteConfiguration()); context.setupServer(app, Monitor.class.getName(), opts.getAddress()); try { config = context.getServerConfFactory(); Monitor monitor = new Monitor(); // Servlets need access to limit requests when the monitor is not active, but Servlets are // instantiated via reflection. Expose the service this way instead. Monitor.HA_SERVICE_INSTANCE = monitor; monitor.run(); } finally { context.teardownServer(); } }
public static void main(String[] args) throws Exception { final String app = "tserver"; ServerOpts opts = new ServerOpts(); opts.parseArgs(app, args); ServerContext context = new ServerContext(opts.getSiteConfiguration()); context.setupServer(app, TabletServer.class.getSimpleName(), opts.getAddress()); context.setupCrypto(); try { final TabletServer server = new TabletServer(context); if (UserGroupInformation.isSecurityEnabled()) { UserGroupInformation loginUser = UserGroupInformation.getLoginUser(); loginUser.doAs((PrivilegedExceptionAction<Void>) () -> { server.run(); return null; }); } else { server.run(); } } finally { context.teardownServer(); } }
@Override public MonitorLocation get() { // lazily set up path and zooCache (see comment in constructor) if (this.context == null) { this.context = new ServerContext(new SiteConfiguration()); this.path = context.getZooKeeperRoot() + Constants.ZMONITOR_LOG4J_ADDR; this.zooCache = context.getZooCache(); } // get the current location from the cache and update if necessary ZcStat stat = new ZcStat(); byte[] loc = zooCache.get(path, stat); // mzxid is 0 if location does not exist and the non-zero transaction id of the last // modification otherwise return new MonitorLocation(stat.getMzxid(), loc); } }