Skip to main content
Version: Next

Pulsar SQL configuration and deployment

You can configure Presto Pulsar connector and deploy a cluster with the following instruction.

Configure Presto Pulsar Connector​

You can configure Presto Pulsar Connector in the ${project.root}/conf/presto/catalog/ properties file. The configuration for the connector and the default values are as follows.

# name of the connector to be displayed in the catalog

# the URL of Pulsar broker service

# the URL of Pulsar broker binary service

# the URL of Zookeeper cluster

# minimum number of entries to read at a single time

# default number of splits to use per query

# max size of one batch message (default value is 5MB)

# number of split used when querying data from Pulsar

# size of queue to buffer entry read from Pulsar

# size of queue to buffer message extract from entries

# status provider to record connector metrics

# config in map format for stats provider e.g. {"key1":"val1","key2":"val2"}

# whether to rewrite Pulsar's default topic delimiter '/'

# delimiter used to rewrite Pulsar's default delimiter '/', use if default is causing incompatibility with other system like Superset

# maximum number of thread pool size for ledger offloader.

# driver used to offload or read cold data to or from long-term storage

# directory to load offloaders nar file.

# properties and configurations related to specific offloader implementation as map e.g. {"key1":"val1","key2":"val2"}

# authentication plugin used to authenticate to Pulsar cluster

# authentication parameter used to authenticate to the Pulsar cluster as a string e.g. "key1:val1,key2:val2".

# whether the Pulsar client accept an untrusted TLS certificate from broker

# whether to allow hostname verification when a client connects to broker over TLS.

# path for the trusted TLS certificate file of Pulsar broker

## whether to enable Pulsar authorization

# set the threshold for BookKeeper request throttle, default is disabled

# set the number of IO thread
pulsar.bookkeeper-num-io-threads=2 * Runtime.getRuntime().availableProcessors()

# set the number of worker thread

# whether to use BookKeeper V2 wire protocol

# interval to check the need for sending an explicit LAC, default is disabled

# size for managed ledger entry cache (in MB).

# number of threads to be used for managed ledger tasks dispatching

# number of threads to be used for managed ledger scheduled tasks

# directory used to store extraction NAR file

Enable authentication and authorization between Pulsar and Pulsar SQL​

By default, the authentication and authorization between Pulsar and Pulsar SQL is disabled.

To enable it, set the following configurations in the ${project.root}/conf/presto/catalog/ properties file:


Connect Presto to Pulsar with multiple hosts​

You can connect Presto to a Pulsar cluster with multiple hosts.

  • To configure multiple hosts for brokers, add multiple URLs to pulsar.web-service-url.
  • To configure multiple hosts for ZooKeeper, add multiple URIs to pulsar.zookeeper-uri.

The following is an example.


Get the last message in a topic​


By default, Pulsar SQL does not get the last message in a topic. It is by design and controlled by settings. By default, BookKeeper LAC only advances when subsequent entries are added. If there is no subsequent entry added, the last written entry is not visible to readers until the ledger is closed. This is not a problem for Pulsar which uses managed ledger, but Pulsar SQL directly reads from BookKeeper ledger.

If you want to get the last message in a topic, set the following configurations:

  1. For the broker configuration, set bookkeeperExplicitLacIntervalInMills > 0 in broker.conf or standalone.conf.

  2. For the Presto configuration, set pulsar.bookkeeper-explicit-interval > 0 and pulsar.bookkeeper-use-v2-protocol=false.

However, using BookKeeper V3 protocol introduces additional GC overhead to BK as it uses Protobuf.

Query data from existing Presto clusters​

If you already have a Presto cluster, you can copy the Presto Pulsar connector plugin to your existing cluster. Download the archived plugin package with the following command.

$ wget

Deploy a new cluster​

Since Pulsar SQL is powered by Trino (formerly Presto SQL), the configuration for deployment is the same for the Pulsar SQL worker.


For how to set up a standalone single node environment, refer to Query data.

You can use the same CLI args as the Presto launcher.

$ ./bin/pulsar sql-worker --help
Usage: launcher [options] command

Commands: run, start, stop, restart, kill, status

-h, --help show this help message and exit
-v, --verbose Run verbosely
--etc-dir=DIR Defaults to INSTALL_PATH/etc
Defaults to INSTALL_PATH/bin/
--node-config=FILE Defaults to ETC_DIR/
--jvm-config=FILE Defaults to ETC_DIR/jvm.config
--config=FILE Defaults to ETC_DIR/
Defaults to ETC_DIR/
--data-dir=DIR Defaults to INSTALL_PATH
--pid-file=FILE Defaults to DATA_DIR/var/run/
Defaults to DATA_DIR/var/log/launcher.log (only in
daemon mode)
Defaults to DATA_DIR/var/log/server.log (only in
daemon mode)
-D NAME=VALUE Set a Java system property

The default configuration for the cluster is located in ${project.root}/conf/presto. You can customize your deployment by modifying the default configuration.

You can set the worker to read from a different configuration directory, or set a different directory to write data.

$ ./bin/pulsar sql-worker run --etc-dir /tmp/incubator-pulsar/conf/presto --data-dir /tmp/presto-1

You can start the worker as daemon process.

$ ./bin/pulsar sql-worker start

Deploy a cluster on multiple nodes​

You can deploy a Pulsar SQL cluster or Presto cluster on multiple nodes. The following example shows how to deploy a cluster on three-node cluster.

  1. Copy the Pulsar binary distribution to three nodes.

The first node runs as Presto coordinator. The minimal configuration requirement in the ${project.root}/conf/presto/ file is as follows.


The other two nodes serve as worker nodes, you can use the following configuration for worker nodes.


  1. Modify pulsar.web-service-url and pulsar.zookeeper-uri configuration in the ${project.root}/conf/presto/catalog/ file accordingly for the three nodes.

  2. Start the coordinator node.

$ ./bin/pulsar sql-worker run

  1. Start worker nodes.

$ ./bin/pulsar sql-worker run

  1. Start the SQL CLI and check the status of your cluster.

$ ./bin/pulsar sql --server <coordinate_url>

  1. Check the status of your nodes.

presto> SELECT * FROM system.runtime.nodes;
node_id | http_uri | node_version | coordinator | state
1 | | testversion | true | active
3 | | testversion | false | active
2 | | testversion | false | active

For more information about the deployment in Presto, refer to Presto deployment.


The broker does not advance LAC, so when Pulsar SQL bypasses broker to query data, it can only read entries up to the LAC that all the bookies learned. You can enable periodically write LAC on the broker by setting "bookkeeperExplicitLacIntervalInMills" in the broker.conf file.