- Fix pid file path in init script.
- Fix spec file -- we don't use short_name macro in pgcore spec file.
- Create pgpool pid file directory.
- Fix stop/start routines, also improve init script a bit.
- Install conf files to a new directory (/etc/pgpool-II), and get rid of
sample conf files.
This commit is contained in:
parent
13e92c1d01
commit
bd3d3b6d41
3 changed files with 88 additions and 49 deletions
|
|
@ -1,24 +1,22 @@
|
|||
--- pgpool.conf.sample.old 2008-08-12 08:26:07.000000000 +0300
|
||||
+++ pgpool.conf.sample 2008-08-12 08:27:31.000000000 +0300
|
||||
--- pgpool.conf.sample.old 2009-03-22 22:18:52.000000000 +0200
|
||||
+++ pgpool.conf.sample 2009-03-22 22:46:20.000000000 +0200
|
||||
@@ -12,16 +12,14 @@
|
||||
# Port number for pgpool communication manager
|
||||
pcp_port = 9898
|
||||
|
||||
-# Unix domain socket path. (The Debian package defaults to
|
||||
-# /var/run/postgresql.)
|
||||
-socket_dir = '/tmp'
|
||||
+# Unix domain socket path.
|
||||
+socket_dir = '/var/run'
|
||||
+# Unix domain socket path.
|
||||
socket_dir = '/tmp'
|
||||
|
||||
# Unix domain socket path for pgpool communication manager.
|
||||
-# (Debian package defaults to /var/run/postgresql)
|
||||
-pcp_socket_dir = '/tmp'
|
||||
+pcp_socket_dir = '/var/run'
|
||||
pcp_socket_dir = '/tmp'
|
||||
|
||||
-# Unix domain socket path for the backend. Debian package defaults to /var/run/postgresql!
|
||||
-backend_socket_dir = '/tmp'
|
||||
+# Unix domain socket path for the backend.
|
||||
+backend_socket_dir = '/var/run'
|
||||
+# Unix domain socket path for the backend.
|
||||
+backend_socket_dir = '/var/run/pgpool'
|
||||
|
||||
# pgpool communication manager timeout. 0 means no timeout, but strongly not recommended!
|
||||
pcp_timeout = 10
|
||||
|
|
@ -27,7 +25,22 @@
|
|||
|
||||
# Logging directory
|
||||
-logdir = '/tmp'
|
||||
+logdir = '/var/run'
|
||||
+logdir = '/var/log/pgpool'
|
||||
|
||||
# Replication mode
|
||||
replication_mode = false
|
||||
# pid file name
|
||||
pid_file_name = '/var/run/pgpool/pgpool.pid'
|
||||
@@ -166,10 +164,10 @@
|
||||
|
||||
# backend_hostname, backend_port, backend_weight
|
||||
# here are examples
|
||||
-#backend_hostname0 = 'host1'
|
||||
-#backend_port0 = 5432
|
||||
-#backend_weight0 = 1
|
||||
-#backend_data_directory0 = '/data'
|
||||
+backend_hostname0 = 'localhost'
|
||||
+backend_port0 = 5432
|
||||
+backend_weight0 = 1
|
||||
+backend_data_directory0 = '/var/lib/pgsql/data'
|
||||
#backend_hostname1 = 'host2'
|
||||
#backend_port1 = 5433
|
||||
#backend_weight1 = 1
|
||||
|
|
|
|||
88
pgpool.init
88
pgpool.init
|
|
@ -8,12 +8,11 @@
|
|||
#
|
||||
# v1.0.0 Devrim GUNDUZ <devrim@CommandPrompt.com>
|
||||
# - Initial version of Red Hat / Fedora init script
|
||||
# v1.0.1 Devrim GUNDUZ <devrim@CommandPrompt.com>
|
||||
# - - Honor /etc/sysconfig/pgpool settings. Previously we could never
|
||||
# customize PGPOOLPID=/var/run/pgpool.pid et al.
|
||||
# - Remaining hardcoded paths replaced by customizable variables
|
||||
# such as $PGPOOLCONF .
|
||||
|
||||
|
||||
if [ -r /etc/sysconfig/pgpool ]; then
|
||||
. /etc/sysconfig/pgpool
|
||||
fi
|
||||
|
||||
# Source function library.
|
||||
INITD=/etc/rc.d/init.d
|
||||
. $INITD/functions
|
||||
|
|
@ -29,30 +28,23 @@ TYPESET=`typeset -f|grep "declare"`
|
|||
[ "${NETWORKING}" = "no" ] && exit 0
|
||||
|
||||
# Find the name of the script
|
||||
NAME=pgpool
|
||||
NAME=`basename $0`
|
||||
if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
|
||||
then
|
||||
NAME=${NAME:3}
|
||||
fi
|
||||
|
||||
# Set defaults for configuration variables
|
||||
PGPOOLENGINE=/usr/bin
|
||||
PGPOOLDAEMON=$PGPOOLENGINE/pgpool
|
||||
PGPOOLCONF=/etc/pgpool.conf
|
||||
PGPOOLPID=/var/run/pgpool.pid
|
||||
PGPOOLCONF=/etc/pgpool-II/pgpool.conf
|
||||
PGPOOLPIDDIR=/var/run/pgpool
|
||||
PGPOOLLOG=/var/log/pgpool.log
|
||||
|
||||
# read in the site custom setup
|
||||
if [ -r /etc/sysconfig/pgpool ]; then
|
||||
. /etc/sysconfig/pgpool
|
||||
fi
|
||||
|
||||
test -x $PGPOOLDAEMON || exit 5
|
||||
|
||||
# Create the pgpool.log log file if it does not exist
|
||||
if [ ! -r $PGPOOLLOG ]
|
||||
then
|
||||
touch $PGPOOLLOG
|
||||
fi
|
||||
|
||||
# Check whether the pgpool.conf config file exists or not
|
||||
if [ ! -r "$PGPOOLCONF" ]
|
||||
# Check whether the config file exists or not
|
||||
if [ ! -r $PGPOOLCONF ]
|
||||
then
|
||||
echo "$PGPOOLCONF not found"
|
||||
RETVAL=1
|
||||
|
|
@ -60,12 +52,36 @@ then
|
|||
exit
|
||||
fi
|
||||
|
||||
# Create the log file if it does not exist
|
||||
if [ ! -x $PGPOOLLOG ]
|
||||
then
|
||||
touch $PGPOOLLOG
|
||||
chown postgres: $PGPOOLLOG
|
||||
fi
|
||||
|
||||
if [ ! -d $PGPOOLPIDDIR ]
|
||||
then
|
||||
mkdir $PGPOOLPIDDIR
|
||||
chown postgres: $PGPOOLPIDDIR
|
||||
fi
|
||||
|
||||
script_result=0
|
||||
|
||||
start(){
|
||||
pid=`pidof -s "$PGPOOLDAEMON"`
|
||||
if [ $pid ]
|
||||
then
|
||||
echo "pgpool is already running with pid $pid"
|
||||
failure "$PGPOQL_START"
|
||||
echo
|
||||
script_result=1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PGPOOL_START=$"Starting ${NAME} service: "
|
||||
|
||||
echo -n "$PGPOOL_START"
|
||||
|
||||
$PGPOOLDAEMON -f $PGPOOLCONF $OPTS & >> "$PGPOOLLOG" 2>&1 < /dev/null
|
||||
sleep 2
|
||||
|
||||
|
|
@ -76,7 +92,7 @@ start(){
|
|||
touch /var/lock/subsys/${NAME}
|
||||
echo
|
||||
else
|
||||
failure "$PSQL_START"
|
||||
failure "$PGPOQL_START"
|
||||
echo
|
||||
script_result=1
|
||||
fi
|
||||
|
|
@ -88,7 +104,8 @@ stop(){
|
|||
RETVAL=1
|
||||
failure
|
||||
else
|
||||
killproc $PGPOOLDAEMON
|
||||
killproc /usr/bin/pgpool
|
||||
# $PGPOOLDAEMON stop & >> "$PGPOOLLOG" 2>&1 < /dev/null
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${NAME}
|
||||
fi;
|
||||
|
|
@ -98,7 +115,7 @@ stop(){
|
|||
|
||||
switch() {
|
||||
echo -n $"Sending switchover request to $NAME "
|
||||
$PGPOOLDAEMON switch >> "$PGPOOLLOG" 2>&1 < /dev/null
|
||||
$PGPOOLDAEMON -f $PGPOOLCONF switch >> "$PGPOOLLOG" 2>&1 < /dev/null
|
||||
RETVAL=$?
|
||||
echo
|
||||
if [ $RETVAL -eq 0 ]
|
||||
|
|
@ -116,22 +133,23 @@ restart(){
|
|||
}
|
||||
|
||||
reload(){
|
||||
echo -n $"Reloading ${NAME}: "
|
||||
if [ -n "`pidfileofproc $PGPOOLDAEMON`" ] ; then
|
||||
killproc $PGPOOLDAEMON -HUP
|
||||
else
|
||||
failure $"Reloading ${NAME}"
|
||||
fi
|
||||
RETVAL=$?
|
||||
echo
|
||||
echo -n $"Reloading ${NAME}: "
|
||||
|
||||
if [ -n "`pidfileofproc $PGPOOLDAEMON`" ] ; then
|
||||
killproc $PGPOOLDAEMON -HUP
|
||||
else
|
||||
failure $"Reloading ${NAME}"
|
||||
fi
|
||||
RETVAL=$?
|
||||
echo
|
||||
}
|
||||
|
||||
condrestart(){
|
||||
[ -e /var/lock/subsys/${NAME} ] && restart
|
||||
[ -e /var/lock/subsys/${NAME} ] && restart
|
||||
}
|
||||
|
||||
condstop(){
|
||||
[ -e /var/lock/subsys/${NAME} ] && stop
|
||||
[ -e /var/lock/subsys/${NAME} ] && stop
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ make %{?_smp_flags}
|
|||
rm -rf %{buildroot}
|
||||
make %{?_smp_flags} DESTDIR=%{buildroot} install
|
||||
install -d %{buildroot}%{_datadir}/%{short_name}
|
||||
mv %{buildroot}/%{_sysconfdir}/*.conf.sample %{buildroot}%{_datadir}/%{short_name}
|
||||
mv %{buildroot}/%{_sysconfdir}/%{name}/pcp.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pcp.conf
|
||||
mv %{buildroot}/%{_sysconfdir}/%{name}/pgpool.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pgpool.conf
|
||||
mv %{buildroot}/%{_sysconfdir}/%{name}/pool_hba.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pool_hba.conf
|
||||
install -d %{buildroot}%{_initrddir}
|
||||
install -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/pgpool
|
||||
install -d %{buildroot}%{_sysconfdir}/sysconfig
|
||||
|
|
@ -91,9 +93,9 @@ chkconfig --add pgpool
|
|||
%dir %{_datadir}/%{short_name}
|
||||
%{_datadir}/%{short_name}/system_db.sql
|
||||
%{_libdir}/libpcp.so.*
|
||||
%attr(764,root,root) %{_datadir}/%{short_name}/*.conf.sample
|
||||
%{_datadir}/%{short_name}/pgpool.pam
|
||||
%{_initrddir}/pgpool
|
||||
%attr(764,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/*.conf
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/pgpool
|
||||
|
||||
%files devel
|
||||
|
|
@ -106,6 +108,12 @@ chkconfig --add pgpool
|
|||
* Sun Mar 1 2009 Devrim Gunduz <devrim@CommandPrompt.com> 2.2-1
|
||||
- Update to 2.2
|
||||
- Update URL
|
||||
- Fix pid file path in init script.
|
||||
- Fix spec file -- we don't use short_name macro in pgcore spec file.
|
||||
- Create pgpool pid file directory.
|
||||
- Fix stop/start routines, also improve init script a bit.
|
||||
- Install conf files to a new directory (/etc/pgpool-II), and get rid
|
||||
of sample conf files.
|
||||
|
||||
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue