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

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.hadoop.conf.Configuration
     
    protected boolean
     
     
    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 boolean
     
    protected org.apache.hadoop.security.UserGroupInformation
     
    protected org.apache.thrift.server.TServer
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ThriftServer(org.apache.hadoop.conf.Configuration conf)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.Options options)
    Add options to command lines
    protected void
    checkHttpSecurity(SaslUtil.QualityOfProtection qop, org.apache.hadoop.conf.Configuration conf)
     
    protected ExecutorService
    createExecutor(BlockingQueue<Runnable> callQueue, int minWorkers, int maxWorkers)
     
    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 server
    protected 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 only
    protected 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 only
    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)
     
    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
    main(String[] args)
     
    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
    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 arguments
    int
    run(String[] strings)
     
    protected void
    Setup an HTTP Server using Jetty to serve calls from THttpClient
    protected void
     
    protected void
    Setting up the thrift TServer
    protected void
     
    void
     

    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

  • Constructor Details

    • ThriftServer

      public ThriftServer(org.apache.hadoop.conf.Configuration conf)
  • Method Details

    • createThriftMetrics

      protected ThriftMetrics createThriftMetrics(org.apache.hadoop.conf.Configuration conf)
    • setupParamters

      protected void setupParamters() throws IOException
      Throws:
      IOException
    • getSpengoPrincipal

      private String getSpengoPrincipal(org.apache.hadoop.conf.Configuration conf, String host) throws IOException
      Throws:
      IOException
    • getSpnegoKeytab

      private String getSpnegoKeytab(org.apache.hadoop.conf.Configuration conf)
    • startInfoServer

      protected void startInfoServer() throws IOException
      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

      protected org.apache.thrift.TProcessor createProcessor()
    • getTserver

      @Private public org.apache.thrift.server.TServer getTserver()
      the thrift server, not null means the server is started, for test only
      Returns:
      the tServer
    • getHttpServer

      @Private public org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server 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

      protected void setupHTTPServer() throws IOException
      Setup an HTTP Server using Jetty to serve calls from THttpClient
      Throws:
      IOException - IOException
    • setupServer

      protected void setupServer() throws Exception
      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

      protected org.apache.thrift.protocol.TProtocolFactory 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

      public static void registerFilters(org.apache.hadoop.conf.Configuration conf)
    • addOptions

      protected void addOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.Options options)
      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

      protected void processOptions(String[] args) throws Exception
      Parse the command line options to set parameters the conf.
      Throws:
      Exception
    • stop

      public void 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

      public int run() throws Exception
      Run without any command line arguments
      Returns:
      exit code
      Throws:
      Exception - exception
    • run

      public int run(String[] strings) throws Exception
      Specified by:
      run in interface org.apache.hadoop.util.Tool
      Throws:
      Exception
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception