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
Modifier and TypeFieldDescriptionprotected org.apache.hadoop.conf.Configuration
protected boolean
protected HBaseServiceHandler
protected String
protected boolean
protected org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server
protected org.apache.hadoop.security.UserGroupInformation
protected InfoServer
protected int
private static final org.slf4j.Logger
protected ThriftMetrics
protected JvmPauseMonitor
protected org.apache.thrift.TProcessor
protected SaslUtil.QualityOfProtection
protected boolean
protected org.apache.hadoop.security.UserGroupInformation
protected org.apache.thrift.server.TServer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addOptions
(org.apache.hbase.thirdparty.org.apache.commons.cli.Options options) Add options to command linesprotected void
checkHttpSecurity
(SaslUtil.QualityOfProtection qop, org.apache.hadoop.conf.Configuration conf) protected ExecutorService
createExecutor
(BlockingQueue<Runnable> callQueue, int minWorkers, int maxWorkers) protected HBaseServiceHandler
createHandler
(org.apache.hadoop.conf.Configuration conf, UserProvider userProvider) protected org.apache.thrift.TProcessor
protected ThriftMetrics
createThriftMetrics
(org.apache.hadoop.conf.Configuration conf) protected org.apache.thrift.server.TServlet
createTServlet
(org.apache.thrift.protocol.TProtocolFactory protocolFactory) Create a Servlet for the http serverprotected InetAddress
getBindAddress
(org.apache.hadoop.conf.Configuration conf) org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server
the Jetty server, not null means the HTTP server is started, for test onlyprotected org.apache.thrift.protocol.TProtocolFactory
private String
getSpengoPrincipal
(org.apache.hadoop.conf.Configuration conf, String host) private String
getSpnegoKeytab
(org.apache.hadoop.conf.Configuration conf) 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) 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) org.apache.thrift.server.TServer
the thrift server, not null means the server is started, for test onlyprotected 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) 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) static void
protected static void
optionToConf
(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd, String option, org.apache.hadoop.conf.Configuration conf, String destConfKey) protected void
parseCommandLine
(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd, org.apache.hbase.thirdparty.org.apache.commons.cli.Options options) protected void
printUsageAndExit
(org.apache.hbase.thirdparty.org.apache.commons.cli.Options options, int exitCode) protected void
processOptions
(String[] args) Parse the command line options to set parameters the conf.static void
registerFilters
(org.apache.hadoop.conf.Configuration conf) int
run()
Run without any command line argumentsint
protected void
Setup an HTTP Server using Jetty to serve calls from THttpClientprotected void
protected void
Setting up the thrift TServerprotected void
void
stop()
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
run
in interfaceorg.apache.hadoop.util.Tool
- Throws:
Exception
-
main
- Throws:
Exception
-