11.2. ltclusterd daemon

11.2.1. ltclusterd's PID file
11.2.2. ltclusterd daemon configuration on Debian/Ubuntu

If installed from a package, the ltclusterd can be started via the operating system's service command, e.g. in systemd using systemctl.

The commands ltcluster daemon start and ltcluster daemon stop can be used as convenience wrappers to start and stop ltclusterd on the local node.

Important

ltcluster daemon start and ltcluster daemon stop require that the appropriate start/stop commands are configured as ltclusterd_service_start_command and ltclusterd_service_stop_command in ltcluster.conf.

ltclusterd can be started manually like this:

        ltclusterd -f /etc/ltcluster.conf --pid-file /tmp/ltclusterd.pid

and stopped with kill `cat /tmp/ltclusterd.pid`. Adjust paths as appropriate.

11.2.1. ltclusterd's PID file

ltclusterd will generate a PID file by default.

Note

This is a behaviour change from previous versions (earlier than 4.1), where the PID file had to be explicitly specified with the command line parameter --pid-file.

The PID file can be specified in ltcluster.conf with the configuration parameter ltclusterd_pid_file.

It can also be specified on the command line (as in previous versions) with the command line parameter --pid-file. Note this will override any value set in ltcluster.conf with ltclusterd_pid_file. --pid-file may be deprecated in future releases.

If a PID file location was specified by the package maintainer, ltclusterd will use that. This only applies if ltcluster was installed from a package and the package maintainer has specified the PID file location.

If none of the above apply, ltclusterd will create a PID file in the operating system's temporary directory (as setermined by the environment variable TMPDIR, or if that is not set, will use /tmp).

To prevent a PID file being generated at all, provide the command line option --no-pid-file.

To see which PID file ltclusterd would use, execute ltclusterd with the option --show-pid-file. ltclusterd will not start if this option is provided. Note that the value shown is the file ltclusterd would use next time it starts, and is not necessarily the PID file currently in use.

11.2.2. ltclusterd daemon configuration on Debian/Ubuntu

If ltcluster was installed from Debian/Ubuntu packages, additional configuration is required before ltclusterd is started as a daemon.

This is done via the file /etc/default/ltclusterd, which by default looks like this:

# default settings for ltclusterd. This file is source by /bin/sh from
# /etc/init.d/ltclusterd

# disable ltclusterd by default so it won't get started upon installation
# valid values: yes/no
LTCLUSTERD_ENABLED=no

# configuration file (required)
#LTCLUSTERD_CONF="/path/to/ltcluster.conf"

# additional options
LTCLUSTERD_OPTS="--daemonize=false"

# user to run ltclusterd as
#LTCLUSTERD_USER=lightdb

# ltclusterd binary
#LTCLUSTERD_BIN=/usr/bin/ltclusterd

# pid file
#LTCLUSTERD_PIDFILE=/var/run/ltclusterd.pid

Set LTCLUSTERD_ENABLED to yes, and LTCLUSTERD_CONF to the ltcluster.conf file you are using.

From ltclusterd 5, ensure LTCLUSTERD_OPTS includes --daemonize=false, as daemonization is handled by the service command.

If using systemd, you may need to execute systemctl daemon-reload. Also, if you attempted to start ltclusterd using systemctl start ltclusterd, you'll need to execute systemctl stop ltclusterd. Because that's how systemd rolls.