Skip to main content
Loading

Deploying in Standalone Mode in Docker

You can run the docker run command against the image you built, and start a container that runs a single Trino node and the Trino connector.

Running both a single Trino node and the Trino connector in a single container can help you rapidly prototype client applications.

Prerequisite

Build an image of Trino and the Trino connector, as described in "Deploying Trino Clusters and the Trino Connector in Docker".

Options for running a single Trino node

There are two options:

Procedure for using environment variables to configure the Trino connector

With this option, you configure the connector by setting environment variables in the docker run command. The environment variables represent a subset of the configuration properties for the connector.

Consider using this option when you do not plan to use an aerospike.properties file. Running a Trino cluster and the Trino connector this way can help you rapidly prototype running SQL queries against your Aerospike cluster.

Run the docker run command to create a container and to start the node within that.

Use the -e option for each environment variable that you want to include.

tip

Include the AS_HOSTLIST environment variable. Do not set the environment variables TRINO_DISCOVERY_URI or TRINO_NODE_TYPE.

Here is an example, where:

  • --rm specifies to remove the container automatically when the command exits.
  • -p 8080:8080 binds port 8080 of the container to port 8080 of the host system.
  • <container-name> is the name given to reference the container within a Docker network.
  • <image name> is the name given to the Docker image when it was built.
docker run --rm -p 8080:8080 -e AS_HOSTLIST=docker.for.mac.host.internal:3000 --name <container name> <image name>

If you configured Trino properties, include this option to mount the files into the /etc/trino directory in the container:

-v /docker/etc:/etc/trino

where /docker/etc is the path of the directory in which the configuration files that you edited are located in trino-aerospike.docker, the repository that you cloned in a previous step. If the Trino configuration files that you edited are in a different directory, use the path of that directory, instead. You can even mount individual files, as in this example:

-v /docker/etc/log.properties:/etc/trino/log.properties

If you are providing the Trino schemas, include this option to mount the files into the /etc/trino/aerospike directory in the container:

-v <path-to-JSON-files>:/etc/trino/aerospike

where <path-to-JSON-files> is the path of the folder on your system in which you placed the JSON files.

Procedure for configuring the Trino connector through a configuration file

With this option, you configure the connector by setting values for its configuration properties in the aerospike.properties file. The number of properties that you can configure with this file is greater than the number that you can configure with the environment variables.

When you run the docker run command, you mount that file's directory in the container that the command creates.

Step 1: Set values in the aerospike.properties file.

Set values for configuration properties in aerospike.properties. In the repository that you cloned in a previous step, the path to this file is /trino-aerospike.docker/docker/etc/catalog/aerospike.properties. By default, the file in the repository includes these two entries. If you are running Docker on Linux, replace docker.for.mac.host.internal with localhost.

properties
connector.name=aerospike
aerospike.hostlist=docker.for.mac.host.internal:3000

If you have an existing aerospike.properties file that you want to use, be sure to change the value of aerospike.hostlist.

Step 2: Docker Run

Run the docker run command to create a container and to start Trino and the Trino connector within the container.

To mount the aerospike.properties file into the /etc/trino/catalog directory in the container, use the following command:

docker run --rm -p 8080:8080 -v <path-to-the-aerospike.properties-file>:/etc/trino/catalog \
--name <container name> <image name>

where:

  • --rm specifies to remove the container automatically when the command exits.
  • -p 8080:8080 binds port 8080 of the container to port 8080 of the host system.
  • <path-to-the-aerospike.properties-file> is the path to the aerospike.properties file on your system.
  • <container-name> is the name given to reference the container within a Docker network.
  • <image name> is the name given to the Docker image when it was built.

If you configured Trino properties, include this option to mount the files into the /etc/trino directory in the container:

-v /docker/etc:/etc/trino

Where /docker/etc is the path of the directory in which the configuration files that you edited are located in trino-aerospike.docker, the repository that you cloned in a previous step. If the Trino configuration files that you edited are in a different directory, use the path of that directory, instead. You can even mount individual files, as in this example:

-v /docker/etc/log.properties:/etc/trino/log.properties

If you are providing the Trino schemas, include this option to mount the files into the /etc/trino/aerospike directory in the container:

-v <path-to-JSON-files>:/etc/trino/aerospike

where <path-to-JSON-files> is the path of the folder on your system in which you placed the JSON files.