/** * Start up or shuts down the Thrift server, depending on the arguments. * @param args */ void doMain(final String[] args) throws Exception { processOptions(args); serverRunner = new ThriftServerRunner(conf); // Put up info server. int port = conf.getInt("hbase.thrift.info.port", 9095); if (port >= 0) { conf.setLong("startcode", System.currentTimeMillis()); String a = conf.get("hbase.thrift.info.bindAddress", "0.0.0.0"); infoServer = new InfoServer("thrift", a, port, false, conf); infoServer.setAttribute("hbase.conf", conf); infoServer.start(); } serverRunner.run(); }
/** * Stop ThriftServer */ void shutdown() { serverRunner.shutdown(); }
CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<Call>(), metrics); ExecutorService executorService = createExecutor( callQueue, serverArgs.getWorkerThreads()); serverArgs.executorService(executorService) CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<Call>(), metrics); ExecutorService executorService = createExecutor( callQueue, serverArgs.getWorkerThreads()); serverArgs.executorService(executorService) } else if (implType == ImplType.THREAD_POOL) { InetAddress listenAddress = getBindAddress(conf); registerFilters(conf);
/** * Create an instance of the glue object that connects the * RegionServer with the standard ThriftServer implementation */ HRegionThriftServer(HRegionServer regionServer, Configuration conf) throws IOException { super("Region Thrift Server"); this.rs = regionServer; this.serverRunner = new ThriftServerRunner(conf, new HBaseHandlerRegion(conf)); }
public void doTestFilterRegistration() throws Exception { Configuration conf = UTIL.getConfiguration(); conf.set("hbase.thrift.filters", "MyFilter:filterclass"); ThriftServerRunner.registerFilters(conf); Map<String, String> registeredFilters = ParseFilter.getAllFilters(); assertEquals("filterclass", registeredFilters.get("MyFilter")); }
serverConnector.setHost(getBindAddress(conf).getHostAddress()); httpServer.addConnector(serverConnector); httpServer.setStopAtShutdown(true);
@Override public void run() { serverRunner.run(); }
QualityOfProtection.PRIVACY.name())); checkHttpSecurity(qop, conf); if (!securityEnabled) { throw new IOException("Thrift server must run in secure mode to support authentication");
InetAddress listenAddress = getBindAddress(conf); TNonblockingServerTransport serverTransport = new TNonblockingServerSocket( new InetSocketAddress(listenAddress, listenPort)); THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport); CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics); ExecutorService executorService = createExecutor( callQueue, serverArgs.getMaxWorkerThreads(), serverArgs.getMaxWorkerThreads()); serverArgs.executorService(executorService) new HThreadedSelectorServerArgs(serverTransport, conf); CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics); ExecutorService executorService = createExecutor( callQueue, serverArgs.getWorkerThreads(), serverArgs.getWorkerThreads()); serverArgs.executorService(executorService) } else if (implType == ImplType.THREAD_POOL) { InetAddress listenAddress = getBindAddress(conf); int readTimeout = conf.getInt(THRIFT_SERVER_SOCKET_READ_TIMEOUT_KEY, THRIFT_SERVER_SOCKET_READ_TIMEOUT_DEFAULT); registerFilters(conf);
@Test public void testExceptionThrownWhenMisConfigured() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.set("hbase.thrift.security.qop", "privacy"); conf.setBoolean("hbase.thrift.ssl.enabled", false); ThriftServerRunner runner = null; ExpectedException thrown = ExpectedException.none(); try { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false"); runner = new ThriftServerRunner(conf); fail("Thrift HTTP Server starts up even with wrong security configurations."); } catch (Exception e) { } assertNull(runner); }
public void doTestFilterRegistration() throws Exception { Configuration conf = UTIL.getConfiguration(); conf.set("hbase.thrift.filters", "MyFilter:filterclass"); ThriftServerRunner.registerFilters(conf); Map<String, String> registeredFilters = ParseFilter.getAllFilters(); assertEquals("filterclass", registeredFilters.get("MyFilter")); }
String host = getBindAddress(conf).getHostAddress(); serverConnector.setHost(host); httpServer.addConnector(serverConnector);
QualityOfProtection.PRIVACY.name())); checkHttpSecurity(qop, conf); if (!securityEnabled) { throw new IOException("Thrift server must"
InetAddress listenAddress = getBindAddress(conf); TNonblockingServerTransport serverTransport = new TNonblockingServerSocket( new InetSocketAddress(listenAddress, listenPort)); THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport); CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics); ExecutorService executorService = createExecutor( callQueue, serverArgs.getMaxWorkerThreads(), serverArgs.getMaxWorkerThreads()); serverArgs.executorService(executorService) new HThreadedSelectorServerArgs(serverTransport, conf); CallQueue callQueue = new CallQueue(new LinkedBlockingQueue<>(), metrics); ExecutorService executorService = createExecutor( callQueue, serverArgs.getWorkerThreads(), serverArgs.getWorkerThreads()); serverArgs.executorService(executorService) } else if (implType == ImplType.THREAD_POOL) { InetAddress listenAddress = getBindAddress(conf); int readTimeout = conf.getInt(THRIFT_SERVER_SOCKET_READ_TIMEOUT_KEY, THRIFT_SERVER_SOCKET_READ_TIMEOUT_DEFAULT); registerFilters(conf);
/** * Start up or shuts down the Thrift server, depending on the arguments. * @param args */ void doMain(final String[] args) throws Exception { processOptions(args); serverRunner = new ThriftServerRunner(conf); // Put up info server. int port = conf.getInt("hbase.thrift.info.port", 9095); if (port >= 0) { conf.setLong("startcode", System.currentTimeMillis()); String a = conf.get("hbase.thrift.info.bindAddress", "0.0.0.0"); infoServer = new InfoServer("thrift", a, port, false, conf); infoServer.setAttribute("hbase.conf", conf); infoServer.start(); } serverRunner.run(); }
@Test public void testExceptionThrownWhenMisConfigured() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.set("hbase.thrift.security.qop", "privacy"); conf.setBoolean("hbase.thrift.ssl.enabled", false); ThriftServerRunner runner = null; ExpectedException thrown = ExpectedException.none(); try { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false"); runner = new ThriftServerRunner(conf); fail("Thrift HTTP Server starts up even with wrong security configurations."); } catch (Exception e) { } assertNull(runner); }
public void stop() { if (this.infoServer != null) { LOG.info("Stopping infoServer"); try { this.infoServer.stop(); } catch (Exception ex) { ex.printStackTrace(); } } serverRunner.shutdown(); }
/** * Start up or shuts down the Thrift server, depending on the arguments. * @param args */ void doMain(final String[] args) throws Exception { processOptions(args); // login the server principal (if using secure Hadoop) if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) { String machineName = Strings.domainNamePointerToHostName( DNS.getDefaultHost(conf.get("hbase.thrift.dns.interface", "default"), conf.get("hbase.thrift.dns.nameserver", "default"))); User.login(conf, "hbase.thrift.keytab.file", "hbase.thrift.kerberos.principal", machineName); } serverRunner = new ThriftServerRunner(conf); // Put up info server. int port = conf.getInt("hbase.thrift.info.port", 9095); if (port >= 0) { conf.setLong("startcode", System.currentTimeMillis()); String a = conf.get("hbase.thrift.info.bindAddress", "0.0.0.0"); infoServer = new InfoServer("thrift", a, port, false, conf); infoServer.setAttribute("hbase.conf", conf); infoServer.start(); } serverRunner.run(); }
public void stop() { if (this.infoServer != null) { LOG.info("Stopping infoServer"); try { this.infoServer.stop(); } catch (Exception ex) { ex.printStackTrace(); } } serverRunner.shutdown(); }
public void stop() { if (this.infoServer != null) { LOG.info("Stopping infoServer"); try { this.infoServer.stop(); } catch (Exception ex) { ex.printStackTrace(); } } serverRunner.shutdown(); }