/** * 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)); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
@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); }
@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); }