diff options
author | kuriyama <kuriyama@FreeBSD.org> | 2004-01-26 09:02:45 +0000 |
---|---|---|
committer | kuriyama <kuriyama@FreeBSD.org> | 2004-01-26 09:02:45 +0000 |
commit | 94a2a10d716832369f604cd823c86aca39a6e407 (patch) | |
tree | fd2c744a04d41b08b663c93d3e6f175fa72433a8 | |
parent | d7fad7c89acaedd38ea1d602bdc8e8667d615492 (diff) | |
download | FreeBSD-ports-94a2a10d716832369f604cd823c86aca39a6e407.zip FreeBSD-ports-94a2a10d716832369f604cd823c86aca39a6e407.tar.gz |
Add pgcluster 1.0.6b, the multi-master and synchronous replication
system for PostgreSQL.
-rw-r--r-- | databases/Makefile | 1 | ||||
-rw-r--r-- | databases/pgcluster/Makefile | 103 | ||||
-rw-r--r-- | databases/pgcluster/distinfo | 2 | ||||
-rw-r--r-- | databases/pgcluster/files/patch-pool_process_query.c | 15 | ||||
-rw-r--r-- | databases/pgcluster/files/pgcluster.sh.tmpl | 56 | ||||
-rw-r--r-- | databases/pgcluster/files/pglb.sh.tmpl | 35 | ||||
-rw-r--r-- | databases/pgcluster/files/pgreplicate.sh.tmpl | 37 | ||||
-rw-r--r-- | databases/pgcluster/files/setup-sshkey.pl | 24 | ||||
-rw-r--r-- | databases/pgcluster/pkg-descr | 4 | ||||
-rw-r--r-- | databases/pgcluster/pkg-install | 65 | ||||
-rw-r--r-- | databases/pgcluster/pkg-plist | 95 |
11 files changed, 437 insertions, 0 deletions
diff --git a/databases/Makefile b/databases/Makefile index 025a34c..f492f8d 100644 --- a/databases/Makefile +++ b/databases/Makefile @@ -174,6 +174,7 @@ SUBDIR += pgaccess SUBDIR += pgadmin3 SUBDIR += pgbash + SUBDIR += pgcluster SUBDIR += php-sqlrelay SUBDIR += phpmyadmin SUBDIR += phppgadmin diff --git a/databases/pgcluster/Makefile b/databases/pgcluster/Makefile new file mode 100644 index 0000000..ae2cee4 --- /dev/null +++ b/databases/pgcluster/Makefile @@ -0,0 +1,103 @@ +# New ports collection makefile for: pgcluster +# Date created: 22 Jan 2004 +# Whom: Jun Kuriyama <kuriyama@FreeBSD.org> +# +# $FreeBSD$ + +PORTNAME= pgcluster +PORTVERSION= 1.0.6b +CATEGORIES= databases +MASTER_SITES= ${MASTER_SITE_PGSQL} +MASTER_SITE_SUBDIR= v${BASEPGSQL} +DISTNAME= postgresql-base-${BASEPGSQL} +DIST_SUBDIR= postgresql + +PATCH_SITES= http://hiroshima.sraw.co.jp/people/mitani/jpug/pgcluster/current/ +PATCHFILES= pgcluster-${PORTVERSION}-patch.tar.gz +PATCH_DIST_STRIP= -p1 + +MAINTAINER= kuriyama@FreeBSD.org +COMMENT=The multi-master and synchronous replication system for PostgreSQL + +RUN_DEPENDS= rsync:${PORTSDIR}/net/rsync + +WRKSRC?= ${WRKDIR}/postgresql-${BASEPGSQL} +USE_GMAKE= yes +GNU_CONFIGURE= yes +MAKE_FLAGS= # empty +MAKEFILE= # empty +CONFLICTS= postgresql-* +USE_RC_SUBR= yes +INSTALLS_SHLIB= yes + +BASEPGSQL= 7.3.4 +.if defined(WITHOUT_PGCLUSTER_REPLICATION) +PGRP= "@comment " +.endif +.if defined(WITHOUT_PGCLUSTER_LOADBALANCER) +PGLB= "@comment " +.endif +PLIST_SUB= PGRP=${PGRP} PGLB=${PGLB} +RCSUBR_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} +RCSUBR_SED= ${SED} ${RCSUBR_SUB:S|$|!g|:S|^| -e s!%%|:S|=|%%!|} + +MAN1= clusterdb.1 createdb.1 createlang.1 createuser.1 dropdb.1 droplang.1 \ + dropuser.1 ecpg.1 initdb.1 initlocation.1 ipcclean.1 \ + pg_config.1 pg_controldata.1 pg_ctl.1 pg_dump.1 pg_dumpall.1 \ + pg_resetxlog.1 pg_restore.1 pgtclsh.1 pgtksh.1 \ + postgres.1 postmaster.1 psql.1 vacuumdb.1 +MAN7= abort.7 alter_database.7 alter_group.7 alter_table.7 alter_trigger.7 \ + alter_user.7 analyze.7 begin.7 \ + checkpoint.7 close.7 cluster.7 comment.7 commit.7 copy.7 \ + create_aggregate.7 create_cast.7 create_constraint_trigger.7 \ + create_conversion.7 create_database.7 create_domain.7 \ + create_function.7 create_group.7 create_index.7 create_language.7 \ + create_operator.7 create_operator_class.7 create_rule.7 \ + create_schema.7 create_sequence.7 create_table.7 create_table_as.7 \ + create_trigger.7 create_type.7 create_user.7 create_view.7 \ + deallocate.7 declare.7 delete.7 drop_aggregate.7 drop_cast.7 \ + drop_conversion.7 drop_database.7 drop_domain.7 drop_function.7 \ + drop_group.7 drop_index.7 drop_language.7 drop_operator.7 \ + drop_operator_class.7 drop_rule.7 drop_schema.7 drop_sequence.7 \ + drop_table.7 drop_trigger.7 drop_type.7 drop_user.7 drop_view.7 \ + end.7 execute.7 explain.7 fetch.7 grant.7 insert.7 listen.7 load.7 \ + lock.7 move.7 notify.7 prepare.7 reindex.7 reset.7 revoke.7 \ + rollback.7 select.7 select_into.7 set.7 set_constraints.7 \ + set_session_authorization.7 set_transaction.7 show.7 \ + start_transaction.7 truncate.7 unlisten.7 update.7 vacuum.7 + +post-patch: + cd ${WRKSRC}/src/pgcluster/pgrp; ${CHMOD} +x configure missing + cd ${WRKSRC}/src/pgcluster/pglb; ${CHMOD} +x configure + +post-build: +.if !defined(WITHOUT_PGCLUSTER_REPLICATION) + ${MAKE} WRKSRC=${WRKSRC}/src/pgcluster/pgrp do-configure + ${MAKE} WRKSRC=${WRKSRC}/src/pgcluster/pgrp do-build +.endif +.if !defined(WITHOUT_PGCLUSTER_LOADBALANCER) + ${MAKE} WRKSRC=${WRKSRC}/src/pgcluster/pglb do-configure + ${MAKE} WRKSRC=${WRKSRC}/src/pgcluster/pglb do-build +.endif + +pre-install: + @${SETENV} PKG_PREFIX=${PREFIX} \ + ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL + +post-install: +.if !defined(WITHOUT_PGCLUSTER_REPLICATION) + ${MAKE} WRKSRC=${WRKSRC}/src/pgcluster/pgrp do-install + ${RCSUBR_SED} ${FILESDIR}/pgreplicate.sh.tmpl > \ + ${PREFIX}/etc/rc.d/pgreplicate.sh + ${CHMOD} +x ${PREFIX}/etc/rc.d/pgreplicate.sh +.endif +.if !defined(WITHOUT_PGCLUSTER_LOADBALANCER) + ${MAKE} WRKSRC=${WRKSRC}/src/pgcluster/pglb do-install + ${RCSUBR_SED} ${FILESDIR}/pglb.sh.tmpl > ${PREFIX}/etc/rc.d/pglb.sh + ${CHMOD} +x ${PREFIX}/etc/rc.d/pglb.sh +.endif + ${RCSUBR_SED} ${FILESDIR}/pgcluster.sh.tmpl > \ + ${PREFIX}/etc/rc.d/pgcluster.sh + ${CHMOD} +x ${PREFIX}/etc/rc.d/pgcluster.sh + +.include <bsd.port.mk> diff --git a/databases/pgcluster/distinfo b/databases/pgcluster/distinfo new file mode 100644 index 0000000..adfc52e --- /dev/null +++ b/databases/pgcluster/distinfo @@ -0,0 +1,2 @@ +MD5 (postgresql/postgresql-base-7.3.4.tar.gz) = 2b8600cc0f0c2d80271b533c394c886b +MD5 (postgresql/pgcluster-1.0.6b-patch.tar.gz) = 405ea2a5f61a05c31ef16e3791be3ec4 diff --git a/databases/pgcluster/files/patch-pool_process_query.c b/databases/pgcluster/files/patch-pool_process_query.c new file mode 100644 index 0000000..dbac865 --- /dev/null +++ b/databases/pgcluster/files/patch-pool_process_query.c @@ -0,0 +1,15 @@ +--- src/pgcluster/pglb/pool_process_query.c.orig Sat Jan 24 14:14:51 2004 ++++ src/pgcluster/pglb/pool_process_query.c Sat Jan 24 14:15:00 2004 +@@ -728,10 +728,11 @@ + static POOL_STATUS EmptyQueryResponse(POOL_CONNECTION *frontend, + POOL_CONNECTION *backend) + { ++ char c; ++ + /* set function name */ + set_function("EmptyQueryResponse"); + +- char c; + if (pool_read(backend, &c, sizeof(c)) < 0) + return POOL_END; + diff --git a/databases/pgcluster/files/pgcluster.sh.tmpl b/databases/pgcluster/files/pgcluster.sh.tmpl new file mode 100644 index 0000000..d0b2db0 --- /dev/null +++ b/databases/pgcluster/files/pgcluster.sh.tmpl @@ -0,0 +1,56 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: pgcluster +# REQUIRE: DAEMON +# BEFORE: pgreplicate +# KEYWORD: FreeBSD +# +# Add the following line to /etc/rc.conf to enable pgcluster: +# +# pgcluster_enable="YES" +# # optional +# pgcluster_data="/home/pgsql/data" +# pgcluster_flags="-w -s" +# + +pgcluster_enable="NO" +pgcluster_data="%%PREFIX%%/pgsql/data" +pgcluster_flags="-w -s" + +. %%RC_SUBR%% + +load_rc_config pgcluster + +name=pgcluster +command=%%PREFIX%%/bin/pg_ctl +pgcluster_user=pgsql +extra_commands="initdb recover" +initdb_cmd="pgcluster_initdb" +recover_cmd="pgcluster_recover" +start_cmd="pgcluster_start" +stop_cmd="pgcluster_stop" + +pgcluster_flags="${pgcluster_flags} -D ${pgcluster_data}" +pidfile="${pgcluster_data}/postmaster.pid" + +pgcluster_start() +{ + su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o '-i'" +} +pgcluster_stop() +{ + su -m ${pgcluster_user} -c "exec ${command} stop ${pgcluster_flags} -m i" +} +pgcluster_recover() +{ + su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o '-i -R'" +} +pgcluster_initdb() +{ + su -m ${pgcluster_user} -c "exec %%PREFIX%%/bin/initdb -D ${pgcluster_data}" +} + +load_rc_config $name +run_rc_command "$1" diff --git a/databases/pgcluster/files/pglb.sh.tmpl b/databases/pgcluster/files/pglb.sh.tmpl new file mode 100644 index 0000000..f0d53ec --- /dev/null +++ b/databases/pgcluster/files/pglb.sh.tmpl @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: pglb +# REQUIRE: DAEMON +# KEYWORD: FreeBSD +# +# Add the following line to /etc/rc.conf to enable pglb: +# +# pglb_enable="YES" +# + +pglb_enable="NO" +pglb_data="%%PREFIX%%/pgsql/data" +pglb_flags="" + +. %%RC_SUBR%% + +load_rc_config pglb + +name=pglb +command=%%PREFIX%%/bin/pglb +pglb_user=pgsql +stop_cmd="pglb_stop" + +pglb_flags="${pglb_flags} -D ${pglb_data}" + +pglb_stop() +{ + su -m ${pglb_user} -c "exec ${command} -D ${pglb_data} stop" +} + +load_rc_config $name +run_rc_command "$1" diff --git a/databases/pgcluster/files/pgreplicate.sh.tmpl b/databases/pgcluster/files/pgreplicate.sh.tmpl new file mode 100644 index 0000000..fa392d8 --- /dev/null +++ b/databases/pgcluster/files/pgreplicate.sh.tmpl @@ -0,0 +1,37 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: pgreplicate +# REQUIRE: DAEMON +# BEFORE: pglb +# KEYWORD: FreeBSD +# +# Add the following line to /etc/rc.conf to enable pgreplicate: +# +# pgreplicate_enable="YES" +# + +pgreplicate_enable="NO" +pgreplicate_data="%%PREFIX%%/pgsql/data" +pgreplicate_flags="" + +. %%RC_SUBR%% + +load_rc_config pgreplicate + +name=pgreplicate +command=%%PREFIX%%/bin/pgreplicate +pgreplicate_user=pgsql +stop_cmd="pgreplicate_stop" + +pgreplicate_flags="${pgreplicate_flags} -D ${pgreplicate_data}" +pidfile="${pgreplicate_data}/pgreplicate.pid" + +pgreplicate_stop() +{ + su -m ${pgreplicate_user} -c "exec ${command} -D ${pgreplicate_data} stop" +} + +load_rc_config $name +run_rc_command "$1" diff --git a/databases/pgcluster/files/setup-sshkey.pl b/databases/pgcluster/files/setup-sshkey.pl new file mode 100644 index 0000000..11c3a03 --- /dev/null +++ b/databases/pgcluster/files/setup-sshkey.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl -w +# +# $FreeBSD$ + +use strict; + +my $base = "$ENV{HOME}/.ssh"; +foreach (@ARGV) { + my $dir = "$base/$_"; + system("mkdir -p $dir") == 0 or die; + if (not -r "$dir/id_dsa.pub") { + system("ssh-keygen -t dsa -N '' -C $ENV{USER}\@$_ -f $dir/id_dsa") == 0 + or die + } + system("ssh-keyscan -t dsa $_ >> $base/known_hosts") == 0 or die; + system("sort $base/known_hosts | uniq > $base/tmp.$$") == 0 or die; + system("mv $base/tmp.$$ $base/known_hosts") == 0 or die; +} +foreach (@ARGV) { + my $dir = "$base/$_"; + system("cat $base/*/id_dsa.pub > $dir/authorized_keys") == 0 or die; + system("cp $base/known_hosts $dir/known_hosts") == 0 or die; +} + diff --git a/databases/pgcluster/pkg-descr b/databases/pgcluster/pkg-descr new file mode 100644 index 0000000..2eb6180 --- /dev/null +++ b/databases/pgcluster/pkg-descr @@ -0,0 +1,4 @@ +PGCluster is a multi-master and synchronous replication system that +supports load balancing of PostgreSQL. + +WWW: http://www.csra.co.jp/~mitani/jpug/pgcluster/ diff --git a/databases/pgcluster/pkg-install b/databases/pgcluster/pkg-install new file mode 100644 index 0000000..e2cf878 --- /dev/null +++ b/databases/pgcluster/pkg-install @@ -0,0 +1,65 @@ +#! /bin/sh + +# Original: FreeBSD: ports/databases/postgresql7/pkg-install,v 1.8 2003/12/04 12:00:48 seanc Exp + +PATH=/bin:/usr/sbin + +DB_DIR=${PKG_PREFIX}/pgsql + +backupwarning() { + echo " + =========== BACKUP YOUR DATA! ============= + As always, backup your data before + upgrading. If the upgrade leads to a higher + minor revision (e.g. 7.3.x -> 7.4), a dump + and restore of all databases is + required. This is *NOT* done by the port! + + Press ctrl-C *now* if you need to pg_dump. + =========================================== +" + sleep 5 +} + +case $2 in +PRE-INSTALL) +# backupwarning + USER=pgsql + GROUP=${USER} + UID=70 + GID=${UID} + + if pw group show "${GROUP}" 2>/dev/null; then + echo "You already have a group \"${GROUP}\", so I will use it." + else + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${USER}" 2>/dev/null; then + echo "You already have a user \"${USER}\", so I will use it." + else + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -d ${DB_DIR} -c "PostgreSQL Daemon" + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi + fi + + if ! [ -x ~pgsql ] ; then + mkdir -p ${DB_DIR} + chown pgsql:pgsql ${DB_DIR} + fi + ;; + +BACKUPWARNING) +# backupwarning + ;; +esac diff --git a/databases/pgcluster/pkg-plist b/databases/pgcluster/pkg-plist new file mode 100644 index 0000000..ca1df40 --- /dev/null +++ b/databases/pgcluster/pkg-plist @@ -0,0 +1,95 @@ +bin/clusterdb +bin/createdb +bin/createlang +bin/createuser +bin/dropdb +bin/droplang +bin/dropuser +bin/ecpg +bin/initdb +bin/initlocation +bin/ipcclean +bin/pg_config +bin/pg_controldata +bin/pg_ctl +bin/pg_dump +bin/pg_dumpall +bin/pg_encoding +bin/pg_id +bin/pg_resetxlog +bin/pg_restore +%%PGLB%%bin/pglb +%%PGRP%%bin/pgreplicate +bin/postgres +bin/postmaster +bin/psql +bin/vacuumdb +%%PGLB%%etc/pglb.conf.sample +%%PGRP%%etc/pgreplicate.conf.sample +etc/rc.d/pgcluster.sh +%%PGLB%%etc/rc.d/pglb.sh +%%PGRP%%etc/rc.d/pgreplicate.sh +include/ecpgerrno.h +include/ecpglib.h +include/ecpgtype.h +include/libpq-fe.h +include/libpq/libpq-fs.h +include/pg_config.h +include/pg_config_os.h +include/postgres_ext.h +include/postgresql/internal/c.h +include/postgresql/internal/lib/dllist.h +include/postgresql/internal/libpq-int.h +include/postgresql/internal/libpq/pqcomm.h +include/postgresql/internal/postgres_fe.h +include/postgresql/internal/pqexpbuffer.h +include/sql3types.h +include/sqlca.h +lib/libecpg.a +lib/libecpg.so +lib/libecpg.so.3 +lib/libpq.a +lib/libpq.so +lib/libpq.so.3 +lib/postgresql/ascii_and_mic.so +lib/postgresql/cyrillic_and_mic.so +lib/postgresql/euc_cn_and_mic.so +lib/postgresql/euc_jp_and_sjis.so +lib/postgresql/euc_kr_and_mic.so +lib/postgresql/euc_tw_and_big5.so +lib/postgresql/latin2_and_win1250.so +lib/postgresql/latin_and_mic.so +lib/postgresql/plpgsql.so +lib/postgresql/utf8_and_ascii.so +lib/postgresql/utf8_and_big5.so +lib/postgresql/utf8_and_cyrillic.so +lib/postgresql/utf8_and_euc_cn.so +lib/postgresql/utf8_and_euc_jp.so +lib/postgresql/utf8_and_euc_kr.so +lib/postgresql/utf8_and_euc_tw.so +lib/postgresql/utf8_and_gb18030.so +lib/postgresql/utf8_and_gbk.so +lib/postgresql/utf8_and_iso8859.so +lib/postgresql/utf8_and_iso8859_1.so +lib/postgresql/utf8_and_johab.so +lib/postgresql/utf8_and_sjis.so +lib/postgresql/utf8_and_tcvn.so +lib/postgresql/utf8_and_uhc.so +lib/postgresql/utf8_and_win1250.so +lib/postgresql/utf8_and_win1256.so +lib/postgresql/utf8_and_win874.so +share/postgresql/cluster.conf.sample +share/postgresql/conversion_create.sql +share/postgresql/pg_hba.conf.sample +share/postgresql/pg_ident.conf.sample +share/postgresql/postgres.bki +share/postgresql/postgres.description +share/postgresql/postgresql.conf.sample +@dirrm include/libpq +@dirrm include/postgresql/internal/lib +@dirrm include/postgresql/internal/libpq +@dirrm include/postgresql/internal +@dirrm include/postgresql +@dirrm lib/postgresql +@dirrm share/postgresql +@unexec rmdir %D/pgsql 2>/dev/null || true |