Package org.apache.hadoop.hbase.thrift
Class ThriftServer
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.hbase.thrift.ThriftServer
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
- Direct Known Subclasses:
ThriftServer
@LimitedPrivate("Tools")
public class ThriftServer
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.util.Tool
ThriftServer- this class starts up a Thrift server which implements the Hbase API specified in
the Hbase.thrift IDL file. The server runs in an independent process.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.hadoop.conf.Configurationprotected booleanprotected HBaseServiceHandlerprotected Stringprotected booleanprotected org.apache.hbase.thirdparty.org.eclipse.jetty.server.Serverprotected org.apache.hadoop.security.UserGroupInformationprotected InfoServerprotected intprivate static final org.slf4j.Loggerprotected ThriftMetricsprotected JvmPauseMonitorprotected org.apache.thrift.TProcessorprotected SaslUtil.QualityOfProtectionprotected booleanprotected org.apache.hadoop.security.UserGroupInformationprotected org.apache.thrift.server.TServer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.Options options) Add options to command linesprotected voidcheckHttpSecurity(SaslUtil.QualityOfProtection qop, org.apache.hadoop.conf.Configuration conf) protected ExecutorServicecreateExecutor(BlockingQueue<Runnable> callQueue, int minWorkers, int maxWorkers) protected HBaseServiceHandlercreateHandler(org.apache.hadoop.conf.Configuration conf, UserProvider userProvider) protected org.apache.thrift.TProcessorprotected ThriftMetricscreateThriftMetrics(org.apache.hadoop.conf.Configuration conf) protected org.apache.thrift.server.TServletcreateTServlet(org.apache.thrift.protocol.TProtocolFactory protocolFactory) Create a Servlet for the http serverprotected InetAddressgetBindAddress(org.apache.hadoop.conf.Configuration conf) org.apache.hbase.thirdparty.org.eclipse.jetty.server.Serverthe Jetty server, not null means the HTTP server is started, for test onlyprotected org.apache.thrift.protocol.TProtocolFactoryprivate StringgetSpengoPrincipal(org.apache.hadoop.conf.Configuration conf, String host) private StringgetSpnegoKeytab(org.apache.hadoop.conf.Configuration conf) protected org.apache.thrift.server.TServergetTHsHaServer(org.apache.thrift.transport.TNonblockingServerTransport serverTransport, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) protected org.apache.thrift.server.TServergetTNonBlockingServer(org.apache.thrift.transport.TNonblockingServerTransport serverTransport, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) org.apache.thrift.server.TServerthe thrift server, not null means the server is started, for test onlyprotected org.apache.thrift.server.TServergetTThreadedSelectorServer(org.apache.thrift.transport.TNonblockingServerTransport serverTransport, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) protected org.apache.thrift.server.TServergetTThreadPoolServer(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) static voidprotected static voidoptionToConf(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd, String option, org.apache.hadoop.conf.Configuration conf, String destConfKey) protected voidparseCommandLine(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd, org.apache.hbase.thirdparty.org.apache.commons.cli.Options options) protected voidprintUsageAndExit(org.apache.hbase.thirdparty.org.apache.commons.cli.Options options, int exitCode) protected voidprocessOptions(String[] args) Parse the command line options to set parameters the conf.static voidregisterFilters(org.apache.hadoop.conf.Configuration conf) intrun()Run without any command line argumentsintprotected voidSetup an HTTP Server using Jetty to serve calls from THttpClientprotected voidprotected voidSetting up the thrift TServerprotected voidvoidstop()Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
LOG
-
conf
-
infoServer
-
processor
-
metrics
-
hbaseServiceHandler
-
serviceUGI
-
httpUGI
-
httpEnabled
-
qop
-
host
-
listenPort
-
securityEnabled
-
doAsEnabled
-
pauseMonitor
-
tserver
-
httpServer
-
-
Constructor Details
-
ThriftServer
-
-
Method Details
-
createThriftMetrics
-
setupParamters
- Throws:
IOException
-
getSpengoPrincipal
private String getSpengoPrincipal(org.apache.hadoop.conf.Configuration conf, String host) throws IOException - Throws:
IOException
-
getSpnegoKeytab
-
startInfoServer
- Throws:
IOException
-
checkHttpSecurity
protected void checkHttpSecurity(SaslUtil.QualityOfProtection qop, org.apache.hadoop.conf.Configuration conf) -
createHandler
protected HBaseServiceHandler createHandler(org.apache.hadoop.conf.Configuration conf, UserProvider userProvider) throws IOException - Throws:
IOException
-
createProcessor
-
getTserver
the thrift server, not null means the server is started, for test only- Returns:
- the tServer
-
getHttpServer
the Jetty server, not null means the HTTP server is started, for test only- Returns:
- the http server
-
printUsageAndExit
protected void printUsageAndExit(org.apache.hbase.thirdparty.org.apache.commons.cli.Options options, int exitCode) throws org.apache.hadoop.util.Shell.ExitCodeException - Throws:
org.apache.hadoop.util.Shell.ExitCodeException
-
createTServlet
protected org.apache.thrift.server.TServlet createTServlet(org.apache.thrift.protocol.TProtocolFactory protocolFactory) Create a Servlet for the http server- Parameters:
protocolFactory- protocolFactory- Returns:
- the servlet
-
setupHTTPServer
Setup an HTTP Server using Jetty to serve calls from THttpClient- Throws:
IOException- IOException
-
setupServer
Setting up the thrift TServer- Throws:
Exception
-
getTNonBlockingServer
protected org.apache.thrift.server.TServer getTNonBlockingServer(org.apache.thrift.transport.TNonblockingServerTransport serverTransport, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) -
getTHsHaServer
protected org.apache.thrift.server.TServer getTHsHaServer(org.apache.thrift.transport.TNonblockingServerTransport serverTransport, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) -
getTThreadedSelectorServer
protected org.apache.thrift.server.TServer getTThreadedSelectorServer(org.apache.thrift.transport.TNonblockingServerTransport serverTransport, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) -
getTThreadPoolServer
protected org.apache.thrift.server.TServer getTThreadPoolServer(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) throws Exception - Throws:
Exception
-
getProtocolFactory
-
createExecutor
protected ExecutorService createExecutor(BlockingQueue<Runnable> callQueue, int minWorkers, int maxWorkers) -
getBindAddress
protected InetAddress getBindAddress(org.apache.hadoop.conf.Configuration conf) throws UnknownHostException - Throws:
UnknownHostException
-
registerFilters
-
addOptions
Add options to command lines- Parameters:
options- options
-
parseCommandLine
protected void parseCommandLine(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd, org.apache.hbase.thirdparty.org.apache.commons.cli.Options options) throws org.apache.hadoop.util.Shell.ExitCodeException - Throws:
org.apache.hadoop.util.Shell.ExitCodeException
-
processOptions
Parse the command line options to set parameters the conf.- Throws:
Exception
-
stop
-
optionToConf
protected static void optionToConf(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd, String option, org.apache.hadoop.conf.Configuration conf, String destConfKey) -
run
Run without any command line arguments- Returns:
- exit code
- Throws:
Exception- exception
-
run
- Specified by:
runin interfaceorg.apache.hadoop.util.Tool- Throws:
Exception
-
main
- Throws:
Exception
-