/** * Retrieve the SSL/TLS configuration for starting up a listening service */ public SslConnectionParams getServerSslParams() { return SslConnectionParams.forServer(getConfiguration()); }
public int getMaxReplicationThreads(MasterMonitorInfo mmi) { int activeTservers = mmi.getTServerInfoSize(); // The number of threads each tserver will use at most to replicate data int replicationThreadsPerServer = Integer .parseInt(context.getConfiguration().get(Property.REPLICATION_WORKER_THREADS)); // The total number of "slots" we have to replicate data return activeTservers * replicationThreadsPerServer; }
/** * * @param dataCache * : underlying file can and should be able to handle a null cache * @param indexCache * : underlying file can and should be able to handle a null cache */ public FileManager(AccumuloServerContext context, VolumeManager fs, int maxOpen, Cache<String,Long> fileLenCache, BlockCache dataCache, BlockCache indexCache) { if (maxOpen <= 0) throw new IllegalArgumentException("maxOpen <= 0"); this.context = context; this.dataCache = dataCache; this.indexCache = indexCache; this.fileLenCache = fileLenCache; this.filePermits = new Semaphore(maxOpen, false); this.maxOpen = maxOpen; this.fs = fs; this.openFiles = new HashMap<>(); this.reservedReaders = new HashMap<>(); this.maxIdleTime = context.getConfiguration().getTimeInMillis(Property.TSERV_MAX_IDLE); SimpleTimer.getInstance(context.getConfiguration()).schedule(new IdleFileCloser(), maxIdleTime, maxIdleTime / 2); }
/** * Extract replication peers from system configuration * * @return Configured replication peers */ public Map<String,String> getPeers() { Map<String,String> peers = new HashMap<>(); // Get the defined peers and what ReplicaSystem impl they're using for (Entry<String,String> property : context.getConfiguration() .getAllPropertiesWithPrefix(Property.REPLICATION_PEERS).entrySet()) { String key = property.getKey(); // Filter out cruft that we don't want if (!key.startsWith(Property.REPLICATION_PEER_USER.getKey()) && !key.startsWith(Property.REPLICATION_PEER_PASSWORD.getKey()) && !key.startsWith(Property.REPLICATION_PEER_KEYTAB.getKey())) { String peerName = property.getKey().substring(Property.REPLICATION_PEERS.getKey().length()); Entry<String,String> entry; try { entry = factory.parseReplicaSystemConfiguration(property.getValue()); } catch (Exception e) { log.warn("Could not instantiate ReplicaSystem for {} with configuration {}", property.getKey(), property.getValue(), e); continue; } peers.put(peerName, entry.getKey()); } } return peers; }
@Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { StringBuilder sb = new StringBuilder(); try { Monitor.fetchData(); bannerText = sanitize( Monitor.getContext().getConfiguration().get(Property.MONITOR_BANNER_TEXT)); bannerColor = Monitor.getContext().getConfiguration().get(Property.MONITOR_BANNER_COLOR) .replace("'", "'"); bannerBackground = Monitor.getContext().getConfiguration() .get(Property.MONITOR_BANNER_BACKGROUND).replace("'", "'"); pageStart(req, resp, sb); pageBody(req, resp, sb); pageEnd(req, resp, sb); } catch (Throwable t) { log.error("Error building page " + req.getRequestURI(), t); sb.append("\n<pre>\n"); StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); sb.append(sanitize(sw.getBuffer().toString())); sb.append("</pre>\n"); } finally { resp.getWriter().print(sb); resp.getWriter().flush(); } }
/** * Determine the type of Thrift server to instantiate given the server's configuration. * * @return A {@link ThriftServerType} value to denote the type of Thrift server to construct */ public ThriftServerType getThriftServerType() { AccumuloConfiguration conf = getConfiguration(); if (conf.getBoolean(Property.INSTANCE_RPC_SSL_ENABLED)) { if (conf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) { throw new IllegalStateException( "Cannot create a Thrift server capable of both SASL and SSL"); } return ThriftServerType.SSL; } else if (conf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) { if (conf.getBoolean(Property.INSTANCE_RPC_SSL_ENABLED)) { throw new IllegalStateException( "Cannot create a Thrift server capable of both SASL and SSL"); } return ThriftServerType.SASL; } else { // Lets us control the type of Thrift server created, primarily for benchmarking purposes String serverTypeName = conf.get(Property.GENERAL_RPC_SERVER_TYPE); return ThriftServerType.get(serverTypeName); } }
@Override protected void pageBody(HttpServletRequest req, HttpServletResponse resp, StringBuilder sb) { AccumuloConfiguration conf = Monitor.getContext().getConfiguration(); boolean clear = true; final String dateFormatStr = conf.get(Property.MONITOR_LOG_DATE_FORMAT);
protected Entry<Scanner,UserGroupInformation> getScanner(final StringBuilder sb) throws AccumuloException, AccumuloSecurityException { AccumuloConfiguration conf = Monitor.getContext().getConfiguration(); final boolean saslEnabled = conf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED); UserGroupInformation traceUgi = null;
public EmbeddedWebServer(String host, int port) { server = new Server(); final AccumuloConfiguration conf = Monitor.getContext().getConfiguration(); if (EMPTY.equals(conf.get(Property.MONITOR_SSL_KEYSTORE)) || EMPTY.equals(conf.get(Property.MONITOR_SSL_KEYSTOREPASS))
final ThriftClientHandler tch = new ThriftClientHandler(context, watcher); Processor<Iface> processor = new Processor<Iface>(tch); ServerAddress serverPort = TServerUtils.startTServer(context.getConfiguration(), ThriftServerType.CUSTOM_HS_HA, processor, "ZombieTServer", "walking dead", 2, 1, 1000, 10 * 1024 * 1024, null, null, -1, HostAndPort.fromParts("0.0.0.0", port));
LogService.startLogListener(Monitor.getContext().getConfiguration(), instance.getInstanceID(), advertiseHost); } else {
gcStatus = label + " " + DateFormat.getInstance().format(new Date(start)); gcStatus = gcStatus.replace(" ", " "); long normalDelay = Monitor.getContext().getConfiguration() .getTimeInMillis(Property.GC_CYCLE_DELAY); if (diff > normalDelay * 2)
Property timeBetweenThreadChecksProperty, Property maxMessageSizeProperty) throws UnknownHostException { final AccumuloConfiguration config = service.getConfiguration();
Monitor.getContext().getConfiguration());
watcher); Processor<Iface> processor = new Processor<Iface>(tch); TServerUtils.startTServer(context.getConfiguration(), ThriftServerType.CUSTOM_HS_HA, processor, "NullTServer", "null tserver", 2, 1, 1000, 10 * 1024 * 1024, null, null, -1, HostAndPort.fromParts("0.0.0.0", opts.port));
getContext().getConfiguration().getTimeInMillis(Property.MONITOR_LOCK_CHECK_INTERVAL), TimeUnit.MILLISECONDS);