diff options
Diffstat (limited to '')
-rw-r--r-- | etc/Makefile.am | 38 | ||||
-rw-r--r-- | etc/init.d/pacemaker.in | 191 | ||||
-rw-r--r-- | etc/logrotate.d/pacemaker.in | 12 | ||||
-rw-r--r-- | etc/sysconfig/crm_mon | 4 | ||||
-rw-r--r-- | etc/sysconfig/pacemaker.in | 339 |
5 files changed, 584 insertions, 0 deletions
diff --git a/etc/Makefile.am b/etc/Makefile.am new file mode 100644 index 0000000..b810f82 --- /dev/null +++ b/etc/Makefile.am @@ -0,0 +1,38 @@ +# +# Copyright 2021-2022 the Pacemaker project contributors +# +# The version control history for this file may have further details. +# +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. +# + +MAINTAINERCLEANFILES = Makefile.in + +configdir = @CONFIGDIR@ +CONFIGS = crm_mon pacemaker + +if !BUILD_SYSTEMD +initdir = $(INITDIR) +init_SCRIPTS = init.d/pacemaker +endif + +logrotatedir = $(sysconfdir)/logrotate.d +logrotate_DATA = logrotate.d/pacemaker + +EXTRA_DIST = $(foreach f,$(CONFIGS),sysconfig/$(f)) + +# Don't overwrite user's existing config files +install-data-local: + $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(configdir) + $(AM_V_at)for f in $(CONFIGS); do \ + dest="$(DESTDIR)$(configdir)/$$f"; \ + [ -e "$$dest" ] && dest="$$dest.new"; \ + $(INSTALL_DATA) "$(srcdir)/sysconfig/$$f" "$$dest"; \ + done + +uninstall-local: + $(AM_V_at)for f in $(CONFIGS); do \ + dest="$(DESTDIR)$(configdir)/$$f"; \ + rm -f "$$dest" "$$dest.new"; \ + done diff --git a/etc/init.d/pacemaker.in b/etc/init.d/pacemaker.in new file mode 100644 index 0000000..6ed78a8 --- /dev/null +++ b/etc/init.d/pacemaker.in @@ -0,0 +1,191 @@ +#!@BASH_PATH@ + +# Authors: +# Andrew Beekhof <abeekhof@redhat.com> +# Fabio M. Di Nitto <fdinitto@redhat.com> +# +# License: Revised BSD + +# chkconfig: - 99 01 +# description: Pacemaker Cluster Manager +# processname: pacemakerd +# +### BEGIN INIT INFO +# Provides: pacemaker +# Required-Start: $network $remote_fs corosync +# Should-Start: $syslog +# Required-Stop: $network $remote_fs corosync +# Default-Start: +# Default-Stop: +# Short-Description: Starts and stops Pacemaker Cluster Manager. +# Description: Starts and stops Pacemaker Cluster Manager. +### END INIT INFO + +desc="Pacemaker Cluster Manager" +prog="pacemakerd" + +# set secure PATH +PATH="/sbin:/bin:/usr/sbin:/usr/bin:@sbindir@" + +checkrc() { + if [ $? = 0 ]; then + success + else + failure + fi +} + +success() +{ + echo -ne "[ OK ]\r" +} + +failure() +{ + echo -ne "[FAILED]\r" +} + +log() +{ + logger -t pacemaker -p daemon.notice "$*" +} + +notify() +{ + log "$*" + echo -n "$*" +} + +status() +{ + pid=$(pidof $1 2>/dev/null) + local rtrn=$? + if [ $rtrn -ne 0 ]; then + echo "$1 is stopped" + if [ -f "@localstatedir@/run/$prog.pid" ]; then + rtrn=1 + else + rtrn=3 + fi + else + echo "$1 (pid $pid) is running..." + fi + return $rtrn +} + +if [ -d @CONFIGDIR@ ]; then + [ -f @INITDIR@/functions ] && . @INITDIR@/functions +set -a + [ -f @CONFIGDIR@/pacemaker ] && . @CONFIGDIR@/pacemaker + [ -f @CONFIGDIR@/sbd ] && . @CONFIGDIR@/sbd +set +a +fi + +LOCK_DIR="." +if [ -d "@localstatedir@/lock/subsys" ]; then + LOCK_DIR="@localstatedir@/lock/subsys" +elif [ -d "@localstatedir@/lock" ]; then + LOCK_DIR="@localstatedir@/lock" +fi +[ -z "$LOCK_FILE" ] && LOCK_FILE="$LOCK_DIR/pacemaker" + +# Check if there is a valid watchdog-device configured in sbd config +if [ x != "x$SBD_WATCHDOG_DEV" -a "/dev/null" != "$SBD_WATCHDOG_DEV" -a -c "$SBD_WATCHDOG_DEV" ]; then + # enhance for unavailable chkconfig - don't touch sbd for now + if chkconfig --list sbd_helper 2>/dev/null | grep -q ":on"; then + SBD_SERVICE=sbd_helper + fi +fi + +start() +{ + notify "Starting $desc" + + # most recent distributions use tmpfs for $@localstatedir@/run + # to avoid to clean it up on every boot. + # they also assume that init scripts will create + # required subdirectories for proper operations + mkdir -p "@localstatedir@/run" + + if status $prog > /dev/null 2>&1; then + success + else + $prog > /dev/null 2>&1 & + + # Time to connect to corosync and fail + sleep 5 + + if status $prog > /dev/null 2>&1; then + touch "$LOCK_FILE" + pidof $prog > "@localstatedir@/run/$prog.pid" + success + else + failure + rtrn=1 + fi + fi + echo +} + +stop() +{ + shutdown_prog=$prog + if ! status $prog > /dev/null 2>&1; then + shutdown_prog="pacemaker-controld" + fi + + if status $shutdown_prog > /dev/null 2>&1; then + notify "Signaling $desc to terminate" + kill -TERM $(pidof $prog) > /dev/null 2>&1 + checkrc + echo + + notify "Waiting for cluster services to unload" + while status $prog > /dev/null 2>&1; do + sleep 1 + echo -n "." + done + else + echo -n "$desc is already stopped" + fi + + rm -f "$LOCK_FILE" + rm -f "@localstatedir@/run/$prog.pid" + killall -q -9 pacemakerd pacemaker-attrd pacemaker-based \ + pacemaker-controld pacemaker-execd pacemaker-fenced \ + pacemaker-schedulerd + success + echo +} + +rtrn=0 + +case "$1" in +start) + start +;; +restart|reload|force-reload) + stop + start +;; +condrestart|try-restart) + if status $prog > /dev/null 2>&1; then + stop + start + fi +;; +status) + status $prog + rtrn=$? +;; +stop) + stop + [ "x$SBD_SERVICE" != x ] && service $SBD_SERVICE stop +;; +*) + echo "usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" + rtrn=2 +;; +esac + +exit $rtrn diff --git a/etc/logrotate.d/pacemaker.in b/etc/logrotate.d/pacemaker.in new file mode 100644 index 0000000..ec6fc38 --- /dev/null +++ b/etc/logrotate.d/pacemaker.in @@ -0,0 +1,12 @@ +@CRM_LOG_DIR@/pacemaker.log @CRM_BUNDLE_DIR@/*/pacemaker.log @CRM_BUNDLE_DIR@/*/pcmk-init.log { + compress + dateext + weekly + su hacluster haclient + rotate 99 + maxage 365 + maxsize 100M + notifempty + missingok + copytruncate +} diff --git a/etc/sysconfig/crm_mon b/etc/sysconfig/crm_mon new file mode 100644 index 0000000..1dd472a --- /dev/null +++ b/etc/sysconfig/crm_mon @@ -0,0 +1,4 @@ +# +# Please refer to manual page for detailed options. +# +#OPTIONS="-d" diff --git a/etc/sysconfig/pacemaker.in b/etc/sysconfig/pacemaker.in new file mode 100644 index 0000000..3b03ad6 --- /dev/null +++ b/etc/sysconfig/pacemaker.in @@ -0,0 +1,339 @@ +# +# Pacemaker start-up configuration +# +# This file contains environment variables that affect Pacemaker behavior. +# They are not options stored in the Cluster Information Base (CIB) because +# they may be needed before the CIB is available. +# + + +## Logging + +# PCMK_logfacility +# +# Enable logging via the system log or journal, using the specified log +# facility. Messages sent here are of value to all Pacemaker administrators. +# This can be disabled using "none", but that is not recommended. Allowed +# values: +# +# none +# daemon +# user +# local0 +# local1 +# local2 +# local3 +# local4 +# local5 +# local6 +# local7 +# +# Default: PCMK_logfacility="daemon" + +# PCMK_logpriority +# +# Unless system logging is disabled using PCMK_logfacility=none, messages of +# the specified log severity and higher will be sent to the system log. The +# default is appropriate for most installations. Allowed values: +# +# emerg +# alert +# crit +# error +# warning +# notice +# info +# debug +# +# Default: PCMK_logpriority="notice" + +# PCMK_logfile +# +# Unless set to "none", more detailed log messages will be sent to the +# specified file (in addition to the system log, if enabled). These messages +# may have extended information, and will include messages of info severity. +# This log is of more use to developers and advanced system administrators, and +# when reporting problems. +# +# Default: PCMK_logfile="@CRM_LOG_DIR@/pacemaker.log" + +# PCMK_logfile_mode +# +# Pacemaker will set the permissions on the detail log to this value (see +# chmod(1)). +# +# Default: PCMK_logfile_mode="0660" + +# PCMK_debug (Advanced Use Only) +# +# Whether to send debug severity messages to the detail log. +# This may be set for all subsystems (yes or no) or for specific +# (comma-separated) subsystems. Allowed subsystems are: +# +# pacemakerd +# pacemaker-attrd +# pacemaker-based +# pacemaker-controld +# pacemaker-execd +# pacemaker-fenced +# pacemaker-schedulerd +# +# Default: PCMK_debug="no" +# Example: PCMK_debug="pacemakerd,pacemaker-execd" + +# PCMK_trace_functions (Advanced Use Only) +# +# Send debug and trace severity messages from these (comma-separated) +# source code functions to the detail log. +# +# Default: PCMK_trace_functions="" +# Example: PCMK_trace_functions="unpack_colocation_set,pcmk__cmp_instance" + +# PCMK_trace_files (Advanced Use Only) +# +# Send debug and trace severity messages from all functions in these +# (comma-separated) source file names to the detail log. +# +# Default: PCMK_trace_files="" +# Example: PCMK_trace_files="remote.c,watchdog.c" + +# PCMK_trace_formats (Advanced Use Only) +# +# Send trace severity messages that are generated by these (comma-separated) +# format strings in the source code to the detail log. +# +# Default: PCMK_trace_formats="" +# Example: PCMK_trace_formats="TLS handshake failed: %s (%d)" + +# PCMK_trace_tags (Advanced Use Only) +# +# Send debug and trace severity messages related to these (comma-separated) +# resource IDs to the detail log. +# +# Default: PCMK_trace_tags="" +# Example: PCMK_trace_tags="client-ip,dbfs" + +# PCMK_blackbox (Advanced Use Only) +# +# Enable blackbox logging globally (yes or no) or by subsystem. A blackbox +# contains a rolling buffer of all logs (of all severities). Blackboxes are +# stored under @CRM_BLACKBOX_DIR@ by default, and their contents can +# be viewed using the qb-blackbox(8) command. +# +# The blackbox recorder can be enabled at start using this variable, or at +# runtime by sending a Pacemaker subsystem daemon process a SIGUSR1 or SIGTRAP +# signal, and disabled by sending SIGUSR2 (see kill(1)). The blackbox will be +# written after a crash, assertion failure, or SIGTRAP signal. +# +# Default: PCMK_blackbox="no" +# Example: PCMK_blackbox="pacemaker-controld,pacemaker-fenced" + +# PCMK_trace_blackbox (Advanced Use Only) +# +# Write a blackbox whenever the message at the specified function and line is +# logged. Multiple entries may be comma-separated. +# +# Default: PCMK_trace_blackbox="" +# Example: PCMK_trace_blackbox="remote.c:144,remote.c:149" + + +## Node start state + +# PCMK_node_start_state +# +# By default, the local host will join the cluster in an online or standby +# state when Pacemaker first starts depending on whether it was previously put +# into standby mode. If this variable is set to "standby" or "online", it will +# force the local host to join in the specified state. This has no effect on +# Pacemaker Remote nodes. +# +# Default: PCMK_node_start_state="default" + + +## Crash Handling + +# PCMK_fail_fast +# +# By default, if a Pacemaker subsystem crashes, the main pacemakerd process +# will attempt to restart it. If this variable is set to "yes", pacemakerd +# will panic the local host instead. +# +# Default: PCMK_fail_fast="no" + +# PCMK_panic_action +# +# Pacemaker will panic the local host under certain conditions. By default, +# this means rebooting the host. This variable can change that behavior: if +# "crash", trigger a kernel crash (useful if you want a kernel dump to +# investigate); if "sync-reboot" or "sync-crash", synchronize filesystems +# before rebooting the host or triggering a kernel crash. The sync values are +# more likely to preserve log messages, but with the risk that the host may be +# left active if the synchronization hangs. +# +# Default: PCMK_panic_action="reboot" + + +## Pacemaker Remote + +# PCMK_authkey_location +# +# Use the contents of this file as the authorization key to use with Pacemaker +# Remote connections. This file must be readable by Pacemaker daemons (that is, +# it must allow read permissions to either the hacluster user or the haclient +# group), and its contents must be identical on all nodes. +# +# Default: PCMK_authkey_location="@PACEMAKER_CONFIG_DIR@/authkey" + +# PCMK_remote_address +# +# By default, if the Pacemaker Remote service is run on the local node, it will +# listen for connections on all IP addresses. This may be set to one address to +# listen on instead, as a resolvable hostname or as a numeric IPv4 or IPv6 +# address. When resolving names or listening on all addresses, IPv6 will be +# preferred if available. When listening on an IPv6 address, IPv4 clients will +# be supported via IPv4-mapped IPv6 addresses. +# +# Default: PCMK_remote_address="" +# Example: PCMK_remote_address="192.0.2.1" + +# PCMK_remote_port +# +# Use this TCP port number for Pacemaker Remote node connections. This value +# must be the same on all nodes. +# +# Default: PCMK_remote_port="3121" + +# PCMK_tls_priorities (Advanced Use Only) +# +# These GnuTLS cipher priorities will be used for TLS connections (whether for +# Pacemaker Remote connections or remote CIB access, when enabled). See: +# +# https://gnutls.org/manual/html_node/Priority-Strings.html +# +# Pacemaker will append ":+ANON-DH" for remote CIB access and ":+DHE-PSK:+PSK" +# for Pacemaker Remote connections, as they are required for the respective +# functionality. +# +# Default: PCMK_tls_priorities="@PCMK_GNUTLS_PRIORITIES@" +# Example: PCMK_tls_priorities="SECURE128:+SECURE192:-VERS-ALL:+VERS-TLS1.2" + +# PCMK_dh_min_bits (Advanced Use Only) +# +# Set a lower bound on the bit length of the prime number generated for +# Diffie-Hellman parameters needed by TLS connections. The default is no +# minimum. +# +# The server (Pacemaker Remote daemon, or CIB manager configured to accept +# remote clients) will use this value to provide a floor for the value +# recommended by the GnuTLS library. The library will only accept a limited +# number of specific values, which vary by library version, so setting these is +# recommended only when required for compatibility with specific client +# versions. +# +# Clients (connecting cluster nodes or remote CIB commands) will require that +# the server use a prime of at least this size. This is recommended only when +# the value must be lowered in order for the client's GnuTLS library to accept +# a connection to an older server. +# +# Default: PCMK_dh_min_bits="1024" + +# PCMK_dh_max_bits (Advanced Use Only) +# +# Set an upper bound on the bit length of the prime number generated for +# Diffie-Hellman parameters needed by TLS connections. The default is no +# maximum. +# +# The server (Pacemaker Remote daemon, or CIB manager configured to accept +# remote clients) will use this value to provide a ceiling for the value +# recommended by the GnuTLS library. The library will only accept a limited +# number of specific values, which vary by library version, so setting these is +# recommended only when required for compatibility with specific client +# versions. +# +# Clients do not use PCMK_dh_max_bits. +# +# Default: PCMK_dh_max_bits="2048" + + +## Inter-process Communication + +# PCMK_ipc_type (Advanced Use Only) +# +# Force use of a particular IPC method. Allowed values: +# +# shared-mem +# socket +# posix +# sysv +# +# Default: PCMK_ipc_type="shared-mem" + +# PCMK_ipc_buffer (Advanced Use Only) +# +# Specify an IPC buffer size in bytes. This can be useful when connecting to +# large clusters that result in messages exceeding the default size (which will +# also result in log messages referencing this variable). +# +# Default: PCMK_ipc_buffer="131072" + + +## Developer Options + +# PCMK_schema_directory (Advanced Use Only) +# +# Specify an alternate location for RNG schemas and XSL transforms. +# +# Default: PCMK_schema_directory="@CRM_SCHEMA_DIRECTORY@" + +# G_SLICE (Advanced Use Only) +# +# Affect the behavior of glib's memory allocator. Setting to "always-malloc" +# when running under valgrind will help valgrind track malloc/free better; +# setting to "debug-blocks" when not running under valgrind will perform +# (somewhat expensive) memory checks. +# +# Default: G_SLICE="" +# Example: G_SLICE="always-malloc" + +# MALLOC_PERTURB_ (Advanced Use Only) +# +# Setting this to a decimal byte value will make malloc() initialize newly +# allocated memory and free() wipe it, to help catch uninitialized-memory and +# use-after-free bugs. +# +# Default: MALLOC_PERTURB_="" +# Example: MALLOC_PERTURB_="221" + +# MALLOC_CHECK_ (Advanced Use Only) +# +# Setting this to 3 will make malloc() and friends print to stderr and abort +# for some (inexpensive) memory checks. +# +# Default: MALLOC_CHECK_="" +# Example: MALLOC_CHECK_="3" + +# PCMK_valgrind_enabled (Advanced Use Only) +# +# Whether subsystem daemons should be run under valgrind. Allowed values are +# the same as for PCMK_debug. +# +# Default: PCMK_valgrind_enabled="no" + +# PCMK_callgrind_enabled +# +# Whether subsystem daemons should be run under valgrind with the callgrind +# tool enabled. Allowed values are the same as for PCMK_debug. +# +# Default: PCMK_callgrind_enabled="no" + +# VALGRIND_OPTS +# +# Pass these options to valgrind, when enabled (see valgrind(1)). "--vgdb=no" +# is specified because pacemaker-execd can lower privileges when executing +# commands, which would otherwise leave a bunch of unremovable files in /tmp. +# +# Default: VALGRIND_OPTS="" +VALGRIND_OPTS="--leak-check=full --trace-children=no --vgdb=no --num-callers=25" +VALGRIND_OPTS="$VALGRIND_OPTS --log-file=@CRM_PACEMAKER_DIR@/valgrind-%p" +VALGRIND_OPTS="$VALGRIND_OPTS --suppressions=@datadir@/pacemaker/tests/valgrind-pcmk.suppressions" +VALGRIND_OPTS="$VALGRIND_OPTS --gen-suppressions=all" |