Deploying Presto with systemd involves creating a systemd service unit file to manage the Presto server process.
Here's a step-by-step tutorial on how to deploy a Presto server using systemd on a Linux machine:
- A Linux server where you want to deploy Presto.
- Java (JRE or JDK) installed on the server.
- Presto installation files and configuration ready. You can download Presto from the official website (https://prestosql.io/download.html).
Step 1: Create a Systemd Service Unit File
Open a terminal on your server and create a systemd service unit file for Presto. Replace
/etc/systemd/system/presto.service with your preferred location and file name:
sudo nano /etc/systemd/system/presto.service
Paste the following configuration into the file. Adjust the paths and configurations as needed:
[Unit] Description=Presto SQL Query Engine Documentation=https://prestosql.io After=network.target [Service] User=your-username # Replace with the user you want to run Presto as EnvironmentFile=-/etc/default/presto ExecStart=/path/to/presto/bin/launcher start ExecStop=/path/to/presto/bin/launcher stop Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target
your-usernamewith the username under which you want to run Presto.
EnvironmentFile: You can specify Presto configuration here. Create this file if needed, and set the appropriate environment variables.
Save and exit the text editor.
Step 2: Create an Environment Configuration File (Optional)
You can create an environment configuration file to set environment variables for Presto. This is especially useful for specifying configuration properties. Create the file, e.g.,
/etc/default/presto, and define environment variables as needed:
# /etc/default/presto NODE_ENV=production PRESTO_CONF_DIR=/path/to/presto/etc
/path/to/presto/etc with the actual path to your Presto configuration directory.
After creating the service unit file, reload the systemd manager configuration to recognize the new service:
sudo systemctl daemon-reload
Start the Presto service and enable it to start on boot:
sudo systemctl start presto sudo systemctl enable presto
You can check the status of Presto to ensure it's running:
sudo systemctl status presto
You should see an output indicating that Presto is active and running.
Accessing the Web UI:
After starting presto server, you can access the web UI using the following link:
That's it! You've successfully deployed a Presto server using Systemd.
You can now configure and use Presto for querying data.