LP #1444007: Percona-XtraDB-Cluster-garbd-3-3.9-1.3494.rhel7.x86_64 systemd init script broken, fix added
Description
Environment
Activity
**Comment from Launchpad by: Nilnandan Joshi on: 19-05-2015 05:40:28
Hi Alex, I tested without the quotes and got the same result like above.
[root@localhost ~]# cat /etc/sysconfig/garb
Copyright (C) 2012 Codership Oy
This config file is to be sourced by garb service script.
A space-separated list of node addresses (address[:port]) in the cluster
GALERA_NODES=192.168.1.213
Galera cluster name, should be the same as on the rest of the nodes.
GALERA_GROUP=my_centos7_cluster
Optional Galera internal options string (e.g. SSL settings)
see http://www.codership.com/wiki/doku.php?id=galera_parameters
GALERA_OPTIONS=""
Log file for garbd. Optional, by default logs to syslog
Deprecated for CentOS7, use journalctl to query the log for garbd
LOG_FILE=/root/garbd.log
[root@localhost ~]#
[root@localhost ~]# garb-systemd start
Starting garbd
terminate called after throwing an instance of 'gu::NotSet'
/usr/bin/garb-systemd: line 13: 4048 Aborted (core dumped) /usr/bin/garbd $*
[root@localhost ~]#
Can you try to check the same thing with CentOS 7?
Btw: problem here is not error, but systemd init scrip doesn't read the config file with config=/etc/sysconfig/garb option. So, you have to add "source /etc/sysconfig/garb" in the init script.
**Comment from Launchpad by: Alex Yurchenko on: 16-05-2015 10:59:20
Nilnandan, this is a different error. I happened because you quoted values in your config file: https://github.com/codership/galera/issues/186
**Comment from Launchpad by: Nilnandan Joshi on: 15-05-2015 07:40:29
Confirmed.
[root@localhost ~]# rpm -qa | grep -i garbd
Percona-XtraDB-Cluster-garbd-3-3.9-1.3494.rhel7.x86_64
[root@localhost ~]#
[root@localhost ~]# cat /etc/sysconfig/garb
Copyright (C) 2012 Codership Oy
This config file is to be sourced by garb service script.
A space-separated list of node addresses (address[:port]) in the cluster
GALERA_NODES="192.168.7.104"
Galera cluster name, should be the same as on the rest of the nodes.
GALERA_GROUP="my_centos7_cluster"
Optional Galera internal options string (e.g. SSL settings)
see http://www.codership.com/wiki/doku.php?id=galera_parameters
GALERA_OPTIONS=""
Log file for garbd. Optional, by default logs to syslog
Deprecated for CentOS7, use journalctl to query the log for garbd
LOG_FILE="/root/garbd.log"
[root@localhost ~]#
[root@localhost ~]# head -7 /usr/bin/garb-systemd
#!/bin/bash -ue
#
config=/etc/sysconfig/garb
log_failure() {
echo " ERROR! $@"
[root@localhost ~]#
[root@localhost ~]# garb-systemd start
ERROR! List of GALERA_NODES is not configured
[root@localhost ~]#
[root@localhost ~]# head -7 /usr/bin/garb-systemd
#!/bin/bash -ue
#
config=/etc/sysconfig/garb
source /etc/sysconfig/garb
log_failure() {
[root@localhost ~]#
[root@localhost ~]# garb-systemd start
Starting garbd
terminate called after throwing an instance of 'gu::NotSet'
/usr/bin/garb-systemd: line 13: 4742 Aborted (core dumped) /usr/bin/garbd $*
[root@localhost ~]#
**Reported in Launchpad by Quentin last update 03-06-2015 15:39:17
On the default installation of Percona-XtraDB-Cluster-garbd-3-3.9-1.3494.rhel7.x86_64 the provided systemd-init script is broken. It seems the garbd-systemd doesn't read the config file in /etc/sysconfig/garb. It does the checks on the default installation line, but it does not read the variables in the config file such as: GALERA_NODES et cetera.
I fixed it to add the following line in /usr/bin/garb-systemd right after config=/etc/sysconfig/garb:
source /etc/sysconfig/garb
So the /usr/bin/garb-systemd looks like this now:
#!/bin/bash -ue
#
config=/etc/sysconfig/garb
source /etc/sysconfig/garb
log_failure() {
echo " ERROR! $@"
}
program_start() {
echo "Starting garbd"
/usr/bin/garbd $*
}
start() {
if grep -q -E '^# REMOVE' $config;then
log_failure "Garbd config $config is not configured yet"
return 0
fi
Check that node addresses are configured
set -x
if [[ z "${GALERA_NODES:}" ]]; then
log_failure "List of GALERA_NODES is not configured"
return 6
fi
if [[ z "${GALERA_GROUP:}" ]]; then
log_failure "GALERA_GROUP name is not configured"
return 6
fi
GALERA_PORT=${GALERA_PORT:-4567}
Find a working node
for ADDRESS in ${GALERA_NODES} 0; do
HOST=$(echo $ADDRESS | cut -d \: -f 1 )
PORT=$(echo $ADDRESS | cut -s -d \: -f 2 )
PORT=${PORT:-$GALERA_PORT}
if [[ -x `which nc` ]] && nc -h 2>&1 | grep -q – '-z';then
nc -z $HOST $PORT >/dev/null && break
elif [[ -x `which nmap` ]];then
nmap -Pn -p$PORT $HOST | awk "\$1 ~ /$PORT/ {print \$2}" | grep -q open && break
else
log_failure "Neither netcat nor nmap are present for zero I/O scanning"
return 1
fi
done
if [ ${ADDRESS} == "0" ]; then
log_failure "None of the nodes in $GALERA_NODES is accessible"
return 1
fi
OPTIONS=" -a gcomm://$ADDRESS "
[ n "${GALERA_GROUP:}" ] && OPTIONS="$OPTIONS -g $GALERA_GROUP"
[ n "${GALERA_OPTIONS:}" ] && OPTIONS="$OPTIONS -o $GALERA_OPTIONS"
[ n "${LOG_FILE:}" ] && OPTIONS="$OPTIONS -l $LOG_FILE"
program_start $OPTIONS
}
See how we were called.
case "$1" in
start)
start
;;
*)
echo $"Usage: $0 {start}"
exit 2
esac
exit $?