Run Flow as a Linux Service

Flow can be set up as a systemd service on Linux that runs in the background, persists across reboots and user logouts, automatically restarts on crashes, and can use integrated logging via journalctl.

Note: This procedure is compatible with systemd-based Linux distributions. You may need to adapt it for your specific environment.

Follow these steps to configure Flow to run as a service:

  1. Create the systemd unit file.

    sudo vi /etc/systemd/system/<your-service-name>.service

    Replace <your-service-name> with a name of your choice, such as flow-ingest or flow-xl-ingest.

  2. Add the following content into the file, and update the User, WorkingDirectory, and ExecStart fields to match your environment.

    [Unit]
    Description=SingleStore Flow Ingest
    After=network.target
    
    [Service]
    Type=simple
    User=<your-username>                              # e.g., ec2-user
    WorkingDirectory=<path-to-your-working-directory> # e.g., /home/ec2-user/ingest
    
    # Adjust JVM options if you need memory limits, GC tuning, etc.
    ExecStart=/usr/bin/java -jar <path-to-your-jar>   # e.g., /home/ec2-user/ingest/ingest.jar
    
    # SuccessExitStatus=143    # Uncomment so Ctrl+C / SIGTERM is treated as a clean exit
    Restart=always
    RestartSec=10
    LimitNOFILE=65536          # Increase the open-file limit if ingest opens many files
    
    [Install]
    WantedBy=multi-user.target
  3. Enable and start the service.

    sudo systemctl daemon-reload
    sudo systemctl enable --now <your-service-name>
  4. Check service status and logs.

    sudo systemctl status <your-service-name>  # health-check
    sudo journalctl -u <your-service-name> -f  # live logs (Ctrl-C to quit)

Last modified:

Was this article helpful?