Deploying Presto Router

Installing Router

Download the Presto router tarball, presto-router-0.285.1.tar.gz, and unpack it. The tarball will contain a single top-level directory, presto-router-0.285.1, which we will call the installation directory.

Router needs a data directory for storing logs, etc. We recommend creating a data directory outside of the installation directory, which allows it to be easily preserved when upgrading Presto.

Configuring Router

Create an etc directory inside the installation directory. Similar to the installation of Presto, this will hold the following configuration:

  • Node Properties: environmental configuration specific to each node

  • JVM Config: command line options for the Java Virtual Machine

  • Config Properties: configuration for the Presto router

  • Router Properties: configuration and rules for running the router

Node Properties

The node properties file, etc/node.properties, shares the same configuration as the main Presto server. Details can be found at Deploying Presto.

JVM Config

The JVM config file, etc/jvm.config, contains a list of command line options used for launching the Java Virtual Machine.

The following provides an example of etc/jvm.config.

  1. -ea
  2. -XX:+UseG1GC
  3. -XX:G1HeapRegionSize=32M
  4. -XX:+UseGCOverheadLimit
  5. -XX:+ExplicitGCInvokesConcurrent
  6. -Xmx12G

Config Properties

The config properties file, etc/config.properties, contains the configuration for the Presto router web service.

The following provides an example of etc/config.properties.

  1. http-server.http.port=8080
  2. http-server.log.max-history=3
  3. http-server.log.max-size=500MB
  4. router.config-file=etc/router-config.json

If Kerberos authentication is required, adding the following configs:

  1. query-tracker.http-client.authentication.enabled=true
  2. query-tracker.http-client.authentication.krb5.name-type=USER_NAME
  3. query-tracker.http-client.authentication.krb5.principal=presto@REMOTE.BIZ
  4. query-tracker.http-client.authentication.krb5.remote-service-name=HTTP/PRESTO@REMOTE.BIZ
  5. query-tracker.http-client.authentication.krb5.service-principal-pattern=PATTERN

Router Properties

Router properties contain some specific rules to run the router.

The following provides an example of etc/router-config.json.

  1. {
  2. "groups": [
  3. {
  4. "name": "all",
  5. "members": ["http://127.0.0.1:61381", "http://127.0.0.1:61382"],
  6. "weights": [1, 5]
  7. }
  8. ],
  9. "selectors": [
  10. {
  11. "targetGroup": "all"
  12. }
  13. ],
  14. "scheduler": "RANDOM_CHOICE",
  15. "predictor": "http://127.0.0.1:8000/v1"
  16. }

These properties requires some explanation:

  • groups: The groups of Presto clusters. Each group contains a required name and required members. Each group may also contain an optional weights field for members. Weights are used for some weights-related scheduling algorithms such as weighted random choice.

  • selectors: The selectors to select specific Presto clusters. Allow source, user, clientTags, and targetGroup.

  • scheduler: The type of scheduler used in the router service. See Router Schedulers for details. The default is RANDOM_CHOICE.

  • predictor: An optional URI for the query predictor. The router uses the URI to fetch query resource usage information from the predictor for scheduling. The default is http://127.0.0.1:8000/v1.

Running Router

The installation directory contains the launcher script in bin/launcher. Router can be started as a a daemon by running the following:

  1. bin/launcher start

Alternatively, it can be run in the foreground, with the logs and other output being written to stdout/stderr (both streams should be captured if using a supervision system like daemontools):

  1. bin/launcher run