mirror of
https://abf.rosa.ru/djam/postgresql-pgpool-II.git
synced 2025-02-23 07:02:47 +00:00
Automatic import for version 3.0
This commit is contained in:
commit
8daa3a7049
17 changed files with 1786 additions and 0 deletions
2
.abf.yml
Normal file
2
.abf.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
sources:
|
||||
"pgpool-II-3.0.tar.gz": 4c3e950e843de81494dc959b4c6711d2581978df
|
17
pgpool-II-2.3.3-support-libsetproctitle.patch
Normal file
17
pgpool-II-2.3.3-support-libsetproctitle.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
diff -p -up pgpool-II-2.3.3/configure.in.setproctitle~ pgpool-II-2.3.3/configure.in
|
||||
--- pgpool-II-2.3.3/configure.in.setproctitle~ 2010-05-30 05:44:15.000000000 +0200
|
||||
+++ pgpool-II-2.3.3/configure.in 2010-07-15 18:14:23.810539167 +0200
|
||||
@@ -61,11 +61,12 @@ AC_CHECK_LIB(gen, main)
|
||||
AC_CHECK_LIB(PW, main)
|
||||
AC_CHECK_LIB(resolv, main)
|
||||
AC_CHECK_LIB(crypt, main)
|
||||
+AC_CHECK_LIB(setproctitle,setproctitle)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
-AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h netinet/tcp.h netinet/in.h netdb.h sys/param.h sys/types.h sys/socket.h sys/un.h sys/time.h sys/sem.h sys/shm.h sys/select.h crypt.h sys/pstat.h)
|
||||
+AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h netinet/tcp.h netinet/in.h netdb.h sys/param.h sys/types.h sys/socket.h sys/un.h sys/time.h sys/sem.h sys/shm.h sys/select.h crypt.h sys/pstat.h setproctitle.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
152
pgpool-II-3.0-add-md5-username-option.patch
Normal file
152
pgpool-II-3.0-add-md5-username-option.patch
Normal file
|
@ -0,0 +1,152 @@
|
|||
diff --git a/pg_md5.c b/pg_md5.c
|
||||
index b57af73..3b7e5c4 100644
|
||||
--- a/pg_md5.c
|
||||
+++ b/pg_md5.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-pgsql-c-*- */
|
||||
/*
|
||||
- * $Header: /cvsroot/pgpool/pgpool-II/pg_md5.c,v 1.8 2010/08/22 08:24:01 gleu Exp $
|
||||
+ * $Header: /cvsroot/pgpool/pgpool-II/pg_md5.c,v 1.9 2010/10/01 06:15:34 kitagawa Exp $
|
||||
*
|
||||
* pgpool: a language independent connection pool server for PostgreSQL
|
||||
* written by Tatsuo Ishii
|
||||
@@ -42,10 +42,12 @@
|
||||
|
||||
/* Maximum number of characters allowed for input. */
|
||||
#define MAX_INPUT_SIZE 32
|
||||
+/* Maximum length of a user name */
|
||||
+#define MAX_USERNAME_LEN 128
|
||||
|
||||
static void print_usage(const char prog[], int exit_code);
|
||||
static void set_tio_attr(int enable);
|
||||
-static void update_pool_passwd(char *conf_file, char *password);
|
||||
+static void update_pool_passwd(char *conf_file, char *username, char *password);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@@ -53,6 +55,7 @@ main(int argc, char *argv[])
|
||||
#define PRINT_USAGE(exit_code) print_usage(argv[0], exit_code)
|
||||
|
||||
char conf_file[POOLMAXPATHLEN+1];
|
||||
+ char username[MAX_USERNAME_LEN+1] = "";
|
||||
int opt;
|
||||
int optindex;
|
||||
bool md5auth = false;
|
||||
@@ -62,14 +65,14 @@ main(int argc, char *argv[])
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"prompt", no_argument, NULL, 'p'},
|
||||
{"md5auth", no_argument, NULL, 'm'},
|
||||
- {"md5auth", no_argument, NULL, 'm'},
|
||||
+ {"username", required_argument, NULL, 'U'},
|
||||
{"config-file", required_argument, NULL, 'f'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
snprintf(conf_file, sizeof(conf_file), "%s/%s", DEFAULT_CONFIGDIR, POOL_CONF_FILE_NAME);
|
||||
|
||||
- while ((opt = getopt_long(argc, argv, "hpmf:", long_options, &optindex)) != -1)
|
||||
+ while ((opt = getopt_long(argc, argv, "hpmU:f:", long_options, &optindex)) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
@@ -81,6 +84,14 @@ main(int argc, char *argv[])
|
||||
md5auth = true;
|
||||
break;
|
||||
|
||||
+ case 'U': /* specify user name */
|
||||
+ if (!optarg)
|
||||
+ {
|
||||
+ PRINT_USAGE(EXIT_SUCCESS);
|
||||
+ }
|
||||
+ strncpy(username, optarg, sizeof(username));
|
||||
+ break;
|
||||
+
|
||||
case 'f': /* specify configuration file */
|
||||
if (!optarg)
|
||||
{
|
||||
@@ -125,12 +136,12 @@ main(int argc, char *argv[])
|
||||
|
||||
if (md5auth)
|
||||
{
|
||||
- update_pool_passwd(conf_file, buf);
|
||||
+ update_pool_passwd(conf_file, username, buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool_md5_hash(buf, len, md5);
|
||||
- printf("%s\n", md5);
|
||||
+ printf("\n%s\n", md5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +166,7 @@ main(int argc, char *argv[])
|
||||
|
||||
if (md5auth)
|
||||
{
|
||||
- update_pool_passwd(conf_file, argv[optind]);
|
||||
+ update_pool_passwd(conf_file, username, argv[optind]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -167,7 +178,7 @@ main(int argc, char *argv[])
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
-static void update_pool_passwd(char *conf_file, char *password)
|
||||
+static void update_pool_passwd(char *conf_file, char *username, char *password)
|
||||
{
|
||||
struct passwd *pw;
|
||||
char md5[MD5_PASSWD_LEN+1];
|
||||
@@ -188,14 +199,19 @@ static void update_pool_passwd(char *conf_file, char *password)
|
||||
dirname(conf_file), pool_config->pool_passwd);
|
||||
pool_init_pool_passwd(pool_passwd);
|
||||
|
||||
- pw = getpwuid(getuid());
|
||||
- if (!pw)
|
||||
+ if (*username == '\0')
|
||||
{
|
||||
- fprintf(stderr, "getpwuid() failed\n\n");
|
||||
- exit(EXIT_FAILURE);
|
||||
+ pw = getpwuid(getuid());
|
||||
+ if (!pw)
|
||||
+ {
|
||||
+ fprintf(stderr, "getpwuid() failed\n\n");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+ strncpy(username, pw->pw_name, sizeof(username));
|
||||
}
|
||||
- pg_md5_encrypt(password, pw->pw_name, strlen(pw->pw_name), md5);
|
||||
- pool_create_passwdent(pw->pw_name, md5);
|
||||
+ pg_md5_encrypt(password, username, strlen(username), md5);
|
||||
+ pool_create_passwdent(username, md5);
|
||||
+
|
||||
pool_finish_pool_passwd();
|
||||
}
|
||||
|
||||
@@ -204,19 +220,19 @@ print_usage(const char prog[], int exit_code)
|
||||
{
|
||||
fprintf(((exit_code == EXIT_SUCCESS) ? stdout : stderr),
|
||||
"Usage:\n\
|
||||
+ %s [OPTIONS]... [PASSWORD]\n\
|
||||
\n\
|
||||
- %s [OPTIONS]\n\
|
||||
- %s <PASSWORD>\n\
|
||||
-\n\
|
||||
- --prompt, -p Prompt password using standard input.\n\
|
||||
- --md5auth, -m Produce md5 authentication password.\n\
|
||||
- --help, -h This help menu.\n\
|
||||
+Options:\n\
|
||||
+ -p, --prompt Prompt password using standard input.\n\
|
||||
+ -m, --md5auth Produce md5 authentication password.\n\
|
||||
+ -U, --username=NAME Database user name for md5 authentication.\n\
|
||||
+ -h, --help This help menu.\n\
|
||||
\n\
|
||||
Warning: At most %d characters are allowed for input.\n\
|
||||
Warning: Plain password argument is deprecated for security concerns\n\
|
||||
and kept for compatibility. Please prefer using password\n\
|
||||
prompt.\n",
|
||||
- prog, prog, MAX_INPUT_SIZE);
|
||||
+ prog, MAX_INPUT_SIZE);
|
||||
|
||||
exit(exit_code);
|
||||
}
|
45
pgpool-II-3.0-custom-unix-socket-dir.patch
Normal file
45
pgpool-II-3.0-custom-unix-socket-dir.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
diff -p -up pgpool-II-3.0/configure.in.socketspath~ pgpool-II-3.0/configure.in
|
||||
--- pgpool-II-3.0/configure.in.socketspath~ 2010-09-15 12:13:27.688840411 +0200
|
||||
+++ pgpool-II-3.0/configure.in 2010-09-15 12:13:11.774142794 +0200
|
||||
@@ -308,6 +308,12 @@ if test "$with_pam" = yes ; then
|
||||
[AC_MSG_ERROR([header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.])])])
|
||||
fi
|
||||
|
||||
+AC_ARG_WITH(
|
||||
+ [socket-dir],
|
||||
+ AS_HELP_STRING([--with-socket-dir=ARG], [unix socket dir default=[/tmp]]),
|
||||
+ [AC_DEFINE_UNQUOTED([UNIX_SOCKET_DIR], ["$withval"], [Define to use different unix sockets path than '/tmp'])]
|
||||
+)
|
||||
+
|
||||
OLD_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="-L$PGSQL_LIB_DIR"
|
||||
OLD_LIBS="$LIBS"
|
||||
diff -p -up pgpool-II-3.0/pcp/pcp_stream.h.socketspath~ pgpool-II-3.0/pcp/pcp_stream.h
|
||||
--- pgpool-II-3.0/pcp/pcp_stream.h.socketspath~ 2010-09-15 12:14:20.536836280 +0200
|
||||
+++ pgpool-II-3.0/pcp/pcp_stream.h 2010-09-15 12:16:38.645212173 +0200
|
||||
@@ -47,6 +47,10 @@ extern int pcp_read(PCP_CONNECTION *pc,
|
||||
extern int pcp_write(PCP_CONNECTION *pc, void *buf, int len);
|
||||
extern int pcp_flush(PCP_CONNECTION *pc);
|
||||
|
||||
+#ifdef UNIX_SOCKET_DIR
|
||||
+#define UNIX_DOMAIN_PATH UNIX_SOCKET_DIR
|
||||
+#else
|
||||
#define UNIX_DOMAIN_PATH "/tmp"
|
||||
+#endif
|
||||
|
||||
#endif /* PCP_STREAM_H */
|
||||
diff -p -up pgpool-II-3.0/pool.h.socketspath~ pgpool-II-3.0/pool.h
|
||||
--- pgpool-II-3.0/pool.h.socketspath~ 2010-09-15 12:13:43.915532096 +0200
|
||||
+++ pgpool-II-3.0/pool.h 2010-09-15 12:15:46.794197357 +0200
|
||||
@@ -61,7 +61,11 @@
|
||||
#define DEFAULT_LOGDIR "/tmp"
|
||||
|
||||
/* Unix domain socket directory */
|
||||
+#ifdef UNIX_SOCKET_DIR
|
||||
+#define DEFAULT_SOCKET_DIR UNIX_SOCKET_DIR
|
||||
+#else
|
||||
#define DEFAULT_SOCKET_DIR "/tmp"
|
||||
+#endif
|
||||
|
||||
/* pid file name */
|
||||
#define DEFAULT_PID_FILE_NAME "/var/run/pgpool/pgpool.pid"
|
56
pgpool-II-3.0-fix-md5-auth-bug.patch
Normal file
56
pgpool-II-3.0-fix-md5-auth-bug.patch
Normal file
|
@ -0,0 +1,56 @@
|
|||
diff --git a/pool_auth.c b/pool_auth.c
|
||||
index c6efb13..40a6acd 100644
|
||||
--- a/pool_auth.c
|
||||
+++ b/pool_auth.c
|
||||
@@ -1,11 +1,11 @@
|
||||
/* -*-pgsql-c-*- */
|
||||
/*
|
||||
- * $Header: /cvsroot/pgpool/pgpool-II/pool_auth.c,v 1.25 2010/08/17 02:22:17 kitagawa Exp $
|
||||
+ * $Header: /cvsroot/pgpool/pgpool-II/pool_auth.c,v 1.26 2010/09/28 08:00:48 t-ishii Exp $
|
||||
*
|
||||
* pgpool: a language independent connection pool server for PostgreSQL
|
||||
* written by Tatsuo Ishii
|
||||
*
|
||||
- * Copyright (c) 2003-2009 PgPool Global Development Group
|
||||
+ * Copyright (c) 2003-2010 PgPool Global Development Group
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
@@ -131,6 +131,8 @@ from pool_read_message_length and recheck the pg_hba.conf settings.");
|
||||
|
||||
authkind = ntohl(authkind);
|
||||
|
||||
+ pool_debug("pool_do_auth: auth kind:%d", authkind);
|
||||
+
|
||||
/* trust? */
|
||||
if (authkind == 0)
|
||||
{
|
||||
@@ -833,6 +835,14 @@ static int do_md5(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reaut
|
||||
|
||||
if (!RAW_MODE && NUM_BACKENDS > 1)
|
||||
{
|
||||
+ /* Read password entry from pool_passwd */
|
||||
+ pool_passwd = pool_get_passwd(frontend->username);
|
||||
+ if (!pool_passwd)
|
||||
+ {
|
||||
+ pool_debug("do_md5: %s does not exist in pool_passwd", frontend->username);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* master? */
|
||||
if (IS_MASTER_NODE_ID(backend->db_node_id))
|
||||
{
|
||||
@@ -852,13 +862,6 @@ static int do_md5(POOL_CONNECTION *backend, POOL_CONNECTION *frontend, int reaut
|
||||
}
|
||||
|
||||
/* Check the password using my salt + pool_passwd */
|
||||
- pool_passwd = pool_get_passwd(frontend->username);
|
||||
- if (!pool_passwd)
|
||||
- {
|
||||
- pool_debug("do_md5: %s does not exist in pool_passwd", frontend->username);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
pg_md5_encrypt(pool_passwd+strlen("md5"), salt, sizeof(salt), encbuf);
|
||||
if (strcmp(password, encbuf))
|
||||
{
|
|
@ -0,0 +1,74 @@
|
|||
diff --git a/pool_proto_modules.c b/pool_proto_modules.c
|
||||
index aad5a01..d254896 100644
|
||||
--- a/pool_proto_modules.c
|
||||
+++ b/pool_proto_modules.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-pgsql-c-*- */
|
||||
/*
|
||||
- * $Header: /cvsroot/pgpool/pgpool-II/pool_proto_modules.c,v 1.85 2010/08/30 03:55:58 kitagawa Exp $
|
||||
+ * $Header: /cvsroot/pgpool/pgpool-II/pool_proto_modules.c,v 1.86 2010/09/27 02:01:57 kitagawa Exp $
|
||||
*
|
||||
* pgpool: a language independent connection pool server for PostgreSQL
|
||||
* written by Tatsuo Ishii
|
||||
@@ -164,10 +164,8 @@ POOL_STATUS SimpleQuery(POOL_CONNECTION *frontend,
|
||||
* The command will be sent to all backends in replication mode
|
||||
* or master/primary in master/slave mode.
|
||||
*/
|
||||
- char *p = "DELETE FROM foo WHERE col = 'pgpool: unable to parse the query'";
|
||||
-
|
||||
pool_log("SimpleQuery: Unable to parse the query: %s", contents);
|
||||
- parse_tree_list = raw_parser(p);
|
||||
+ parse_tree_list = raw_parser(POOL_DUMMY_QUERY);
|
||||
}
|
||||
|
||||
if (parse_tree_list != NIL)
|
||||
@@ -615,13 +613,25 @@ POOL_STATUS Parse(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend,
|
||||
old_context = pool_memory;
|
||||
pool_memory = query_context->memory_context;
|
||||
|
||||
+ /* parse SQL string */
|
||||
parse_tree_list = raw_parser(stmt);
|
||||
+
|
||||
if (parse_tree_list == NIL)
|
||||
{
|
||||
- /* free_parser(); */
|
||||
- ;
|
||||
+ /*
|
||||
+ * Unable to parse the query. Probably syntax error or the
|
||||
+ * query is too new and our parser cannot understand. Treat as
|
||||
+ * if it were an DELETE command. Note that the DELETE command
|
||||
+ * does not execute, instead the original query will be sent
|
||||
+ * to backends, which may or may not cause an actual syntax errors.
|
||||
+ * The command will be sent to all backends in replication mode
|
||||
+ * or master/primary in master/slave mode.
|
||||
+ */
|
||||
+ pool_log("Parse: Unable to parse the query: %s", contents);
|
||||
+ parse_tree_list = raw_parser(POOL_DUMMY_QUERY);
|
||||
}
|
||||
- else
|
||||
+
|
||||
+ if (parse_tree_list != NIL)
|
||||
{
|
||||
/* Save last query string for logging purpose */
|
||||
snprintf(query_string_buffer, sizeof(query_string_buffer), "Parse: %s", stmt);
|
||||
diff --git a/pool_proto_modules.h b/pool_proto_modules.h
|
||||
index 903a42d..d07e689 100644
|
||||
--- a/pool_proto_modules.h
|
||||
+++ b/pool_proto_modules.h
|
||||
@@ -1,7 +1,7 @@
|
||||
/* -*-pgsql-c-*- */
|
||||
/*
|
||||
*
|
||||
- * $Header: /cvsroot/pgpool/pgpool-II/pool_proto_modules.h,v 1.23 2010/08/26 09:23:06 kitagawa Exp $
|
||||
+ * $Header: /cvsroot/pgpool/pgpool-II/pool_proto_modules.h,v 1.24 2010/09/27 02:01:57 kitagawa Exp $
|
||||
*
|
||||
* pgpool: a language independent connection pool server for PostgreSQL
|
||||
* written by Tatsuo Ishii
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "pool_session_context.h"
|
||||
|
||||
#define SPECIFIED_ERROR 1
|
||||
+#define POOL_DUMMY_QUERY "DELETE FROM foo WHERE col = 'pgpool: unable to parse the query'"
|
||||
#define POOL_ERROR_QUERY "send invalid query from pgpool to abort transaction"
|
||||
|
||||
extern char *copy_table; /* copy table name */
|
71
pgpool-II-3.0-logfile.patch
Normal file
71
pgpool-II-3.0-logfile.patch
Normal file
|
@ -0,0 +1,71 @@
|
|||
diff --git a/main.c b/main.c
|
||||
index 431c660..fbfa626 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -141,6 +141,7 @@ static int pcp_inet_fd; /* inet domain socket fd for PCP */
|
||||
static char pcp_conf_file[POOLMAXPATHLEN+1]; /* path for pcp.conf */
|
||||
static char conf_file[POOLMAXPATHLEN+1];
|
||||
static char hba_file[POOLMAXPATHLEN+1];
|
||||
+static char log_file[POOLMAXPATHLEN+1]; /* redirection file of stdout/stderr when running as daemon */
|
||||
|
||||
static int exiting = 0; /* non 0 if I'm exiting */
|
||||
static int switching = 0; /* non 0 if I'm fail overing or degenerating */
|
||||
@@ -194,6 +195,7 @@ int main(int argc, char **argv)
|
||||
{"config-file", required_argument, NULL, 'f'},
|
||||
{"pcp-file", required_argument, NULL, 'F'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
+ {"log", required_argument, NULL, 'l'},
|
||||
{"mode", required_argument, NULL, 'm'},
|
||||
{"dont-detach", no_argument, NULL, 'n'},
|
||||
{"discard-status", no_argument, NULL, 'D'},
|
||||
@@ -207,8 +209,10 @@ int main(int argc, char **argv)
|
||||
snprintf(conf_file, sizeof(conf_file), "%s/%s", DEFAULT_CONFIGDIR, POOL_CONF_FILE_NAME);
|
||||
snprintf(pcp_conf_file, sizeof(pcp_conf_file), "%s/%s", DEFAULT_CONFIGDIR, PCP_PASSWD_FILE_NAME);
|
||||
snprintf(hba_file, sizeof(hba_file), "%s/%s", DEFAULT_CONFIGDIR, HBA_CONF_FILE_NAME);
|
||||
+ snprintf(log_file, sizeof(log_file), "%s", DEFAULT_LOG_FILE);
|
||||
|
||||
- while ((opt = getopt_long(argc, argv, "a:cdf:F:hm:nDv", long_options, &optindex)) != -1)
|
||||
+
|
||||
+ while ((opt = getopt_long(argc, argv, "a:cdf:F:hl:m:nDv", long_options, &optindex)) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
@@ -252,6 +256,15 @@ int main(int argc, char **argv)
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
+ case 'l': /* specify log file */
|
||||
+ if (!optarg)
|
||||
+ {
|
||||
+ usage();
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ strncpy(log_file, optarg, sizeof(log_file));
|
||||
+ break;
|
||||
+
|
||||
case 'm': /* stop mode */
|
||||
if (!optarg)
|
||||
{
|
||||
@@ -758,7 +771,7 @@ static void daemonize(void)
|
||||
|
||||
rc_chdir = chdir("/");
|
||||
|
||||
- i = open("/dev/null", O_RDWR);
|
||||
+ i = open(log_file, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR);
|
||||
dup2(i, 0);
|
||||
dup2(i, 1);
|
||||
dup2(i, 2);
|
||||
diff --git a/pool.h b/pool.h
|
||||
index 9716c02..3aafc75 100644
|
||||
--- a/pool.h
|
||||
+++ b/pool.h
|
||||
@@ -66,6 +66,9 @@
|
||||
/* pid file name */
|
||||
#define DEFAULT_PID_FILE_NAME "/var/run/pgpool/pgpool.pid"
|
||||
|
||||
+/* daemon log file */
|
||||
+#define DEFAULT_LOG_FILE "/dev/null"
|
||||
+
|
||||
/* status file name */
|
||||
#define STATUS_FILE_NAME "pgpool_status"
|
||||
|
176
pgpool-II-3.0-pgpool.conf-mdkconf.patch
Normal file
176
pgpool-II-3.0-pgpool.conf-mdkconf.patch
Normal file
|
@ -0,0 +1,176 @@
|
|||
diff -p -up pgpool-II-3.0/pgpool.conf.sample.conf~ pgpool-II-3.0/pgpool.conf.sample
|
||||
--- pgpool-II-3.0/pgpool.conf.sample.conf~ 2010-09-01 06:58:47.000000000 +0200
|
||||
+++ pgpool-II-3.0/pgpool.conf.sample 2010-09-15 12:26:28.123011879 +0200
|
||||
@@ -12,15 +12,13 @@ port = 9999
|
||||
# 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/postgresql'
|
||||
|
||||
# Unix domain socket path for pgpool communication manager.
|
||||
-# (Debian package defaults to /var/run/postgresql)
|
||||
-pcp_socket_dir = '/tmp'
|
||||
+pcp_socket_dir = '/var/run/postgresql'
|
||||
|
||||
-# Unix domain socket path for the backend. Debian package defaults to /var/run/postgresql!
|
||||
+# Unix domain socket path for the backend.
|
||||
backend_socket_dir = '/tmp'
|
||||
|
||||
# pgpool communication manager timeout. 0 means no timeout. This parameter is ignored now.
|
||||
@@ -54,7 +52,7 @@ client_idle_limit = 0
|
||||
authentication_timeout = 60
|
||||
|
||||
# Logging directory
|
||||
-logdir = '/tmp'
|
||||
+logdir = '/var/log/postgres'
|
||||
|
||||
# pid file name
|
||||
pid_file_name = '/var/run/pgpool/pgpool.pid'
|
||||
@@ -139,7 +137,7 @@ health_check_timeout = 20
|
||||
health_check_period = 0
|
||||
|
||||
# Health check user
|
||||
-health_check_user = 'nobody'
|
||||
+health_check_user = 'pgpool'
|
||||
|
||||
# Execute command by failover.
|
||||
# special values: %d = node id
|
||||
@@ -220,11 +218,11 @@ system_db_password = ''
|
||||
#backend_hostname0 = 'host1'
|
||||
#backend_port0 = 5432
|
||||
#backend_weight0 = 1
|
||||
-#backend_data_directory0 = '/data'
|
||||
+#backend_data_directory0 = '/var/lib/pgsql/data'
|
||||
#backend_hostname1 = 'host2'
|
||||
#backend_port1 = 5433
|
||||
#backend_weight1 = 1
|
||||
-#backend_data_directory1 = '/data1'
|
||||
+#backend_data_directory1 = '/var/lib/pgsql/data'
|
||||
|
||||
# - HBA -
|
||||
|
||||
@@ -233,7 +231,7 @@ enable_pool_hba = false
|
||||
|
||||
# - online recovery -
|
||||
# online recovery user
|
||||
-recovery_user = 'nobody'
|
||||
+recovery_user = 'pgpool'
|
||||
|
||||
# online recovery password
|
||||
recovery_password = ''
|
||||
diff -p -up pgpool-II-3.0/pgpool.conf.sample-master-slave.conf~ pgpool-II-3.0/pgpool.conf.sample-master-slave
|
||||
--- pgpool-II-3.0/pgpool.conf.sample-master-slave.conf~ 2010-09-01 06:58:47.000000000 +0200
|
||||
+++ pgpool-II-3.0/pgpool.conf.sample-master-slave 2010-09-15 12:25:53.526669222 +0200
|
||||
@@ -12,15 +12,13 @@ port = 9999
|
||||
# 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/postgresql'
|
||||
|
||||
# Unix domain socket path for pgpool communication manager.
|
||||
-# (Debian package defaults to /var/run/postgresql)
|
||||
-pcp_socket_dir = '/tmp'
|
||||
+pcp_socket_dir = '/var/run/postgresql'
|
||||
|
||||
-# Unix domain socket path for the backend. Debian package defaults to /var/run/postgresql!
|
||||
+# Unix domain socket path for the backend.
|
||||
backend_socket_dir = '/tmp'
|
||||
|
||||
# pgpool communication manager timeout. 0 means no timeout. This parameter is ignored now.
|
||||
@@ -54,7 +52,7 @@ client_idle_limit = 0
|
||||
authentication_timeout = 60
|
||||
|
||||
# Logging directory
|
||||
-logdir = '/tmp'
|
||||
+logdir = '/var/log/postgres'
|
||||
|
||||
# pid file name
|
||||
pid_file_name = '/var/run/pgpool/pgpool.pid'
|
||||
@@ -139,7 +137,7 @@ health_check_timeout = 20
|
||||
health_check_period = 0
|
||||
|
||||
# Health check user
|
||||
-health_check_user = 'nobody'
|
||||
+health_check_user = 'pgpool'
|
||||
|
||||
# Execute command by failover.
|
||||
# special values: %d = node id
|
||||
@@ -220,11 +218,11 @@ system_db_password = ''
|
||||
backend_hostname0 = 'host1'
|
||||
backend_port0 = 5432
|
||||
backend_weight0 = 1
|
||||
-backend_data_directory0 = '/data'
|
||||
+backend_data_directory0 = '/var/lib/pgsql/data'
|
||||
backend_hostname1 = 'host2'
|
||||
backend_port1 = 5432
|
||||
backend_weight1 = 1
|
||||
-backend_data_directory1 = '/data1'
|
||||
+backend_data_directory1 = '/var/lib/pgsql/data'
|
||||
|
||||
# - HBA -
|
||||
|
||||
@@ -233,7 +231,7 @@ enable_pool_hba = false
|
||||
|
||||
# - online recovery -
|
||||
# online recovery user
|
||||
-recovery_user = 'nobody'
|
||||
+recovery_user = 'pgpool'
|
||||
|
||||
# online recovery password
|
||||
recovery_password = ''
|
||||
diff -p -up pgpool-II-3.0/pgpool.conf.sample-replication.conf~ pgpool-II-3.0/pgpool.conf.sample-replication
|
||||
--- pgpool-II-3.0/pgpool.conf.sample-replication.conf~ 2010-09-01 06:58:47.000000000 +0200
|
||||
+++ pgpool-II-3.0/pgpool.conf.sample-replication 2010-09-15 12:25:30.630104264 +0200
|
||||
@@ -12,16 +12,14 @@ port = 9999
|
||||
# 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/postgresql'
|
||||
|
||||
# Unix domain socket path for pgpool communication manager.
|
||||
-# (Debian package defaults to /var/run/postgresql)
|
||||
-pcp_socket_dir = '/tmp'
|
||||
+pcp_socket_dir = '/var/run/postgresql'
|
||||
|
||||
-# 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/log/postgres'
|
||||
|
||||
# pgpool communication manager timeout. 0 means no timeout. This parameter is ignored now.
|
||||
pcp_timeout = 10
|
||||
@@ -54,7 +52,7 @@ client_idle_limit = 0
|
||||
authentication_timeout = 60
|
||||
|
||||
# Logging directory
|
||||
-logdir = '/tmp'
|
||||
+logdir = '/var/log/postgres'
|
||||
|
||||
# pid file name
|
||||
pid_file_name = '/var/run/pgpool/pgpool.pid'
|
||||
@@ -220,11 +218,11 @@ system_db_password = ''
|
||||
backend_hostname0 = 'host1'
|
||||
backend_port0 = 5432
|
||||
backend_weight0 = 1
|
||||
-backend_data_directory0 = '/data'
|
||||
+backend_data_directory0 = '/var/lib/pgsql/data'
|
||||
backend_hostname1 = 'host2'
|
||||
backend_port1 = 5432
|
||||
backend_weight1 = 1
|
||||
-backend_data_directory1 = '/data1'
|
||||
+backend_data_directory1 = '/var/lib/pgsql/data'
|
||||
|
||||
# - HBA -
|
||||
|
43
pgpool-II-3.0-recovery-script-customizations.patch
Normal file
43
pgpool-II-3.0-recovery-script-customizations.patch
Normal file
|
@ -0,0 +1,43 @@
|
|||
--- pgpool-II-3.0/sample/pgpool_recovery_pitr.recovery~ 2010-08-13 02:28:14.000000000 +0200
|
||||
+++ pgpool-II-3.0/sample/pgpool_recovery_pitr 2010-10-06 02:07:37.837857439 +0200
|
||||
@@ -1,11 +1,18 @@
|
||||
#! /bin/sh
|
||||
# Online recovery 2nd stage script
|
||||
#
|
||||
-datadir=$1 # master dabatase cluster
|
||||
+PGDATA=$1 # master dabatase cluster
|
||||
DEST=$2 # hostname of the DB node to be recovered
|
||||
DESTDIR=$3 # database cluster of the DB node to be recovered
|
||||
+PGSQL_HOME="$(dirname $PGDATA)"
|
||||
port=5432 # PostgreSQL port number
|
||||
-archdir=/data/archive_log # archive log directory
|
||||
+archdir="$PGSQL_HOME/archive" # archive log directory
|
||||
+
|
||||
+ARCHIVING_LOCK="${PGDATA}/archiving_enabled"
|
||||
+if [ ! -f "$ARCHIVING_LOCK" ]; then
|
||||
+ echo No "$ARCHIVING_LOCK", giving up
|
||||
+ exit 1
|
||||
+fi
|
||||
|
||||
# Force to flush current value of sequences to xlog
|
||||
psql -p $port -t -c 'SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn' template1|
|
||||
@@ -17,3 +24,5 @@ do
|
||||
done
|
||||
|
||||
psql -p $port -c "SELECT pgpool_switch_xlog('$archdir')" template1
|
||||
+
|
||||
+rm -f ${ARCHIVING_LOCK}
|
||||
--- pgpool-II-3.0/sample/pgpool_remote_start.recovery~ 2007-06-27 11:04:43.000000000 +0200
|
||||
+++ pgpool-II-3.0/sample/pgpool_remote_start 2010-10-06 02:08:53.130426854 +0200
|
||||
@@ -8,6 +8,9 @@ fi
|
||||
|
||||
DEST=$1
|
||||
DESTDIR=$2
|
||||
-PGCTL=/usr/local/pgsql/bin/pg_ctl
|
||||
+PGCTL=/usr/bin/pg_ctl
|
||||
|
||||
-ssh -T $DEST $PGCTL -w -D $DESTDIR start 2>/dev/null 1>/dev/null < /dev/null &
|
||||
+ssh -x -T $DEST "test -r /etc/sysconfig/postgresql && . /etc/sysconfig/postgresql; \
|
||||
+ $PGCTL -D $DESTDIR status && $PGCTL -w -D $DESTDIR stop -m immediate; \
|
||||
+ tar -C $DESTDIR -zxf $DESTDIR/data.tar.gz && \
|
||||
+ $PGCTL -w -D $DESTDIR start -l /var/log/postgres/postgresql \$PGOPTIONS"
|
34
pgpool-II-3.0-verify-child-pid-survival.patch
Normal file
34
pgpool-II-3.0-verify-child-pid-survival.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
diff -p -up pgpool-II-3.0/main.c.verify_child_pid~ pgpool-II-3.0/main.c
|
||||
--- pgpool-II-3.0/main.c.verify_child_pid~ 2010-09-15 12:53:00.713626463 +0200
|
||||
+++ pgpool-II-3.0/main.c 2010-09-15 12:54:01.550470540 +0200
|
||||
@@ -730,6 +730,8 @@ static void daemonize(void)
|
||||
pid_t pid;
|
||||
int fdlimit;
|
||||
int rc_chdir;
|
||||
+ int pstatus = 0;
|
||||
+
|
||||
|
||||
pid = fork();
|
||||
if (pid == (pid_t) -1)
|
||||
@@ -741,8 +743,19 @@ static void daemonize(void)
|
||||
}
|
||||
else if (pid > 0)
|
||||
{ /* parent */
|
||||
- pool_shmem_exit(0);
|
||||
- exit(0);
|
||||
+ /* Just wait a short while to see if we succeed getting child
|
||||
+ * processes actually up and running once started, otherwise
|
||||
+ * we'll return with a success exit code even though the child
|
||||
+ * dies and exits with failure code. If child has died during
|
||||
+ * the short while we were waiting for it, we'll return with
|
||||
+ * it's exit code in stead, otherwise return with the default
|
||||
+ * success code.
|
||||
+ */
|
||||
+ usleep(100000);
|
||||
+ waitpid(pid, &pstatus, WNOHANG);
|
||||
+ pstatus=WEXITSTATUS(pstatus);
|
||||
+ pool_shmem_exit(pstatus);
|
||||
+ exit(pstatus);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETSID
|
15
pgpool-archive_command
Executable file
15
pgpool-archive_command
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
ARCHIVING_LOCK="archiving_enabled"
|
||||
BACKUP_LOCK="backup_in_progress"
|
||||
DEST="../archive/$2"
|
||||
RETVAL=0
|
||||
if [ -f "$ARCHIVING_LOCK" -o ! -f "$BACKUP_LOCK" ]; then
|
||||
touch "$BACKUP_LOCK"
|
||||
if [ ! -f "$DEST" ]; then
|
||||
install -m600 "$1" -D "$DEST"
|
||||
RETVAL=$?
|
||||
fi
|
||||
rm -f "$BACKUP_LOCK"
|
||||
fi
|
||||
exit $RETVAL
|
20
pgpool-copy-base-backup
Normal file
20
pgpool-copy-base-backup
Normal file
|
@ -0,0 +1,20 @@
|
|||
#! /bin/sh
|
||||
PGDATA=$1
|
||||
RECOVERY_TARGET=$2
|
||||
RECOVERY_DATA=$3
|
||||
PGCTL=/usr/bin/pg_ctl
|
||||
PGSQL_HOME="$(dirname $PGDATA)"
|
||||
ARCHIVING_LOCK="${PGDATA}/archiving_enabled"
|
||||
|
||||
rm -rf ${PGSQL_HOME}/archive
|
||||
touch "${ARCHIVING_LOCK}"
|
||||
psql -c "select pg_start_backup('pgpool-recovery')" postgres
|
||||
RETVAL=$?
|
||||
[ $RETVAL -ne 0 ] && echo exiting with $RETVAL && rm -f "${ARCHIVING_LOCK}" && exit $RETVAL
|
||||
tee ${PGDATA}/recovery.conf << EOH
|
||||
restore_command = 'scp ${HOSTNAME}:${PGSQL_HOME}/archive/%f %p'
|
||||
EOH
|
||||
tar -C ${PGDATA} -zcf ${PGDATA}/data.tar.gz global base pg_multixact pg_subtrans pg_clog pg_xlog pg_twophase pg_tblspc recovery.conf
|
||||
psql -c 'select pg_stop_backup()' postgres
|
||||
scp ${PGDATA}/data.tar.gz ${RECOVERY_TARGET}:${RECOVERY_DATA}
|
||||
rm -f ${PGDATA}/data.tar.gz ${PGDATA}/recovery.conf
|
32
pgpool-mirroring_failback
Executable file
32
pgpool-mirroring_failback
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
# This script will try connect to other pgpool servers when recovery of a node
|
||||
# has been succesful and reattach it to them as well.
|
||||
# Not tested with more than two nodes, beware of potential deadlocks with more...
|
||||
NODE_ID="$1"
|
||||
HOST_NAME="$2"
|
||||
PORT="$3"
|
||||
DB_PATH="$4"
|
||||
NEW_MASTER_ID="$5"
|
||||
OLD_MASTER_ID="$6"
|
||||
|
||||
PCP_PORT=9898
|
||||
PCP_USER=pgpool
|
||||
PCP_PASS=recovery
|
||||
PCP_TIMEOUT=10
|
||||
PCP_HOSTNAME='' # local unix socket
|
||||
|
||||
[ -r /etc/sysconfig/pgpool ] && . /etc/sysconfig/pgpool
|
||||
|
||||
NODES=$(pcp_node_count -d "${PCP_TIMEOUT}" "${HOST_NAME}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}")
|
||||
|
||||
# We assume node id for the host to be the same on all hosts, and reattach it on all hosts
|
||||
for ((i=0; i < NODES; i++))
|
||||
do
|
||||
# Assume that we're the master node and skip connecting to, otherwise we seem to create a deadlock..?
|
||||
[ "$i" = "${NEW_MASTER_ID}" ] && continue
|
||||
NODE_INFO=$(pcp_node_info "${PCP_TIMEOUT}" "${HOST_NAME}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}" "${i}")
|
||||
NODE=$(echo $NODE_INFO|cut -d\ -f1)
|
||||
[ "$NODE" = "${PCP_HOSTNAME}" ] && continue
|
||||
pcp_attach_node "${PCP_TIMEOUT}" "${NODE}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}" "${NEW_MASTER_NODE}"
|
||||
pcp_attach_node "${PCP_TIMEOUT}" "${NODE}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}" "${NODE_ID}"
|
||||
done
|
280
pgpool.conf.mirroring
Normal file
280
pgpool.conf.mirroring
Normal file
|
@ -0,0 +1,280 @@
|
|||
# Host name or IP address to listen on: '*' for all, '' for no TCP/IP
|
||||
# connections
|
||||
listen_addresses = 'localhost'
|
||||
|
||||
# Port number for pgpool
|
||||
port = 9999
|
||||
|
||||
# Port number for pgpool communication manager
|
||||
pcp_port = 9898
|
||||
|
||||
# Unix domain socket path.
|
||||
socket_dir = '/tmp'
|
||||
|
||||
# Unix domain socket path for pgpool communication manager.
|
||||
pcp_socket_dir = '/tmp'
|
||||
|
||||
# Unix domain socket path for the backend.
|
||||
backend_socket_dir = '/tmp'
|
||||
|
||||
# pgpool communication manager timeout. 0 means no timeout. This parameter is ignored now.
|
||||
pcp_timeout = 10
|
||||
|
||||
# number of pre-forked child process
|
||||
num_init_children = 32
|
||||
|
||||
# Number of connection pools allowed for a child process
|
||||
max_pool = 4
|
||||
|
||||
# If idle for this many seconds, child exits. 0 means no timeout.
|
||||
child_life_time = 300
|
||||
|
||||
# If idle for this many seconds, connection to PostgreSQL closes.
|
||||
# 0 means no timeout.
|
||||
connection_life_time = 0
|
||||
|
||||
# If child_max_connections connections were received, child exits.
|
||||
# 0 means no exit.
|
||||
child_max_connections = 0
|
||||
|
||||
# If client_idle_limit is n (n > 0), the client is forced to be
|
||||
# disconnected whenever after n seconds idle (even inside an explicit
|
||||
# transactions!)
|
||||
# 0 means no disconnect.
|
||||
client_idle_limit = 0
|
||||
|
||||
# Maximum time in seconds to complete client authentication.
|
||||
# 0 means no timeout.
|
||||
authentication_timeout = 60
|
||||
|
||||
# Logging directory
|
||||
logdir = '/var/log/postgres'
|
||||
|
||||
# pid file name
|
||||
pid_file_name = '/var/run/pgpool/pgpool.pid'
|
||||
|
||||
# Replication mode
|
||||
replication_mode = true
|
||||
|
||||
# Load balancing mode, i.e., all SELECTs are load balanced.
|
||||
load_balance_mode = true
|
||||
|
||||
# If there's a disagreement with the packet kind sent from backend,
|
||||
# then degenrate the node which is most likely "minority". If false,
|
||||
# just force to exit this session.
|
||||
replication_stop_on_mismatch = true
|
||||
|
||||
# If there's a disagreement with the number of affected tuples in
|
||||
# UPDATE/DELETE, then degenrate the node which is most likely
|
||||
# "minority".
|
||||
# If false, just abort the transaction to keep the consistency.
|
||||
failover_if_affected_tuples_mismatch = true
|
||||
|
||||
# If true, replicate SELECT statement when replication_mode or parallel_mode is enabled.
|
||||
# A priority of replicate_select is higher than load_balance_mode.
|
||||
replicate_select = false
|
||||
|
||||
# Semicolon separated list of queries to be issued at the end of a
|
||||
# session
|
||||
reset_query_list = 'ABORT; DISCARD ALL'
|
||||
# for 8.2 or older this should be as follows.
|
||||
#reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'
|
||||
|
||||
# white_function_list is a comma separated list of function names
|
||||
# those do not write to database. Any functions not listed here
|
||||
# are regarded to write to database and SELECTs including such
|
||||
# writer-functions will be executed on master(primary) in master/slave
|
||||
# mode, or executed on all DB nodes in replication mode.
|
||||
#
|
||||
# black_function_list is a comma separated list of function names
|
||||
# those write to database. Any functions not listed here
|
||||
# are regarded not to write to database and SELECTs including such
|
||||
# read-only-functions will be executed on any DB nodes.
|
||||
#
|
||||
# You cannot make full both white_function_list and
|
||||
# black_function_list at the same time. If you specify something in
|
||||
# one of them, you should make empty other.
|
||||
#
|
||||
# Pre 3.0 pgpool-II recognizes nextval and setval in hard coded
|
||||
# way. Following setting will do the same as the previous version.
|
||||
# white_function_list = ''
|
||||
# black_function_list = 'nextval,setval'
|
||||
white_function_list = ''
|
||||
black_function_list = 'nextval,setval'
|
||||
|
||||
# If true print timestamp on each log line.
|
||||
print_timestamp = true
|
||||
|
||||
# If true, operate in master/slave mode.
|
||||
master_slave_mode = false
|
||||
|
||||
# Master/slave sub mode. either 'slony' or 'stream'. Default is 'slony'.
|
||||
master_slave_sub_mode = 'slony'
|
||||
|
||||
# If the standby server delays more than delay_threshold,
|
||||
# any query goes to the primary only. The unit is in bytes.
|
||||
# 0 disables the check. Default is 0.
|
||||
# Note that health_check_period required to be greater than 0
|
||||
# to enable the functionality.
|
||||
delay_threshold = 0
|
||||
|
||||
# 'always' logs the standby delay whenever health check runs.
|
||||
# 'if_over_threshold' logs only if the delay exceeds delay_threshold.
|
||||
# 'none' disables the delay log.
|
||||
log_standby_delay = 'none'
|
||||
|
||||
# If true, cache connection pool.
|
||||
connection_cache = true
|
||||
|
||||
# Health check timeout. 0 means no timeout.
|
||||
health_check_timeout = 20
|
||||
|
||||
# Health check period. 0 means no health check.
|
||||
health_check_period = 60
|
||||
|
||||
# Health check user
|
||||
health_check_user = 'pgpool'
|
||||
|
||||
# Execute command by failover.
|
||||
# special values: %d = node id
|
||||
# %h = host name
|
||||
# %p = port number
|
||||
# %D = database cluster path
|
||||
# %m = new master node id
|
||||
# %M = old master node id
|
||||
# %% = '%' character
|
||||
#
|
||||
failover_command = ''
|
||||
|
||||
# Execute command by failback.
|
||||
# special values: %d = node id
|
||||
# %h = host name
|
||||
# %p = port number
|
||||
# %D = database cluster path
|
||||
# %m = new master node id
|
||||
# %M = old master node id
|
||||
# %% = '%' character
|
||||
#
|
||||
failback_command = '/usr/share/pgpool-II/mirroring_failback %d %h %p "%D" %m %M'
|
||||
|
||||
# If true, trigger fail over when writing to the backend communication
|
||||
# socket fails. This is the same behavior of pgpool-II 2.2.x or
|
||||
# earlier. If set to false, pgpool will report an error and disconnect
|
||||
# the session.
|
||||
fail_over_on_backend_error = true
|
||||
|
||||
# If true, automatically locks a table with INSERT statements to keep
|
||||
# SERIAL data consistency. If the data does not have SERIAL data
|
||||
# type, no lock will be issued. An /*INSERT LOCK*/ comment has the
|
||||
# same effect. A /NO INSERT LOCK*/ comment disables the effect.
|
||||
insert_lock = true
|
||||
|
||||
# If true, ignore leading white spaces of each query while pgpool judges
|
||||
# whether the query is a SELECT so that it can be load balanced. This
|
||||
# is useful for certain APIs such as DBI/DBD which is known to adding an
|
||||
# extra leading white space.
|
||||
ignore_leading_white_space = true
|
||||
|
||||
# If true, print all statements to the log. Like the log_statement option
|
||||
# to PostgreSQL, this allows for observing queries without engaging in full
|
||||
# debugging.
|
||||
log_statement = false
|
||||
|
||||
# If true, print all statements to the log. Similar to log_statement except
|
||||
# that prints DB node id and backend process id info.
|
||||
log_per_node_statement = false
|
||||
|
||||
# If true, incoming connections will be printed to the log.
|
||||
log_connections = false
|
||||
|
||||
# If true, hostname will be shown in ps status. Also shown in
|
||||
# connection log if log_connections = true.
|
||||
# Be warned that this feature will add overhead to look up hostname.
|
||||
log_hostname = false
|
||||
|
||||
# if non 0, run in parallel query mode
|
||||
parallel_mode = false
|
||||
|
||||
# if non 0, use query cache
|
||||
enable_query_cache = false
|
||||
|
||||
#set pgpool2 hostname
|
||||
pgpool2_hostname = ''
|
||||
|
||||
# system DB info
|
||||
system_db_hostname = 'localhost'
|
||||
system_db_port = 5432
|
||||
system_db_dbname = 'pgpool'
|
||||
system_db_schema = 'pgpool_catalog'
|
||||
system_db_user = 'pgpool'
|
||||
system_db_password = ''
|
||||
|
||||
# backend_hostname, backend_port, backend_weight
|
||||
# here are examples
|
||||
backend_hostname0 = 'host1'
|
||||
backend_port0 = 5432
|
||||
backend_weight0 = 1
|
||||
backend_data_directory0 = '/var/lib/pgsql/data'
|
||||
backend_hostname1 = 'host2'
|
||||
backend_port1 = 5432
|
||||
backend_weight1 = 1
|
||||
backend_data_directory1 = '/var/lib/pgsql/data'
|
||||
|
||||
# - HBA -
|
||||
|
||||
# If true, use pool_hba.conf for client authentication.
|
||||
enable_pool_hba = true
|
||||
|
||||
# - online recovery -
|
||||
# online recovery user
|
||||
recovery_user = 'pgpool'
|
||||
|
||||
# online recovery password
|
||||
recovery_password = 'recovery'
|
||||
|
||||
# execute a command in first stage.
|
||||
recovery_1st_stage_command = 'copy-base-backup'
|
||||
|
||||
# execute a command in second stage.
|
||||
recovery_2nd_stage_command = 'pgpool_recovery_pitr'
|
||||
|
||||
# maximum time in seconds to wait for the recovering node's postmaster
|
||||
# start-up. 0 means no wait.
|
||||
# this is also used as a timer waiting for clients disconnected before
|
||||
# starting 2nd stage
|
||||
recovery_timeout = 90
|
||||
|
||||
# If client_idle_limit_in_recovery is n (n > 0), the client is forced
|
||||
# to be disconnected whenever after n seconds idle (even inside an
|
||||
# explicit transactions!) in the second stage of online recovery.
|
||||
# n = -1 forces clients to be disconnected immediately.
|
||||
# 0 disables this functionality(wait forever).
|
||||
# This parameter only takes effect in recovery 2nd stage.
|
||||
client_idle_limit_in_recovery = 0
|
||||
|
||||
# Specify table name to lock. This is used when rewriting lo_creat
|
||||
# command in replication mode. The table must exist and has writable
|
||||
# permission to public. If the table name is '', no rewriting occurs.
|
||||
lobj_lock_table = 'pgpool_lock_table'
|
||||
|
||||
# If true, enable SSL support for both frontend and backend connections.
|
||||
# note that you must also set ssl_key and ssl_cert for SSL to work in
|
||||
# the frontend connections.
|
||||
ssl = false
|
||||
# path to the SSL private key file
|
||||
ssl_key = '/etc/pki/tls/private/localhost.key'
|
||||
# path to the SSL public certificate file
|
||||
ssl_cert = '/etc/pki/tls/certs/localhost.crt'
|
||||
|
||||
# If either ssl_ca_cert or ssl_ca_cert_dir is set, then certificate
|
||||
# verification will be performed to establish the authenticity of the
|
||||
# certificate. If neither is set to a nonempty string then no such
|
||||
# verification takes place. ssl_ca_cert should be a path to a single
|
||||
# PEM format file containing CA root certificate(s), whereas ssl_ca_cert_dir
|
||||
# should be a directory containing such files. These are analagous to the
|
||||
# -CAfile and -CApath options to openssl verify(1), respectively.
|
||||
ssl_ca_cert = '/etc/pki/tls/cert.pem'
|
||||
ssl_ca_cert_dir = '/etc/pki/tls/rootcerts'
|
||||
|
||||
# Debug message verbosity level. 0: no message, 1 <= : more verbose
|
||||
debug_level = 0
|
285
pgpool.init
Executable file
285
pgpool.init
Executable file
|
@ -0,0 +1,285 @@
|
|||
#!/bin/sh
|
||||
# Author: Per Øyvind Karlsen <peroyvind@mandriva.org>
|
||||
# (c) 2010 - Linus AS (http://www.linus.no)
|
||||
# Inspired by Fedora init script by Devrim GUNDUZ <devrim@CommandPrompt.com>
|
||||
#
|
||||
# chkconfig: 345 95 33
|
||||
# pidfile: /var/run/pgpool/pgpool.pid
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: pgpool
|
||||
# Required-Start: $local_fs $network
|
||||
# Required-Stop: $local_fs $network
|
||||
# Default-Start: 3 4 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Short-Description: PostgreSQL pgpool-II daemon
|
||||
# Description: pgpool-II is a connection pooling/replication server for PostgreSQL.
|
||||
### END INIT INFO
|
||||
|
||||
. /etc/init.d/functions
|
||||
|
||||
# Get config.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
PGDATA=/var/lib/pgsql/data
|
||||
|
||||
if [ -r /etc/sysconfig/postgresl ]; then
|
||||
. /etc/sysconfig/postgresql
|
||||
fi
|
||||
|
||||
# Set defaults for configuration variables
|
||||
PGPOOLDAEMON=/usr/bin/pgpool
|
||||
PGPOOLCONF=/etc/pgpool-II/pgpool.conf
|
||||
PGPOOLDATA=/usr/share/pgpool-II
|
||||
|
||||
PGDBUSER=pgpool
|
||||
PGDBNAME=pgpool
|
||||
NAME=pgpool-II
|
||||
BASEBIN="$(basename $PGPOOLDAEMON)"
|
||||
LOCK_FILE="/var/lock/subsys/${BASEBIN}"
|
||||
PID_FILE="/var/run/pgpool/${BASEBIN}.pid"
|
||||
LOG_FILE="/var/log/postgres/pgpool"
|
||||
|
||||
STOP_MODE="fast"
|
||||
|
||||
PCP_PORT=9898
|
||||
PCP_USER=pgpool
|
||||
PCP_PASS=recovery
|
||||
PCP_TIMEOUT=10
|
||||
PCP_HOSTNAME='' # local unix sockets
|
||||
|
||||
if [ -r /etc/sysconfig/pgpool ]; then
|
||||
. /etc/sysconfig/pgpool
|
||||
fi
|
||||
|
||||
if [ ! -x "$PGPOOLDAEMON" ]; then
|
||||
[ "$1" = "stop" ] && exit 0
|
||||
gprintf "%s needs to exist and be executable\n" "$PGPOOLDAEMON"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
# Check whether the config file exists or not
|
||||
if [ ! -r "$PGPOOLCONF" ]; then
|
||||
[ "$1" = "stop" ] && exit 0
|
||||
gprintf "%s needs to exist and be readable\n" "$PGPOOLCONF"
|
||||
exit 6
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
|
||||
init(){
|
||||
gprintf "Checking for postgresql '%s' user: " ${PGDBUSER}
|
||||
psql -U ${PGDBUSER} postgres -c ''&> /dev/null
|
||||
RETVAL=$?
|
||||
if [[ "$RETVAL" = 0 ]]; then
|
||||
success
|
||||
elif [[ "$RETVAL" = 1 ]]; then
|
||||
gprintf "'Postgresql user '%s' already exists, but unable to access" ${PGDBUSER}
|
||||
failed
|
||||
elif [[ "$RETVAL" = 2 ]]; then
|
||||
gprintf "creating%s" "..."
|
||||
createuser -U postgres --superuser --no-createdb --no-password ${PGDBUSER} &> /dev/null && passed
|
||||
[[ ! $? ]] && failure
|
||||
else
|
||||
success
|
||||
fi
|
||||
echo
|
||||
|
||||
gprintf "Checking for postgresql '%s' database: " ${PGDBUSER}
|
||||
psql -U ${PGDBUSER} ${PGDBNAME} -c '' &> /dev/null
|
||||
RETVAL=$?
|
||||
if [[ "$RETVAL" = 0 ]]; then
|
||||
success
|
||||
echo
|
||||
elif [[ "$RETVAL" = 1 ]]; then
|
||||
gprintf "'%s' %s already exists, but unable to access it" "${PGDBNAME}" "database" && warning
|
||||
[[ ! $? ]] && failure
|
||||
echo
|
||||
elif [[ "$RETVAL" = 2 ]]; then
|
||||
gprintf "preparing%s" "..."
|
||||
echo
|
||||
gprintf "Installing %s '%s': %s" "${NAME}" "recovery tunction" "..."
|
||||
psql -U postgres template1 -f /usr/share/postgresql/contrib/pgpool-recovery.sql &> /dev/null && passed
|
||||
[[ ! $? ]] && failure
|
||||
echo
|
||||
gprintf "Installing %s '%s': %s" "${NAME}" "regclass tunction" "..."
|
||||
psql -U postgres template1 -f /usr/share/postgresql/contrib/pgpool-regclass.sql &> /dev/null && passed
|
||||
[[ ! $? ]] && failure
|
||||
echo
|
||||
gprintf "Initializing '%s' %s: %s" "pgpool_lock_table" "lobj_lock_table table" "..."
|
||||
psql -U postgres template1 -c 'CREATE TABLE public.pgpool_lock_table (); GRANT ALL ON public.pgpool_lock_table TO PUBLIC;' &> /dev/null && passed
|
||||
[[ ! $? ]] && failure
|
||||
echo
|
||||
gprintf "Creating '%s' %s: %s" "${PGDBNAME}" "database" "..."
|
||||
createdb -U ${PGDBUSER} -O ${PGDBUSER} ${PGDBNAME} -T template1 && passed
|
||||
[[ ! $? ]] && failure
|
||||
echo
|
||||
gprintf "Installing postgresql '%s' database function: %s" "dblink" "..."
|
||||
psql -U ${PGDBUSER} -f /usr/share/postgresql/contrib/dblink.sql &> /dev/null && passed
|
||||
[[ ! $? ]] && failure
|
||||
echo
|
||||
gprintf "Initializing '%s': %s" "${NAME} system db" "..."
|
||||
psql -U ${PGDBUSER} -f /usr/share/pgpool-II/system_db.sql ${PGDBNAME} &> /dev/null && passed
|
||||
[[ ! $? ]] && failure
|
||||
echo
|
||||
else
|
||||
success
|
||||
fi
|
||||
for i in archive_command copy-base-backup pgpool_recovery pgpool_recovery_pitr pgpool_remote_start; do
|
||||
[ ! -e ${PGDATA}/${i} ] && su postgres -c "ln -s ${PGPOOLDATA}/${i} ${PGDATA}/${i}"
|
||||
done
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
rh_status_q && stop
|
||||
psql -U ${PGDBUSER} ${PGDBNAME} -f /usr/share/postgresql/contrib/uninstall_dblink.sql &> /dev/null
|
||||
psql -U postgres postgres -c 'DROP FUNCTION pgpool_recovery (text, text, text);' &> /dev/null
|
||||
psql -U postgres postgres -c 'DROP FUNCTION pgpool_remote_start (text, text);' &> /dev/null
|
||||
psql -U postgres postgres -c 'DROP FUNCTION pgpool_switch_xlog (text, text);' &> /dev/null
|
||||
psql -U postgres postgres -c 'DROP FUNCTION pgpool_regclass (text, text);' &> /dev/null
|
||||
psql -U postgres postgres -c 'DROP TABLE public.pgpool_lock_table;' &> /dev/null
|
||||
|
||||
dropdb -U ${PGDBUSER} ${PGDBNAME}
|
||||
dropuser -U postgres ${PGDBUSER}
|
||||
}
|
||||
|
||||
start(){
|
||||
service postgresql status &> /dev/null && init
|
||||
gprintf "Starting %s service: " "${NAME}"
|
||||
daemon --check ${PGPOOLDAEMON} --pidfile ${PID_FILE} --user postgres "${PGPOOLDAEMON} -f ${PGPOOLCONF} -l ${LOG_FILE} ${CLEAR_CACHE} ${PGPOOLOPTS}"
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop(){
|
||||
gprintf "Shutting down %s service: " "${NAME}"
|
||||
daemon --user postgres "${PGPOOLDAEMON} -m ${STOP_MODE} stop 2> /dev/null"
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
reload(){
|
||||
gprintf "Reloading %s: " "${NAME}"
|
||||
rh_status_q
|
||||
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
$PGPOOLDAEMON reload
|
||||
RETVAL=$?
|
||||
else
|
||||
rh_status
|
||||
fi
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
success
|
||||
else
|
||||
failure
|
||||
fi
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
status -p $PID_FILE $PGPOOLDAEMON
|
||||
RETVAL=$?
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
extendedstatus() {
|
||||
rh_status || exit 0
|
||||
echo
|
||||
NODE_COUNT=$(pcp_node_count "${PCP_TIMEOUT}" "${PCP_HOSTNAME}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}")
|
||||
gprintf "Total node count:\t %s\n" $NODE_COUNT
|
||||
echo
|
||||
gprintf "Host\t\t\t\t Status\t Load Balance Weight\n"
|
||||
for i in $(seq 0 $(($NODE_COUNT-1))); do
|
||||
NODES_INFO=$(pcp_node_info "${PCP_TIMEOUT}" "${PCP_HOSTNAME}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}" $i)
|
||||
[ "${NODES_INFO:0:1}" = " " ] && SOCKET="unix-socket"
|
||||
gprintf "%s:%s\t\t %s\t %s\n" $SOCKET $NODES_INFO
|
||||
unset SOCKET
|
||||
done
|
||||
echo
|
||||
gprintf "Active child process states:\n"
|
||||
gprintf "PID\t Database\t User\t Started\t Created\t Version\t Connection-reuse counter\n"
|
||||
IDLE_PROCS=""
|
||||
for i in $(pcp_proc_count "${PCP_TIMEOUT}" "${PCP_HOSTNAME}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}"); do
|
||||
PROC_INFO=$(pcp_proc_info "${PCP_TIMEOUT}" "${PCP_HOSTNAME}" "${PCP_PORT}" "${PCP_USER}" "${PCP_PASS}" "$i")
|
||||
if [ "$(echo $PROC_INFO |wc -c)" -eq 1 ]; then
|
||||
IDLE_PROCS="${IDLE_PROCS}$i "
|
||||
else
|
||||
gprintf "%s:\t %s\t\t %s\t %s\t %s\t %s.%s\t\t %s\n" $i $PROC_INFO
|
||||
fi
|
||||
done
|
||||
echo
|
||||
gprintf "Idle child processes:\n%s\n" "$IDLE_PROCS"
|
||||
echo
|
||||
rh_status_q
|
||||
}
|
||||
|
||||
ACTION="$1"
|
||||
|
||||
while [ "$#" -ne 0 ]; do
|
||||
shift
|
||||
case "$1" in
|
||||
clear|clear-cache)
|
||||
CLEAR_CACHE="-c"
|
||||
;;
|
||||
smart|fast|immediate)
|
||||
STOP_MODE="$1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# See how we were called.
|
||||
case "$ACTION" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
extendedstatus)
|
||||
extendedstatus
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
reload|force-reload)
|
||||
reload
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
stop
|
||||
start
|
||||
;;
|
||||
condstop)
|
||||
rh_status_q || exit 0
|
||||
stop
|
||||
;;
|
||||
init)
|
||||
init
|
||||
;;
|
||||
uninstall)
|
||||
uninstall
|
||||
;;
|
||||
*)
|
||||
gprintf "Usage: %s {start|status|extendedstatus|restart|condrestart|condstop|reload|force-reload}\n" $0
|
||||
gprintf "Stop: %s {stop|restart|condrestart|condstop} [smart|fast|immediate]\n" $0
|
||||
gprintf "Start: %s {start|restart|condrestart} [clear-cache]\n" $0
|
||||
RETVAL=2
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
23
pgpool.sysconfig
Normal file
23
pgpool.sysconfig
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Options for pgpool
|
||||
|
||||
# Some described here:
|
||||
# -d: debug mode. lots of debug information will be printed
|
||||
# -n: Don't run in daemon mode, run in foreground
|
||||
# Refer to 'pgpool --help' & pgpool(8) for full list of options and descriptions
|
||||
|
||||
#PGPOOLOPTS="-d"
|
||||
|
||||
# Use alternate configuration file
|
||||
#PGPOOLCONF="/etc/pgpool-II/pgpool.conf.master-slave"
|
||||
#PGPOOLCONF="/etc/pgpool-II/pgpool.conf.replication"
|
||||
#PGPOOLCONF="/etc/pgpool-II/pgpool.conf.mirroring"
|
||||
|
||||
# These are only used with the 'extendedstatus' action, but for the pcp_*
|
||||
# tools to work, you need to provide a proper password, since it doesn't seem
|
||||
# to use HBA settings for authentication...
|
||||
#PCP_PORT=9898
|
||||
#PCP_USER=pgpool
|
||||
#PCP_PASS=recovery
|
||||
#PCP_TIMEOUT=10
|
||||
#PCP_HOSTNAME='' # local unix sockets
|
||||
|
461
postgresql-pgpool-II.spec
Normal file
461
postgresql-pgpool-II.spec
Normal file
|
@ -0,0 +1,461 @@
|
|||
%define short_name pgpool-II
|
||||
%define major 0
|
||||
%define libname %mklibname pcp %{major}
|
||||
%define devname %mklibname pcp -d
|
||||
|
||||
Summary: Pgpool is a connection pooling/replication server for PostgreSQL
|
||||
Name: postgresql-%{short_name}
|
||||
Version: 3.0
|
||||
Release: %mkrel 1
|
||||
License: BSD
|
||||
Group: Databases
|
||||
URL: http://pgpool.projects.PostgreSQL.org
|
||||
Source0: http://pgfoundry.org/frs/download.php/2506/%{short_name}-%{version}.tar.gz
|
||||
Source1: pgpool.init
|
||||
Source2: pgpool.sysconfig
|
||||
Source3: pgpool.conf.mirroring
|
||||
Source4: pgpool-copy-base-backup
|
||||
Source5: pgpool-archive_command
|
||||
Source6: pgpool-mirroring_failback
|
||||
# (proyvind): These are all patches of mine, briefly described in changelog for
|
||||
# 2.3.3-1, eventually they should preferably make their way in some
|
||||
# form or another when I, or someone else who feels like it gets
|
||||
# around to it.. ;)
|
||||
Patch1: pgpool-II-3.0-pgpool.conf-mdkconf.patch
|
||||
Patch2: pgpool-II-3.0-logfile.patch
|
||||
# there's a slight/minimal chance for a race condition through use of waitpid(2),
|
||||
# TODO:
|
||||
# <jbj> the easiest fix is to create a pipe to serialize the operation of parent <-> child
|
||||
# <jbj> whoever runs 1st closes the pipe fd, whoever runs last blocks on the read and the close causes a 0b read (aka EOF)
|
||||
# <jbj> ... usleep is just a bandaid because you don't know who long to wait. using pipe(2) to strictly force the parent <-> child ordering is the better fix.
|
||||
# <jbj> but the usleep will "work" almost always.
|
||||
Patch3: pgpool-II-3.0-verify-child-pid-survival.patch
|
||||
Patch4: pgpool-II-2.3.3-support-libsetproctitle.patch
|
||||
Patch5: pgpool-II-3.0-recovery-script-customizations.patch
|
||||
Patch6: pgpool-II-3.0-custom-unix-socket-dir.patch
|
||||
Patch7: pgpool-II-3.0-fix-segfault-of-child-on-syntax-error-ext_query_prot.patch
|
||||
Patch8: pgpool-II-3.0-fix-md5-auth-bug.patch
|
||||
Patch9: pgpool-II-3.0-add-md5-username-option.patch
|
||||
Requires(post,preun): rpm-helper
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||
BuildRequires: postgresql-devel pam-devel openssl-devel
|
||||
BuildRequires: setproctitle-devel
|
||||
Suggests: postgresql-server postgresql-contrib-virtual
|
||||
Provides: %{short_name} = %{version}-%{release}
|
||||
# This only being unversioned obsoletes only is fully intended as it's
|
||||
# not meant to be an automatic, unvoluntarily upgrade of pgpool, but
|
||||
# meant to replace it if user explicitly chooses to install the package
|
||||
# it self.. So matching provides are excluded with intent as well.
|
||||
Obsoletes: pgpool
|
||||
|
||||
%description
|
||||
pgpool-II is a inherited project of pgpool (to classify from
|
||||
pgpool-II, it is sometimes called as pgpool-I). For those of
|
||||
you not familiar with pgpool-I, it is a multi-functional
|
||||
middle ware for PostgreSQL that features connection pooling,
|
||||
replication and load balancing functions. pgpool-I allows a
|
||||
user to connect at most two PostgreSQL servers for higher
|
||||
availability or for higher search performance compared to a
|
||||
single PostgreSQL server.
|
||||
|
||||
pgpool-II, on the other hand, allows multiple PostgreSQL
|
||||
servers (DB nodes) to be connected, which enables queries
|
||||
to be executed simultaneously on all servers. In other words,
|
||||
it enables "parallel query" processing. Also, pgpool-II can
|
||||
be started as pgpool-I by changing configuration parameters.
|
||||
pgpool-II that is executed in pgpool-I mode enables multiple
|
||||
DB nodes to be connected, which was not possible in pgpool-I.
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: Library for pgpool-II
|
||||
Group: System/Libraries
|
||||
|
||||
%description -n %{libname}
|
||||
Library for pgpool-II.
|
||||
|
||||
%package -n %{devname}
|
||||
Summary: Development headers for pgpool-II
|
||||
Group: Development/C
|
||||
Provides: %{name}-devel = %{version}-%{release}
|
||||
Requires: %{libname} = %{version}-%{release}
|
||||
|
||||
%description -n %{devname}
|
||||
Development headers and libraries for pgpool-II.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{short_name}-%{version}
|
||||
iconv -f iso-8859-1 -t utf-8 TODO -o TODO
|
||||
%patch1 -p1 -b .mdkconf~
|
||||
%patch2 -p1 -b .stdout_log~
|
||||
%patch3 -p1 -b .verify_child_pid~
|
||||
%patch4 -p1 -b .setproctitle~
|
||||
%patch5 -p1 -b .recovery~
|
||||
%patch6 -p1 -b .socketdir~
|
||||
%patch7 -p1 -b .syntax_err_segfault~
|
||||
%patch8 -p1 -b .md5_auth_bug~
|
||||
%patch9 -p1 -b .md5_user_option~
|
||||
autoreconf -fi
|
||||
cp %{SOURCE4} sample/copy-base-backup
|
||||
cp %{SOURCE5} sample/archive_command
|
||||
cp %{SOURCE6} sample/mirroring_failback
|
||||
|
||||
%build
|
||||
%configure2_5x --with-pgsql-includedir=%{_includedir}/pgsql \
|
||||
--with-pgsql-libdir=%{_libdir}/pgsql \
|
||||
--disable-static \
|
||||
--with-pam \
|
||||
--with-openssl \
|
||||
--disable-rpath \
|
||||
--sysconfdir=%{_sysconfdir}/%{short_name}
|
||||
|
||||
%make
|
||||
%make -C sql/pgpool-recovery
|
||||
%make -C sql/pgpool-regclass
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
%makeinstall_std
|
||||
%makeinstall_std -C sql/pgpool-recovery
|
||||
%makeinstall_std -C sql/pgpool-regclass
|
||||
|
||||
install -d %{buildroot}%{_localstatedir}/run/{pgpool,postgresql}
|
||||
|
||||
install -d %{buildroot}%{_sysconfdir}/logrotate.d
|
||||
tee %{buildroot}/%{_sysconfdir}/logrotate.d/pgpool <<EOH
|
||||
/var/log/postgres/pgpool {
|
||||
notifempty
|
||||
missingok
|
||||
copytruncate
|
||||
}
|
||||
EOH
|
||||
|
||||
for i in %{buildroot}/%{_sysconfdir}/%{short_name}/*sample*
|
||||
do mv $i `echo $i |sed -e 's#sample-##g' -e 's#\.sample##g'`
|
||||
done
|
||||
install -m644 %{SOURCE3} -D %{buildroot}%{_sysconfdir}/%{short_name}/pgpool.conf.mirroring
|
||||
install -m755 %{SOURCE1} -D %{buildroot}%{_initrddir}/pgpool
|
||||
install -m640 %{SOURCE2} -D %{buildroot}%{_sysconfdir}/sysconfig/pgpool
|
||||
sed -e 's#/usr/local#/usr#g' -i sample/*
|
||||
install -m644 sample/dist_def_pgbench.sql %{buildroot}%{_datadir}/%{short_name}
|
||||
install -m644 sample/replicate_def_pgbench.sql %{buildroot}%{_datadir}/%{short_name}
|
||||
|
||||
for i in archive_command copy-base-backup mirroring_failback pgpool_recovery pgpool_recovery_pitr pgpool_remote_start; do
|
||||
install -m755 sample/$i %{buildroot}%{_datadir}/%{short_name}/$i
|
||||
done
|
||||
|
||||
touch %{buildroot}%{_sysconfdir}/%{short_name}/pool_passwd
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%posttrans
|
||||
%create_ghostfile %{_sysconfdir}/%{short_name}/pool_passwd postgres postgres 644
|
||||
%_post_service pgpool
|
||||
|
||||
%preun
|
||||
%_preun_service pgpool
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc README TODO COPYING AUTHORS ChangeLog NEWS
|
||||
%doc doc/pgpool-en.html doc/pgpool.css doc/tutorial-en.html
|
||||
%lang(ja) %doc README.euc_jp doc/pgpool-ja.html doc/tutorial-ja.html
|
||||
%{_bindir}/pgpool
|
||||
%{_bindir}/pcp_attach_node
|
||||
%{_bindir}/pcp_detach_node
|
||||
%{_bindir}/pcp_node_count
|
||||
%{_bindir}/pcp_node_info
|
||||
%{_bindir}/pcp_proc_count
|
||||
%{_bindir}/pcp_proc_info
|
||||
%{_bindir}/pcp_recovery_node
|
||||
%{_bindir}/pcp_stop_pgpool
|
||||
%{_bindir}/pcp_systemdb_info
|
||||
%{_bindir}/pg_md5
|
||||
%{_mandir}/man8/pgpool.8*
|
||||
%dir %{_datadir}/%{short_name}
|
||||
%{_datadir}/%{short_name}/archive_command
|
||||
%{_datadir}/%{short_name}/copy-base-backup
|
||||
%{_datadir}/%{short_name}/mirroring_failback
|
||||
%{_datadir}/%{short_name}/system_db.sql
|
||||
%{_datadir}/%{short_name}/pgpool.pam
|
||||
%{_datadir}/%{short_name}/pgpool_recovery_pitr
|
||||
%{_datadir}/%{short_name}/dist_def_pgbench.sql
|
||||
%{_datadir}/%{short_name}/pgpool_recovery
|
||||
%{_datadir}/%{short_name}/pgpool_remote_start
|
||||
%{_datadir}/%{short_name}/replicate_def_pgbench.sql
|
||||
%{_datadir}/postgresql/contrib/pgpool-recovery.sql
|
||||
%{_datadir}/postgresql/contrib/pgpool-regclass.sql
|
||||
%{_initrddir}/pgpool
|
||||
%{_libdir}/postgresql/pgpool-recovery.so
|
||||
%{_libdir}/postgresql/pgpool-regclass.so
|
||||
%attr(700,postgres,postgres) %dir %{_localstatedir}/run/pgpool
|
||||
%attr(775,postgres,postgres) %dir %{_localstatedir}/run/postgresql
|
||||
%dir %{_sysconfdir}/%{short_name}
|
||||
%config(noreplace) %{_sysconfdir}/%{short_name}/*.conf*
|
||||
%ghost %attr(644,postgres,postgres) %{_sysconfdir}/%{short_name}/pool_passwd
|
||||
%attr(640,root,postgres) %config(noreplace) %{_sysconfdir}/sysconfig/pgpool
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/pgpool
|
||||
|
||||
%files -n %{libname}
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libpcp.so.%{major}*
|
||||
|
||||
%files -n %{devname}
|
||||
%defattr(-,root,root)
|
||||
%{_includedir}/pcp.h
|
||||
%{_includedir}/pool_type.h
|
||||
%{_libdir}/libpcp.so
|
||||
%{_libdir}/libpcp.la
|
||||
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Oct 06 2010 Per Øyvind Karlsen <peroyvind@mandriva.org> 3.0-1mdv2011.0
|
||||
+ Revision: 583659
|
||||
- Add a new option for md5 authentication: -U, --username=NAME (P9, from upstream)
|
||||
- Fix bug with md5 auth. If there's more than 1 servers to be authenticated, it
|
||||
segfaults (P8, from upstream)
|
||||
- Fix a bug that causes segfault of a child process when syntax error occurred in
|
||||
extended query protocol. (P7, from upstream)
|
||||
- fix 'rh_status_q()' to properly return the right return code on MES 5
|
||||
- switch back to using '/tmp' for sockets dir again now that postgresql init
|
||||
script won't wipe it out anymore..
|
||||
- add crude failback script for mirroring setup...
|
||||
- quote all pcp_* arguments in initscript
|
||||
- change attributes for sysconfig file to make it only readable by postgres group
|
||||
- make recovery script more robust..
|
||||
- actually use PGPOOLCONF variable and add it to sysconfig file
|
||||
- clean up variable setting and loading from sysconfig files a bit further
|
||||
- pass log file as argument rather than as a setting in configuration file
|
||||
- load sysconfig file after variables have been set so it's settings may override
|
||||
- check status of postgresql using it's init script which now has been fixed
|
||||
- fix 'immediate' stop mode
|
||||
- disable query_cache in mirroring config, otherwise pgpool will fail if systemdb
|
||||
is down
|
||||
- fix status() usage to work with both current cooker & MES 5 in init script
|
||||
- prettify stop() in init script
|
||||
- don't depend on postgresql, make it optional...
|
||||
- fix recovery scripts, sorta..
|
||||
- new release: 3.0
|
||||
- change unix domain socket path to /var/run/postgresql (P6)
|
||||
- fix broken copy-base-backup script
|
||||
- fix a type in init script
|
||||
- don't own files within postgresql installation
|
||||
- prettify output of 'extendedstatus' a bit
|
||||
- print 'unix-socket' in place of missing host in list of nodes to get same
|
||||
number of arguments for 'extendedstatus' to display them correctly
|
||||
- disable replicate_select & ssl by default for mirroring setup
|
||||
- make it possible to override options passed to pcp_* tools in extendedstatus()
|
||||
* don't try to printing out an extendedstatus if pgool isn't running
|
||||
- make 'fast' default stop mode
|
||||
- ensure postgres being owner of recovery script symlinks
|
||||
- create symlinks to recovery scripts during init, otherwise postgres directory
|
||||
might get populated before postgresql 'initdb' gets too, making it fail...
|
||||
- fix weight of mirror
|
||||
- fix broken symlinks and location for recovery scripts..
|
||||
- update logging patch to patch pool_config.l as well
|
||||
- install all the files required for recovery in the same, appropriate way
|
||||
- fix script breakage due to missing variables..
|
||||
- make log output filename consistent with postgresql and match logrotate config
|
||||
- adjust our recovery scripts for our use and for recovery by PITR
|
||||
- fix initialization order so that we get things into template1 before using it
|
||||
- work around messy issue with initscripts in MES 5.1 not handling status() properly..
|
||||
- be more explicit about paths to ensure 'copy-base-backup' doesn't get lost...
|
||||
- only listen on localhost by default for mirroring config
|
||||
- fix paths to rescue scripts..
|
||||
- make sure to create functions etc. in the right tables..
|
||||
- enable lobj_lock_table by creating a locking table in template1
|
||||
- fix installation of recovery functions
|
||||
- don't hardcode to use unix sockets for host connecting to..
|
||||
- print list of pids for idle processes separately, all at once
|
||||
- start on an extendedstatus() action
|
||||
- add recovery scripts of ours to mirroring config
|
||||
- don't pollute output with redundant messages about terminating in init script
|
||||
- fix ghost file creation
|
||||
- pass pgpool options as arguments in stead for greater flexibility
|
||||
- install various sample recovery scripts etc. and one of our own
|
||||
- add options for fast and immediate stop as well in initscript.. (would they
|
||||
serve better as arguments, and be easier reusable for restart etc. as well..?)
|
||||
- update init script to initialize necessary databases, functions etc.
|
||||
- add support for setproctitle() through libsetproctitle()
|
||||
- build and install pgpool-recovery as well
|
||||
- fix incorrect argument for pgsql libdir passed to configure
|
||||
- set socket path always to /tmp to ensure compatibility with posgresql, although
|
||||
postgresql should really be confined to use /var/run/postgresql itself in the
|
||||
future..
|
||||
- use autoreconf in stead of libtoolize for build to work on MES 5.1
|
||||
- switch to snapshot tarball generated from V2_3_STABLE branch
|
||||
- backport a fix making ssl connections hang
|
||||
- add another configuration file for mirroring purposes
|
||||
- add a provides for pgpool-II
|
||||
- add dependency on postgresql-contrib, as we need dblink from it
|
||||
|
||||
* Mon Jul 12 2010 Per Øyvind Karlsen <peroyvind@mandriva.org> 2.3.3-1mdv2011.0
|
||||
+ Revision: 551253
|
||||
- convert TODO file into UTF-8
|
||||
- fix group of devel package
|
||||
- add a note regarding obsoletes
|
||||
- use %%posttrans rather than %%post
|
||||
- add missing 'Requires(post,preun): rpm-helper'
|
||||
- fix incorrect group
|
||||
- fix mixed-use-of-spaces-and-tabs
|
||||
- add some more content to sysconfig file
|
||||
- add logrotate
|
||||
- set daemon output loggin through configuration rather by an argument
|
||||
- fix proper regexp for configuration files to get proper naming..
|
||||
- add dependency on postgresql-server
|
||||
- import postgresql-pgpool-II
|
||||
|
||||
|
||||
* Tue Jun 29 2010 Per Øyvind Karlsen <peroyvind@mandriva.org> 2.3.3-1
|
||||
- Update to 2.3.3
|
||||
- verify that child process forked actually survives and return the dead
|
||||
child process' exit code in stead of default success code if it happens to
|
||||
die (P2)
|
||||
- add support for logging directly to file when running as daemon, so one
|
||||
doesn't have to mess with job control, output redirection etc. (P1)
|
||||
- fix string format warnings (P0)
|
||||
- enable openssl support
|
||||
- rewrite init script
|
||||
- adapt to Mandriva Linux
|
||||
|
||||
* Fri Dec 25 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.3.1-1
|
||||
- Update to 2.3.1
|
||||
- Adjust order of startup and kill, per RH bugzilla #545739.
|
||||
|
||||
* Tue Dec 1 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.2.6-1
|
||||
- Update to 2.2.6
|
||||
|
||||
* Sun Nov 01 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.2.5-2
|
||||
- Remove init script from all runlevels before uninstall. Per RH Bugzilla
|
||||
#532177
|
||||
|
||||
* Sun Oct 4 2009 Devrim Gunduz <devrim@CommandPrompt.com> 2.2.5-1
|
||||
- Update to 2.2.5, for various fixes described at
|
||||
http://lists.pgfoundry.org/pipermail/pgpool-general/2009-October/002188.html
|
||||
|
||||
* Sat Oct 3 2009 Devrim Gunduz <devrim@CommandPrompt.com> 2.2.4-1
|
||||
- Update to 2.2.4
|
||||
- Re-apply a fix for #442372
|
||||
|
||||
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Thu May 7 2009 Devrim Gunduz <devrim@CommandPrompt.com> 2.2.2-1
|
||||
- Update to 2.2.2
|
||||
|
||||
* Mon Mar 23 2009 Devrim Gunduz <devrim@CommandPrompt.com> 2.2-1.1
|
||||
- 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.
|
||||
|
||||
* Sun Mar 1 2009 Devrim Gunduz <devrim@CommandPrompt.com> 2.2-1
|
||||
- Update to 2.2
|
||||
- Update URL
|
||||
|
||||
* 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
|
||||
|
||||
* Thu Dec 4 2008 Michael Schwendt <mschwendt@fedoraproject.org> 2.1-2
|
||||
- Include /usr/share/pgpool-II directory.
|
||||
|
||||
* Tue Aug 12 2008 Devrim Gunduz <devrim@CommandPrompt.com> 2.1-1
|
||||
- Update to 2.1 Gold
|
||||
- Set group of sample config files to root, not apache. Fixes RH #442372.
|
||||
- Update patch #1: Fix build failure caused by new default patch
|
||||
fuzz = 0 policy in rawhide
|
||||
|
||||
* Fri Apr 11 2008 Devrim Gunduz <devrim@CommandPrompt.com> 2.1-0.2.beta2
|
||||
- Fix Requires: issue, per #442021 (Alex Lancaster)
|
||||
|
||||
* Sun Apr 6 2008 Devrim Gunduz <devrim@CommandPrompt.com> 2.1-beta2
|
||||
- Update to 2.1 beta2
|
||||
|
||||
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.0.1-3.1
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Mon Jan 21 2008 Devrim GUNDUZ <devrim@commandprompt.com> 2.0.1-2.1
|
||||
- Rebuilt against PostgreSQL 8.3
|
||||
|
||||
* Sat Jan 19 2008 Devrim Gunduz <devrim@CommandPrompt.com> 2.0.1-2
|
||||
- Fix Requires of -devel package, per bz#429436
|
||||
|
||||
* Sun Jan 13 2008 Devrim Gunduz <devrim@CommandPrompt.com> 2.0.1-1
|
||||
- Update to 2.0.1
|
||||
- Add a temp patch that will disappear in 2.0.2
|
||||
|
||||
* Tue Oct 23 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.3-1
|
||||
- Update to 1.3
|
||||
|
||||
* Fri Oct 5 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.2.1-1
|
||||
- Update to 1.2.1
|
||||
|
||||
* Wed Aug 29 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.2-5
|
||||
- Chmod sysconfig/pgpool to 644, not 755. Per BZ review.
|
||||
- Run chkconfig --add pgpool during %%post.
|
||||
|
||||
* Thu Aug 16 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.2-4
|
||||
- Fixed the directory name where sample conf files and sql files
|
||||
are installed.
|
||||
|
||||
* Sun Aug 5 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.2-3
|
||||
- Added a patch for sample conf file to use Fedora defaults
|
||||
|
||||
* Sun Aug 5 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.2-2
|
||||
- Added an init script for pgpool
|
||||
- Added /etc/sysconfig/pgpool
|
||||
|
||||
* Wed Aug 1 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.2-1
|
||||
- Update to 1.2
|
||||
|
||||
* Fri Jun 15 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.1.1-1
|
||||
- Update to 1.1.1
|
||||
|
||||
* Sat Jun 2 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.1-1
|
||||
- Update to 1.1
|
||||
- added --disable-rpath configure parameter.
|
||||
- Chowned sample conf files, so that they can work with pgpoolAdmin.
|
||||
|
||||
* Thu Apr 22 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.0.2-4
|
||||
- Added postgresql-devel as BR, per bugzilla review.
|
||||
- Added --disable-static flan, per bugzilla review.
|
||||
- Removed superfluous manual file installs, per bugzilla review.
|
||||
|
||||
* Thu Apr 22 2007 Devrim Gunduz <devrim@CommandPrompt.com> 1.0.2-3
|
||||
- Rebuilt for the correct tarball
|
||||
- Fixed man8 file ownership, per bugzilla review #229321
|
||||
|
||||
* Tue Feb 20 2007 Jarod Wilson <jwilson@redhat.com> 1.0.2-2
|
||||
- Create proper devel package, drop -libs package
|
||||
- Nuke rpath
|
||||
- Don't install libtool archive and static lib
|
||||
- Clean up %%configure line
|
||||
- Use proper %%_smp_mflags
|
||||
- Install config files properly, without .sample on the end
|
||||
- Preserve timestamps on header files
|
||||
|
||||
* Tue Feb 20 2007 Devrim Gunduz <devrim@commandprompt.com> 1.0.2-1
|
||||
- Update to 1.0.2-1
|
||||
|
||||
* Mon Oct 02 2006 Devrim Gunduz <devrim@commandprompt.com> 1.0.1-5
|
||||
- Rebuilt
|
||||
|
||||
* Mon Oct 02 2006 Devrim Gunduz <devrim@commandprompt.com> 1.0.1-4
|
||||
- Added -libs and RPM
|
||||
- Fix .so link problem
|
||||
- Cosmetic changes to spec file
|
||||
|
||||
* Thu Sep 27 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 1.0.1-3
|
||||
- Fix spec, per Yoshiyuki Asaba
|
||||
|
||||
* Thu Sep 26 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 1.0.1-2
|
||||
- Fixed rpmlint errors
|
||||
- Fixed download url
|
||||
- Added ldconfig for .so files
|
||||
|
||||
* Thu Sep 21 2006 - David Fetter <david@fetter.org> 1.0.1-1
|
||||
- Initial build pgpool-II 1.0.1 for PgPool Global Development Group
|
||||
|
Loading…
Add table
Reference in a new issue