001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.rest;
019
020import java.lang.management.ManagementFactory;
021import java.net.UnknownHostException;
022import java.util.ArrayList;
023import java.util.EnumSet;
024import java.util.List;
025import java.util.Map;
026import java.util.concurrent.ArrayBlockingQueue;
027import javax.servlet.DispatcherType;
028import org.apache.commons.lang3.ArrayUtils;
029import org.apache.commons.lang3.StringUtils;
030import org.apache.hadoop.conf.Configuration;
031import org.apache.hadoop.hbase.HBaseConfiguration;
032import org.apache.hadoop.hbase.HBaseInterfaceAudience;
033import org.apache.hadoop.hbase.ServerName;
034import org.apache.hadoop.hbase.http.ClickjackingPreventionFilter;
035import org.apache.hadoop.hbase.http.HttpServerUtil;
036import org.apache.hadoop.hbase.http.InfoServer;
037import org.apache.hadoop.hbase.http.SecurityHeadersFilter;
038import org.apache.hadoop.hbase.log.HBaseMarkers;
039import org.apache.hadoop.hbase.rest.filter.AuthFilter;
040import org.apache.hadoop.hbase.rest.filter.GzipFilter;
041import org.apache.hadoop.hbase.rest.filter.RestCsrfPreventionFilter;
042import org.apache.hadoop.hbase.security.UserProvider;
043import org.apache.hadoop.hbase.util.DNS;
044import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
045import org.apache.hadoop.hbase.util.Pair;
046import org.apache.hadoop.hbase.util.ReflectionUtils;
047import org.apache.hadoop.hbase.util.Strings;
048import org.apache.hadoop.hbase.util.VersionInfo;
049import org.apache.yetus.audience.InterfaceAudience;
050import org.slf4j.Logger;
051import org.slf4j.LoggerFactory;
052
053import org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
054import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
055import org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine;
056import org.apache.hbase.thirdparty.org.apache.commons.cli.HelpFormatter;
057import org.apache.hbase.thirdparty.org.apache.commons.cli.Options;
058import org.apache.hbase.thirdparty.org.apache.commons.cli.ParseException;
059import org.apache.hbase.thirdparty.org.apache.commons.cli.PosixParser;
060import org.apache.hbase.thirdparty.org.eclipse.jetty.http.HttpVersion;
061import org.apache.hbase.thirdparty.org.eclipse.jetty.jmx.MBeanContainer;
062import org.apache.hbase.thirdparty.org.eclipse.jetty.server.HttpConfiguration;
063import org.apache.hbase.thirdparty.org.eclipse.jetty.server.HttpConnectionFactory;
064import org.apache.hbase.thirdparty.org.eclipse.jetty.server.SecureRequestCustomizer;
065import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server;
066import org.apache.hbase.thirdparty.org.eclipse.jetty.server.ServerConnector;
067import org.apache.hbase.thirdparty.org.eclipse.jetty.server.SslConnectionFactory;
068import org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterHolder;
069import org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler;
070import org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder;
071import org.apache.hbase.thirdparty.org.eclipse.jetty.util.ssl.SslContextFactory;
072import org.apache.hbase.thirdparty.org.eclipse.jetty.util.thread.QueuedThreadPool;
073import org.apache.hbase.thirdparty.org.glassfish.jersey.server.ResourceConfig;
074import org.apache.hbase.thirdparty.org.glassfish.jersey.servlet.ServletContainer;
075
076/**
077 * Main class for launching REST gateway as a servlet hosted by Jetty.
078 * <p>
079 * The following options are supported:
080 * <ul>
081 * <li>-p --port : service port</li>
082 * <li>-ro --readonly : server mode</li>
083 * </ul>
084 */
085@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS)
086public class RESTServer implements Constants {
087  static Logger LOG = LoggerFactory.getLogger("RESTServer");
088  public static final String REST_SERVER = "rest";
089
090  static final String REST_CSRF_ENABLED_KEY = "hbase.rest.csrf.enabled";
091  static final boolean REST_CSRF_ENABLED_DEFAULT = false;
092  boolean restCSRFEnabled = false;
093  static final String REST_CSRF_CUSTOM_HEADER_KEY = "hbase.rest.csrf.custom.header";
094  static final String REST_CSRF_CUSTOM_HEADER_DEFAULT = "X-XSRF-HEADER";
095  static final String REST_CSRF_METHODS_TO_IGNORE_KEY = "hbase.rest.csrf.methods.to.ignore";
096  static final String REST_CSRF_METHODS_TO_IGNORE_DEFAULT = "GET,OPTIONS,HEAD,TRACE";
097  public static final String SKIP_LOGIN_KEY = "hbase.rest.skip.login";
098  static final int DEFAULT_HTTP_MAX_HEADER_SIZE = 64 * 1024; // 64k
099  static final String HTTP_HEADER_CACHE_SIZE = "hbase.rest.http.header.cache.size";
100  static final int DEFAULT_HTTP_HEADER_CACHE_SIZE = Character.MAX_VALUE - 1;
101
102  private static final String PATH_SPEC_ANY = "/*";
103
104  static final String REST_HTTP_ALLOW_OPTIONS_METHOD = "hbase.rest.http.allow.options.method";
105  // HTTP OPTIONS method is commonly used in REST APIs for negotiation. So it is enabled by default.
106  private static boolean REST_HTTP_ALLOW_OPTIONS_METHOD_DEFAULT = true;
107  static final String REST_CSRF_BROWSER_USERAGENTS_REGEX_KEY =
108    "hbase.rest-csrf.browser-useragents-regex";
109
110  // HACK, making this static for AuthFilter to get at our configuration. Necessary for unit tests.
111  @edu.umd.cs.findbugs.annotations.SuppressWarnings(
112      value = { "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", "MS_CANNOT_BE_FINAL" },
113      justification = "For testing")
114  public static Configuration conf = null;
115  private final UserProvider userProvider;
116  private Server server;
117  private InfoServer infoServer;
118  private ServerName serverName;
119
120  public RESTServer(Configuration conf) {
121    RESTServer.conf = conf;
122    this.userProvider = UserProvider.instantiate(conf);
123  }
124
125  private static void printUsageAndExit(Options options, int exitCode) {
126    HelpFormatter formatter = new HelpFormatter();
127    formatter.printHelp("hbase rest start", "", options,
128      "\nTo run the REST server as a daemon, execute "
129        + "hbase-daemon.sh start|stop rest [-i <port>] [-p <port>] [-ro]\n",
130      true);
131    System.exit(exitCode);
132  }
133
134  void addCSRFFilter(ServletContextHandler ctxHandler, Configuration conf) {
135    restCSRFEnabled = conf.getBoolean(REST_CSRF_ENABLED_KEY, REST_CSRF_ENABLED_DEFAULT);
136    if (restCSRFEnabled) {
137      Map<String, String> restCsrfParams =
138        RestCsrfPreventionFilter.getFilterParams(conf, "hbase.rest-csrf.");
139      FilterHolder holder = new FilterHolder();
140      holder.setName("csrf");
141      holder.setClassName(RestCsrfPreventionFilter.class.getName());
142      holder.setInitParameters(restCsrfParams);
143      ctxHandler.addFilter(holder, PATH_SPEC_ANY, EnumSet.allOf(DispatcherType.class));
144    }
145  }
146
147  private void addClickjackingPreventionFilter(ServletContextHandler ctxHandler,
148    Configuration conf) {
149    FilterHolder holder = new FilterHolder();
150    holder.setName("clickjackingprevention");
151    holder.setClassName(ClickjackingPreventionFilter.class.getName());
152    holder.setInitParameters(ClickjackingPreventionFilter.getDefaultParameters(conf));
153    ctxHandler.addFilter(holder, PATH_SPEC_ANY, EnumSet.allOf(DispatcherType.class));
154  }
155
156  private void addSecurityHeadersFilter(ServletContextHandler ctxHandler, Configuration conf,
157    boolean isSecure) {
158    FilterHolder holder = new FilterHolder();
159    holder.setName("securityheaders");
160    holder.setClassName(SecurityHeadersFilter.class.getName());
161    holder.setInitParameters(SecurityHeadersFilter.getDefaultParameters(conf, isSecure));
162    ctxHandler.addFilter(holder, PATH_SPEC_ANY, EnumSet.allOf(DispatcherType.class));
163  }
164
165  // login the server principal (if using secure Hadoop)
166  private static Pair<FilterHolder, Class<? extends ServletContainer>>
167    loginServerPrincipal(UserProvider userProvider, Configuration conf) throws Exception {
168    Class<? extends ServletContainer> containerClass = ServletContainer.class;
169    if (userProvider.isHadoopSecurityEnabled() && userProvider.isHBaseSecurityEnabled()) {
170      String machineName = getHostName(conf);
171      String keytabFilename = conf.get(REST_KEYTAB_FILE);
172      Preconditions.checkArgument(keytabFilename != null && !keytabFilename.isEmpty(),
173        REST_KEYTAB_FILE + " should be set if security is enabled");
174      String principalConfig = conf.get(REST_KERBEROS_PRINCIPAL);
175      Preconditions.checkArgument(principalConfig != null && !principalConfig.isEmpty(),
176        REST_KERBEROS_PRINCIPAL + " should be set if security is enabled");
177      // Hook for unit tests, this will log out any other user and mess up tests.
178      if (!conf.getBoolean(SKIP_LOGIN_KEY, false)) {
179        userProvider.login(REST_KEYTAB_FILE, REST_KERBEROS_PRINCIPAL, machineName);
180      }
181      if (conf.get(REST_AUTHENTICATION_TYPE) != null) {
182        containerClass = RESTServletContainer.class;
183        FilterHolder authFilter = new FilterHolder();
184        authFilter.setClassName(AuthFilter.class.getName());
185        authFilter.setName("AuthenticationFilter");
186        return new Pair<>(authFilter, containerClass);
187      }
188    }
189    return new Pair<>(null, containerClass);
190  }
191
192  private static void parseCommandLine(String[] args, Configuration conf) {
193    Options options = new Options();
194    options.addOption("p", "port", true, "Port to bind to [default: " + DEFAULT_LISTEN_PORT + "]");
195    options.addOption("ro", "readonly", false,
196      "Respond only to GET HTTP " + "method requests [default: false]");
197    options.addOption("i", "infoport", true, "Port for WEB UI");
198
199    CommandLine commandLine = null;
200    try {
201      commandLine = new PosixParser().parse(options, args);
202    } catch (ParseException e) {
203      LOG.error("Could not parse: ", e);
204      printUsageAndExit(options, -1);
205    }
206
207    // check for user-defined port setting, if so override the conf
208    if (commandLine != null && commandLine.hasOption("port")) {
209      String val = commandLine.getOptionValue("port");
210      conf.setInt("hbase.rest.port", Integer.parseInt(val));
211      if (LOG.isDebugEnabled()) {
212        LOG.debug("port set to " + val);
213      }
214    }
215
216    // check if server should only process GET requests, if so override the conf
217    if (commandLine != null && commandLine.hasOption("readonly")) {
218      conf.setBoolean("hbase.rest.readonly", true);
219      if (LOG.isDebugEnabled()) {
220        LOG.debug("readonly set to true");
221      }
222    }
223
224    // check for user-defined info server port setting, if so override the conf
225    if (commandLine != null && commandLine.hasOption("infoport")) {
226      String val = commandLine.getOptionValue("infoport");
227      conf.setInt("hbase.rest.info.port", Integer.parseInt(val));
228      if (LOG.isDebugEnabled()) {
229        LOG.debug("WEB UI port set to " + val);
230      }
231    }
232
233    if (commandLine != null && commandLine.hasOption("skipLogin")) {
234      conf.setBoolean(SKIP_LOGIN_KEY, true);
235      if (LOG.isDebugEnabled()) {
236        LOG.debug("Skipping Kerberos login for REST server");
237      }
238    }
239
240    List<String> remainingArgs = commandLine != null ? commandLine.getArgList() : new ArrayList<>();
241    if (remainingArgs.size() != 1) {
242      printUsageAndExit(options, 1);
243    }
244
245    String command = remainingArgs.get(0);
246    if ("start".equals(command)) {
247      // continue and start container
248    } else if ("stop".equals(command)) {
249      System.exit(1);
250    } else {
251      printUsageAndExit(options, 1);
252    }
253  }
254
255  /**
256   * Runs the REST server.
257   */
258  public synchronized void run() throws Exception {
259    Pair<FilterHolder, Class<? extends ServletContainer>> pair =
260      loginServerPrincipal(userProvider, conf);
261    FilterHolder authFilter = pair.getFirst();
262    Class<? extends ServletContainer> containerClass = pair.getSecond();
263    RESTServlet servlet = RESTServlet.getInstance(conf, userProvider);
264
265    // set up the Jersey servlet container for Jetty
266    ResourceConfig application = new ResourceConfig().packages("org.apache.hadoop.hbase.rest")
267      .register(JacksonJaxbJsonProvider.class);
268    // Using our custom ServletContainer is tremendously important. This is what makes sure the
269    // UGI.doAs() is done for the remoteUser, and calls are not made as the REST server itself.
270    ServletContainer servletContainer = ReflectionUtils.newInstance(containerClass, application);
271    ServletHolder sh = new ServletHolder(servletContainer);
272
273    // Set the default max thread number to 100 to limit
274    // the number of concurrent requests so that REST server doesn't OOM easily.
275    // Jetty set the default max thread number to 250, if we don't set it.
276    //
277    // Our default min thread number 2 is the same as that used by Jetty.
278    int maxThreads = servlet.getConfiguration().getInt(REST_THREAD_POOL_THREADS_MAX, 100);
279    int minThreads = servlet.getConfiguration().getInt(REST_THREAD_POOL_THREADS_MIN, 2);
280    // Use the default queue (unbounded with Jetty 9.3) if the queue size is negative, otherwise use
281    // bounded {@link ArrayBlockingQueue} with the given size
282    int queueSize = servlet.getConfiguration().getInt(REST_THREAD_POOL_TASK_QUEUE_SIZE, -1);
283    int idleTimeout =
284      servlet.getConfiguration().getInt(REST_THREAD_POOL_THREAD_IDLE_TIMEOUT, 60000);
285    QueuedThreadPool threadPool = queueSize > 0
286      ? new QueuedThreadPool(maxThreads, minThreads, idleTimeout,
287        new ArrayBlockingQueue<>(queueSize))
288      : new QueuedThreadPool(maxThreads, minThreads, idleTimeout);
289
290    this.server = new Server(threadPool);
291
292    // Setup JMX
293    MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
294    server.addEventListener(mbContainer);
295    server.addBean(mbContainer);
296
297    String host = servlet.getConfiguration().get("hbase.rest.host", "0.0.0.0");
298    int servicePort = servlet.getConfiguration().getInt("hbase.rest.port", 8080);
299    int httpHeaderCacheSize =
300      servlet.getConfiguration().getInt(HTTP_HEADER_CACHE_SIZE, DEFAULT_HTTP_HEADER_CACHE_SIZE);
301    HttpConfiguration httpConfig = new HttpConfiguration();
302    httpConfig.setSecureScheme("https");
303    httpConfig.setSecurePort(servicePort);
304    httpConfig.setHeaderCacheSize(httpHeaderCacheSize);
305    httpConfig.setRequestHeaderSize(DEFAULT_HTTP_MAX_HEADER_SIZE);
306    httpConfig.setResponseHeaderSize(DEFAULT_HTTP_MAX_HEADER_SIZE);
307    httpConfig.setSendServerVersion(false);
308    httpConfig.setSendDateHeader(false);
309
310    ServerConnector serverConnector;
311    boolean isSecure = false;
312    if (conf.getBoolean(REST_SSL_ENABLED, false)) {
313      isSecure = true;
314      HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
315      httpsConfig.addCustomizer(new SecureRequestCustomizer());
316
317      SslContextFactory.Server sslCtxFactory = new SslContextFactory.Server();
318      String keystore = conf.get(REST_SSL_KEYSTORE_STORE);
319      String keystoreType = conf.get(REST_SSL_KEYSTORE_TYPE);
320      String password = HBaseConfiguration.getPassword(conf, REST_SSL_KEYSTORE_PASSWORD, null);
321      String keyPassword =
322        HBaseConfiguration.getPassword(conf, REST_SSL_KEYSTORE_KEYPASSWORD, password);
323      sslCtxFactory.setKeyStorePath(keystore);
324      if (StringUtils.isNotBlank(keystoreType)) {
325        sslCtxFactory.setKeyStoreType(keystoreType);
326      }
327      sslCtxFactory.setKeyStorePassword(password);
328      sslCtxFactory.setKeyManagerPassword(keyPassword);
329
330      String trustStore = conf.get(REST_SSL_TRUSTSTORE_STORE);
331      if (StringUtils.isNotBlank(trustStore)) {
332        sslCtxFactory.setTrustStorePath(trustStore);
333      }
334      String trustStorePassword =
335        HBaseConfiguration.getPassword(conf, REST_SSL_TRUSTSTORE_PASSWORD, null);
336      if (StringUtils.isNotBlank(trustStorePassword)) {
337        sslCtxFactory.setTrustStorePassword(trustStorePassword);
338      }
339      String trustStoreType = conf.get(REST_SSL_TRUSTSTORE_TYPE);
340      if (StringUtils.isNotBlank(trustStoreType)) {
341        sslCtxFactory.setTrustStoreType(trustStoreType);
342      }
343
344      String[] excludeCiphers = servlet.getConfiguration()
345        .getStrings(REST_SSL_EXCLUDE_CIPHER_SUITES, ArrayUtils.EMPTY_STRING_ARRAY);
346      if (excludeCiphers.length != 0) {
347        sslCtxFactory.setExcludeCipherSuites(excludeCiphers);
348      }
349      String[] includeCiphers = servlet.getConfiguration()
350        .getStrings(REST_SSL_INCLUDE_CIPHER_SUITES, ArrayUtils.EMPTY_STRING_ARRAY);
351      if (includeCiphers.length != 0) {
352        sslCtxFactory.setIncludeCipherSuites(includeCiphers);
353      }
354
355      String[] excludeProtocols = servlet.getConfiguration().getStrings(REST_SSL_EXCLUDE_PROTOCOLS,
356        ArrayUtils.EMPTY_STRING_ARRAY);
357      if (excludeProtocols.length != 0) {
358        sslCtxFactory.setExcludeProtocols(excludeProtocols);
359      }
360      String[] includeProtocols = servlet.getConfiguration().getStrings(REST_SSL_INCLUDE_PROTOCOLS,
361        ArrayUtils.EMPTY_STRING_ARRAY);
362      if (includeProtocols.length != 0) {
363        sslCtxFactory.setIncludeProtocols(includeProtocols);
364      }
365
366      serverConnector = new ServerConnector(server,
367        new SslConnectionFactory(sslCtxFactory, HttpVersion.HTTP_1_1.toString()),
368        new HttpConnectionFactory(httpsConfig));
369    } else {
370      serverConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
371    }
372
373    int acceptQueueSize = servlet.getConfiguration().getInt(REST_CONNECTOR_ACCEPT_QUEUE_SIZE, -1);
374    if (acceptQueueSize >= 0) {
375      serverConnector.setAcceptQueueSize(acceptQueueSize);
376    }
377
378    serverConnector.setPort(servicePort);
379    serverConnector.setHost(host);
380
381    server.addConnector(serverConnector);
382    server.setStopAtShutdown(true);
383
384    // set up context
385    ServletContextHandler ctxHandler =
386      new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
387    ctxHandler.addServlet(sh, PATH_SPEC_ANY);
388    if (authFilter != null) {
389      ctxHandler.addFilter(authFilter, PATH_SPEC_ANY, EnumSet.of(DispatcherType.REQUEST));
390    }
391
392    // Load filters from configuration.
393    String[] filterClasses =
394      servlet.getConfiguration().getStrings(FILTER_CLASSES, GzipFilter.class.getName());
395    for (String filter : filterClasses) {
396      filter = filter.trim();
397      ctxHandler.addFilter(filter, PATH_SPEC_ANY, EnumSet.of(DispatcherType.REQUEST));
398    }
399    addCSRFFilter(ctxHandler, conf);
400    addClickjackingPreventionFilter(ctxHandler, conf);
401    addSecurityHeadersFilter(ctxHandler, conf, isSecure);
402    HttpServerUtil.constrainHttpMethods(ctxHandler, servlet.getConfiguration()
403      .getBoolean(REST_HTTP_ALLOW_OPTIONS_METHOD, REST_HTTP_ALLOW_OPTIONS_METHOD_DEFAULT));
404
405    // Put up info server.
406    int port = conf.getInt("hbase.rest.info.port", 8085);
407    if (port >= 0) {
408      final long startCode = EnvironmentEdgeManager.currentTime();
409      conf.setLong("startcode", startCode);
410      this.serverName = ServerName.valueOf(getHostName(conf), servicePort, startCode);
411
412      String addr = conf.get("hbase.rest.info.bindAddress", "0.0.0.0");
413      this.infoServer = new InfoServer(REST_SERVER, addr, port, false, conf);
414      this.infoServer.addPrivilegedServlet("dump", "/dump", RESTDumpServlet.class);
415      this.infoServer.setAttribute(REST_SERVER, this);
416      this.infoServer.setAttribute("hbase.conf", conf);
417      this.infoServer.start();
418    }
419    // start server
420    server.start();
421  }
422
423  private static String getHostName(Configuration conf) throws UnknownHostException {
424    return Strings.domainNamePointerToHostName(DNS.getDefaultHost(
425      conf.get(REST_DNS_INTERFACE, "default"), conf.get(REST_DNS_NAMESERVER, "default")));
426  }
427
428  public synchronized void join() throws Exception {
429    if (server == null) {
430      throw new IllegalStateException("Server is not running");
431    }
432    server.join();
433  }
434
435  private void stopInfoServer() {
436    if (this.infoServer != null) {
437      LOG.info("Stop info server");
438      try {
439        this.infoServer.stop();
440      } catch (Exception e) {
441        LOG.error("Failed to stop infoServer", e);
442      }
443    }
444  }
445
446  public synchronized void stop() throws Exception {
447    stopInfoServer();
448    if (server == null) {
449      throw new IllegalStateException("Server is not running");
450    }
451    server.stop();
452    server = null;
453    RESTServlet.stop();
454  }
455
456  public synchronized int getPort() {
457    if (server == null) {
458      throw new IllegalStateException("Server is not running");
459    }
460    return ((ServerConnector) server.getConnectors()[0]).getLocalPort();
461  }
462
463  @SuppressWarnings("deprecation")
464  public synchronized int getInfoPort() {
465    if (infoServer == null) {
466      throw new IllegalStateException("InfoServer is not running");
467    }
468    return infoServer.getPort();
469  }
470
471  public ServerName getServerName() {
472    return serverName;
473  }
474
475  public Configuration getConf() {
476    return conf;
477  }
478
479  /**
480   * The main method for the HBase rest server.
481   * @param args command-line arguments
482   * @throws Exception exception
483   */
484  public static void main(String[] args) throws Exception {
485    LOG.info("***** STARTING service '" + RESTServer.class.getSimpleName() + "' *****");
486    VersionInfo.logVersion();
487    final Configuration conf = HBaseConfiguration.create();
488    parseCommandLine(args, conf);
489    RESTServer server = new RESTServer(conf);
490
491    try {
492      server.run();
493      server.join();
494    } catch (Exception e) {
495      LOG.error(HBaseMarkers.FATAL, "Failed to start server", e);
496      System.exit(1);
497    }
498
499    LOG.info("***** STOPPING service '" + RESTServer.class.getSimpleName() + "' *****");
500  }
501}