Pgpool

== ==

#!/bin/bash

cd /
/bin/tar cvf 0etc.tar /etc
/bin/mv 0etc.tar /root

/bin/mkdir -p /root/old/etc/httpd/{conf,conf.d}
/bin/cp -R /etc/httpd /root/old/
/bin/rm -rf /etc/httpd
/bin/cp -R /var/www /root/old/
/bin/rm -rf /var/www
/bin/cp -R /etc/php* /root/old/etc/
/bin/rm -rf /etc/php*
/bin/cp -R /etc/proftp* /root/old/etc/
/bin/rm -rf /etc/proftp*

/bin/mkdir -p /root/old/etc/yum.repos.d
/bin/mv /etc/yum.conf /root/old/etc/yum.repos.d
/bin/mv /etc/yum.repos.d/CentOS-Base.repo /root/old/etc/yum.repos.d
/bin/mv /etc/yum.repos.d/CentOS-Media.repo /root/old/etc/yum.repos.d

/bin/cat > /etc/yum.conf «FINLI
[main]
cachedir=/var/cache/yum
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

installonly_limit = 5

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
#exclude=apache* httpd* mod_* mysql* MySQL* da_* *ftp* exim* sendmail* php* bind-chroot*
exclude=kernel*
FINLI

== ==
/bin/cat > /etc/yum.repos.d/0repo.repo «FINLI
[centos56]
name=Centos 5.6 repo
baseurl=http://ftp.belnet.be/pub/ftp.centos.org/5.6/os/x86_64/
#http://centos.ufms.br/5.6/os/x86_64/
enable=1
gpgcheck=0

[centos56plus]
name=Centos 5.6 Plus repo
baseurl=http://ftp.belnet.be/pub/ftp.centos.org/5.6/centosplus/x86_64/
enable=1
gpgcheck=0

[centos56extras]
name=Centos 5.6 Extras repo
baseurl=http://ftp.belnet.be/pub/ftp.centos.org/5.6/extras/x86_64/
enable=1
gpgcheck=0

[centos56fasttrack]
name=Centos 5.6 Fast Track repo
baseurl=http://ftp.belnet.be/pub/ftp.centos.org/5.6/fasttrack/x86_64/
enable=1
gpgcheck=0

[centos56updates]
name=Centos 5.6 Updates repo
baseurl=http://ftp.belnet.be/pub/ftp.centos.org/5.6/updates/x86_64/
enable=1
gpgcheck=0

[fedoraepel5]
name=Fedora EPEL 5
baseurl=http://download.fedora.redhat.com/pub/epel/5/x86_64/
enable=1
gpgcheck=0

[pg844]
name=PostgreSQL 8.4.4 RHEL 5
baseurl=http://yum.pgsqlrpms.org/8.4/redhat/rhel-5-x86_64/
enable=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[webtaticphp53]
name=Webtatic Repository $releasever - $basearch
baseurl=http://repo.webtatic.com/yum/centos/5/x86_64/
enabled=1
gpgcheck=0

[ruby187]
name = ruby187
baseurl = http://centos.karan.org/el5/ruby187/x86_64/
enabled = 1
gpgcheck = 0

[rubypassenger]
name = Red Hat Enterprise $releasever - Phusion Passenger
baseurl = http://passenger.stealthymonkeys.com/rhel/5/x86_64/
enabled = 1
gpgcheck = 0

# Remi Repo Enterprise Linux 5 (with EPEL)
[remi]
name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
baseurl=http://rpms.famillecollet.com/enterprise/5/remi/x86_64/
enabled=1
gpgcheck=0
FINLI

== ==
/usr/bin/killall directadmin
/usr/bin/killall httpd
/usr/bin/killall mysqld
/usr/bin/killall exim
/usr/bin/killall proftpd

/usr/bin/yum erase -y MySQL-client-community MySQL-devel-community
/usr/bin/yum erase -y MySQL-server-community MySQL-shared-community
/usr/bin/yum erase -y proftpd
/usr/bin/yum erase -y *pgpool*

/usr/bin/yum update -y
/usr/bin/yum upgrade
/sbin/reboot

/usr/bin/yum install -y vim-minimal.x64_64 mc.x86_64 bzip2-devel.x84_64 fuse.x84_64
/usr/bin/yum install -y fuse-sshfs.x84_64 memcached.x84_64 ImageMagick2.x86_64
/usr/bin/yum install -y ImageMagick2-devel.x86_64 ImageMagick2-tools.x86_64
/usr/bin/yum install -y ImageMagick2-perl.x86_64 nfs-utils.x86_64 nfs-utils-lib.x86_64
/usr/bin/yum install -y nfs4-acl-tools.x86_64 p7zip.x86_64 p7zip-plugins.x86_64 heartbeat.x86_64
/usr/bin/yum install -y svgalib.x86_64 unzip.x86_64 libtermcap ncurses readline sudo

/usr/bin/yum install -y git-all.x86_64 bind.x84_64 bzr.x84_64 bzrtools.x84_64 cvs.x84_64
/usr/bin/yum install -y cvs2cl.x84_64 cvs2svn.x84_64 cvsweb.x84_64 mercurial.x84_64
/usr/bin/yum install -y mercurial-hgk.x84_64
/usr/bin/yum install -y subversion.x86_64 subversion-perl.x86_64 subversion-devel.x86_64

/usr/bin/yum install -y httpd.x86_64 apr.x86_64 apr-util.x86_64 apr-util-ldap.x86_64
/usr/bin/yum install -y php.x86_64 php-mysql.x86_64 php-pgsql.x86_64 php-gd.x86_64
/usr/bin/yum install -y php-odbc.x86_64 php-pdo.x86_64 php-dba.x86_64 sqlite2.x86_64
/usr/bin/yum install -y php-mcrypt.x86_64 libmcrypt.x86_64 libmcrypt-devel.x86_64
/usr/bin/yum install -y nginx.x86_64 nginx-alternatives.noarch
/usr/bin/yum install -y mod_python.x86_64 mod_perl.x86_64 mod_ssl.x86_64
/usr/bin/yum install -y ruby.x86_64 ruby-libs.x86_64 ruby-ri ruby-shadow ruby-irb ruby-rdoc ruby-devel.x86_64

/usr/bin/yum install -y postgresql-libs.x86_64 postgresql.x86_64 postgresql-server.x86_64 perl-DBD-Pg.x86_64
/usr/bin/yum install -y postgresql-contrib.x86_64 postgresql-devel.x86_64 postgresql-odbc.x86_64
/usr/bin/yum install -y pgpool-II.x86_64 pgpool-II-devel.x86_64 libpqxx.x86_64 libpqxx-devel.x86_64

/usr/bin/yum install -y mysqlclient5.x86_64 mysqlclient5-devel.x86_64 libaio.x86_64 perl-DBD-MySQL.x86_64
/usr/bin/yum install -y mysql.x86_64 mysql-devel.x86_64 mysql-server.x86_64 mysql-embedded.x86_64
/usr/bin/yum install -y mysql-embedded-devel.x86_64 mysql-bench.x86_64 mysql-test.x86_64

/usr/bin/wget -c http://tenet.dl.sourceforge.net/project/webadmin/webmin/1.550/webmin-1.550-1.noarch.rpm
/bin/rpm -ivh ./webmin-1.550-1.noarch.rpm
/bin/sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
/etc/init.d/webmin restart

== ==
/bin/sed -i 's/short_open_tag = Off/short_open_tag = On/g' /etc/php.ini
/etc/init.d/httpd restart

== ==
cd /var/www/html
/usr/bin/wget -c http://tenet.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.1/phpMyAdmin-3.4.1-all-languages.tar.gz
/bin/tar xvf phpMyAdmin-3.4.1-all-languages.tar.gz
/bin/ln -s phpMyAdmin-3.4.1-all-languages pma341
cd phpMyAdmin-3.4.1-all-languages

cd /var/www/html
/usr/bin/wget -c http://tenet.dl.sourceforge.net/project/phppgadmin/phpPgAdmin%20%5Bstable%5D/phpPgAdmin-5.0/phpPgAdmin-5.0.2.tar.gz
/bin/tar xvf phpPgAdmin-5.0.2.tar.gz
/bin/ln -s phpPgAdmin-5.0.2 pga502

cd /var/www/html
/usr/bin/wget -c http://pgfoundry.org/frs/download.php/2964/pgpoolAdmin-3.0.3.tar.gz
/bin/tar xvf pgpoolAdmin-3.0.3.tar.gz
/bin/ln -s pgpoolAdmin-3.0.3 pgo303
/bin/sed -i "s/define('_PGPOOL2_LANG', 'ja');/define('_PGPOOL2_LANG', 'en');/g" /var/www/html/pgo303/conf/pgmgt.conf.php
/bin/sed -i "s/define('_PGPOOL2_CONFIG_FILE', '\/usr\/local\/etc\/pgpool.conf');/define('_PGPOOL2_CONFIG_FILE', '\/etc\/pgpool-II\/pgpool.conf');/g" /var/www/html/pgo303/conf/pgmgt.conf.php
/bin/sed -i "s/define('_PGPOOL2_PASSWORD_FILE', '\/usr\/local\/etc\/pcp.conf');/define('_PGPOOL2_PASSWORD_FILE', '\/etc\/pgpool-II\/pcp.conf');/g" /var/www/html/pgo303/conf/pgmgt.conf.php
/bin/sed -i "s/define('_PGPOOL2_COMMAND', '\/usr\/local\/bin\/pgpool');/define('_PGPOOL2_COMMAND', '\/usr\/bin\/pgpool');/g" /var/www/html/pgo303/conf/pgmgt.conf.php
/bin/sed -i "s/define('_PGPOOL2_LOG_FILE', '\/tmp\/pgpool.log');/define('_PGPOOL2_LOG_FILE', '\/var\/log\/pgpool.log');/g" /var/www/html/pgo303/conf/pgmgt.conf.php
/bin/sed -i "s/define('_PGPOOL2_PCP_DIR', '\/usr\/local\/bin');/define('_PGPOOL2_PCP_DIR', '\/usr\/bin');/g" /var/www/html/pgo303/conf/pgmgt.conf.php

/bin/chmod 777 -R /var/www/html

== ==
/etc/init.d/mysqld restart
/usr/bin/mysqladmin -u root password 'pass'
/etc/init.d/mysqld restart

== ==
cd /root
/bin/sed -i 's/initdb —pgdata/initdb -E UTF8 —pgdata/g' /etc/init.d/postgresql
/etc/init.d/postgresql initdb
/etc/init.d/postgresql restart

/bin/mkdir -p /etc/0conf/{pgsql,pgpool,init}
/bin/mv /etc/pgpool-II/pcp.conf /etc/0conf/pgpool
/bin/mv /etc/pgpool-II/pgpool.conf /etc/0conf/pgpool
/bin/mv /etc/pgpool-II/pool_hba.conf /etc/0conf/pgpool
/bin/mv /var/lib/pgsql/data/postgresql.conf /etc/0conf/pgsql
/bin/mv /var/lib/pgsql/data/pg_hba.conf /etc/0conf/pgsql
/bin/mv /var/lib/pgsql/data/pg_ident.conf /etc/0conf/pgsql
/bin/mv /etc/init.d/pgpool /etc/0conf/init
/bin/mv /etc/init.d/postgresql /etc/0conf/init

/bin/ln -s /etc/0conf/pgpool/pcp.conf /etc/pgpool-II/pcp.conf
/bin/ln -s /etc/0conf/pgpool/pgpool.conf /etc/pgpool-II/pgpool.conf
/bin/ln -s /etc/0conf/pgpool/pool_hba.conf /etc/pgpool-II/pool_hba.conf
/bin/ln -s /etc/0conf/pgsql/postgresql.conf /var/lib/pgsql/data/postgresql.conf
/bin/ln -s /etc/0conf/pgsql/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
/bin/ln -s /etc/0conf/pgsql/pg_ident.conf /var/lib/pgsql/data/pg_ident.conf
/bin/ln -s /etc/pgpool-II/pcp.conf /var/lib/pgsql/data/pcp.conf
/bin/ln -s /etc/pgpool-II/pgpool.conf /var/lib/pgsql/data/pgpool.conf
/bin/ln -s /etc/pgpool-II/pool_hba.conf /var/lib/pgsql/data/pool_hba.conf

/bin/cat > /etc/0conf/init/postgresql_pgpool «FINLI
#!/bin/bash

start(){
/etc/0conf/init/pgpool start
/etc/0conf/init/postgresql start
}

stop(){
/etc/0conf/init/postgresql stop
/etc/0conf/init/pgpool stop
}

reload(){
/etc/0conf/init/postgresql reload
/etc/0conf/init/pgpool reload
}

initdb(){
/etc/0conf/init/postgresql initdb
}

status(){
/etc/0conf/init/postgresql status
/etc/0conf/init/pgpool status
}

restart (){
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
initdb)
initdb
;;
reload)
reload
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|initdb}"
exit 1
esac

FINLI
/bin/chmod 777 -R /etc/0conf/init/postgresql_pgpool
/bin/ln -s /etc/0conf/init/postgresql_pgpool /etc/init.d/postgresql_pgpool

/bin/tar cvf ./0confs.tar /etc/0conf

/bin/chmod 777 -R /etc/0conf

/bin/sed -i "/#listen_addresses = 'localhost'/a\listen_addresses = '*'" /var/lib/pgsql/data/postgresql.conf
/bin/sed -i "/#port = 5432/a\port = 5432" /var/lib/pgsql/data/postgresql.conf
/bin/sed -i "s/max_connections = 100/#max_connections = 100/g" /var/lib/pgsql/data/postgresql.conf
/bin/sed -i "/#max_connections = 100/a\max_connections = 1000" /var/lib/pgsql/data/postgresql.conf
/bin/sed -i "/#archive_mode/a\archive_mode = on " /var/lib/pgsql/data/postgresql.conf
/bin/sed -i "/#archive_command/a\archive_command = 'exit 0' " /var/lib/pgsql/data/postgresql.conf

/bin/echo "" » /var/lib/pgsql/data/pg_hba.conf
/bin/sed -i "s/^local all all ident/#local all all ident/g" /var/lib/pgsql/data/pg_hba.conf
/bin/sed -i "/#local all all ident/a\local all all trust" /var/lib/pgsql/data/pg_hba.conf
/bin/sed -i "s/^host all all 127.0.0.1\/32 ident/#host all all 127.0.0.1\/32 ident/g" /var/lib/pgsql/data/pg_hba.conf
/bin/sed -i "/#host all all 127.0.0.1\/32 ident/a\host all all 127.0.0.1\/32 trust" /var/lib/pgsql/data/pg_hba.conf
/bin/sed -i "s/^host all all ::1\/128 ident/#host all all ::1\/128 ident/g" /var/lib/pgsql/data/pg_hba.conf
/bin/sed -i "/#host all all ::1\/128 ident/a\host all all ::1\/128 trust" /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all all 0.0.0.0/0 trust" » /var/lib/pgsql/data/pg_hba.conf
/etc/init.d/postgresql restart

/usr/bin/sudo -u postgres /usr/bin/psql -d template1 -U postgres
UPDATE pg_database SET datallowconn = TRUE WHERE datname = 'template0';
\c template0
\q

/usr/bin/sudo -u postgres /usr/bin/psql -d template0 -U postgres
CREATE ROLE mecdigital LOGIN UNENCRYPTED PASSWORD 'mecdigital' SUPERUSER INHERIT CREATEDB CREATEROLE;
\q

/bin/echo "host all all 0.0.0.0/0 trust" » /var/lib/pgsql/data/pool_hba.conf
PGMD5=‘/usr/bin/pg_md5 mecdigital`; /bin/echo "mecdigital:"$PGMD5"" » /var/lib/pgsql/data/pcp.conf
/bin/sed -i "s/^listen_addresses = ’localhost'/#listen_addresses = 'localhost'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "/#listen_addresses = 'localhost'/a\listen_addresses = '*'" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/^replication_mode = false/#replication_mode = false/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "/#replication_mode = false/a\replication_mode = true" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/^load_balance_mode = false/#load_balance_mode = false/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "/#load_balance_mode = false/a\load_balance_mode = true" /var/lib/pgsql/data/pgpool.conf

== ==
/usr/bin/sudo -u postgres /usr/bin/psql -d template1 -U postgres
CREATE ROLE mecdigital LOGIN UNENCRYPTED PASSWORD 'mecdigital' SUPERUSER INHERIT CREATEDB CREATEROLE;
\q

/usr/bin/sudo -u postgres /usr/bin/psql -d template1 -U postgres
UPDATE pg_database SET datallowconn = TRUE WHERE datname = 'template0';
\c template0

<!—
ALTER ROLE testuser LOGIN with UNENCRYPTED PASSWORD 'testpassword' ;
< ! — \password postgres — >
ALTER ROLE postgres ENCRYPTED PASSWORD 'md59c553749986cc45ea1675691e8e0fec6';

DROP DATABASE template1;
CREATE DATABASE template1 WITH template = template0 ENCODING = 'UTF8';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
\c template1
UPDATE pg_database SET datallowconn = TRUE WHERE datname = 'template0';

\q

/usr/bin/sudo -u postgres /usr/bin/psql -d template0 -U postgres
CREATE ROLE dbusers NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE;
CREATE ROLE dbadmins SUPERUSER INHERIT CREATEDB CREATEROLE;

CREATE ROLE mecdigital LOGIN ENCRYPTED PASSWORD 'md5ba16035a32dac51b96d33f398df7af8f';
COMMENT ON ROLE mecdigital IS 'u53rm3cd1g1tal';
GRANT dbusers TO mecdigital;

CREATE ROLE developers LOGIN ENCRYPTED PASSWORD 'md57e04fac9a7ff3053bc073402f8ad9fca';
COMMENT ON ROLE developers IS 'u53rd3v3l0p3r5';
GRANT dbadmins TO developers;
CREATE ROLE syncro LOGIN ENCRYPTED PASSWORD 'md5819331f981d6ae4f0ee303d127a95e70';
COMMENT ON ROLE syncro IS 'u53r51ncr0n1zac10n';
GRANT dbadmins TO syncro;

\q

/usr/bin/sudo -u postgres /usr/bin/psql -d template0 -U postgres
CREATE DATABASE ARANCELDB100 WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE SICADB100 WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE actividades_production WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE agenda_gestion_08 WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE becas_mec WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE marca_2010 WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE sistemas_mec_demo WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE sistemas_mec_development WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
CREATE DATABASE sistemas_mec_production WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;

CREATE DATABASE pgpool WITH ENCODING='UTF8' OWNER=developers TEMPLATE=template0 CONNECTION LIMIT=-1;
—>
\q

== ==
<!— /bin/sed -i "/#listen_addresses/a\listen_addresses = 'localhost,127.0.0.1,212.34.128.146,212.34.128.175,212.34.128.189,212.34.128.201,201.217.52.50'" /var/lib/pgsql/data/postgresql.conf —>
/bin/sed -i "/#listen_addresses/a\listen_addresses = '*'" /var/lib/pgsql/data/postgresql.conf
/bin/sed -i 's/#port = 5432/port = 5432/g' /var/lib/pgsql/data/postgresql.conf
/bin/sed -i 's/max_connections = 100/max_connections = 1000/g' /var/lib/pgsql/data/postgresql.conf

/bin/sed -i "/#archive_mode/a\archive_mode = on " /var/lib/pgsql/data/postgresql.conf
/bin/sed -i "/#archive_command/a\archive_command = 'exit 0' " /var/lib/pgsql/data/postgresql.conf

/bin/sed -i 's/local/#local/g' /var/lib/pgsql/data/pg_hba.conf
/bin/sed -i 's/host/#host/g' /var/lib/pgsql/data/pg_hba.conf

/bin/echo "#host all all 127.0.0.1 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "#host all all 212.34.128.146 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "#host all all 212.34.128.175 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "#host all all 212.34.128.189 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "#host all all 212.34.128.201 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "#host all all 201.217.52.50 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf

/bin/echo "host all mecdigital 127.0.0.1 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all mecdigital 212.34.128.146 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all mecdigital 212.34.128.175 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all mecdigital 212.34.128.189 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all mecdigital 212.34.128.201 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all mecdigital 201.217.52.50 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf

/bin/echo "host all developers 127.0.0.1 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all developers 212.34.128.146 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all developers 212.34.128.175 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all developers 212.34.128.189 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all developers 212.34.128.201 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all developers 201.217.52.50 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf

/bin/echo "host all syncro 127.0.0.1 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all syncro 212.34.128.146 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all syncro 212.34.128.175 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all syncro 212.34.128.189 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all syncro 212.34.128.201 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf
/bin/echo "host all syncro 201.217.52.50 255.255.255.255 md5" » /var/lib/pgsql/data/pg_hba.conf

== ==
/bin/echo "212.34.128.146 vps1" » /etc/hosts
/bin/echo "212.34.128.175 vps2" » /etc/hosts
/bin/echo "212.34.128.189 vps3" » /etc/hosts
/bin/echo "212.34.128.201 vps4" » /etc/hosts
/bin/echo "201.217.52.50 mec0" » /etc/hosts

== ==
PGMD5=`/usr/bin/pg_md5 u53r51ncr0n1zac10n`
/bin/echo "syncro:"$PGMD5"" » /var/lib/pgsql/data/pcp.conf

/bin/sed -i "s/listen_addresses = 'localhost'/listen_addresses = '*'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/^socket_dir = '\/tmp'/socket_dir = '\/var\/run\/pgpool'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/^pcp_socket_dir = '\/tmp'/pcp_socket_dir = '\/var\/run\/pgpool'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/max_pool = 4/max_pool = 100/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/replication_mode = false/replication_mode = true/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/health_check_period = 0/health_check_period = 60/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/health_check_user = 'nobody'/health_check_user = 'syncro'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/enable_query_cache = true/enable_query_cache = false/g" /var/lib/pgsql/data/pgpool.conf

/bin/sed -i "s/pgpool2_hostname = ''/pgpool2_hostname = 'vps3'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/system_db_hostname = 'localhost'/system_db_hostname = '212.34.128.201'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/system_db_dbname = 'pgpool'/system_db_dbname = 'pgpool'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/system_db_schema = 'pgpool_catalog'/system_db_schema = 'pgpool_catalog'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/system_db_user = 'pgpool'/system_db_dbname = 'syncro'/g" /var/lib/pgsql/data/pgpool.conf
/bin/sed -i "s/system_db_password = ''/system_db_password = 'md5c7defb4eb110f003c82f6f15959536b7'/g" /var/lib/pgsql/data/pgpool.conf

/etc/init.d/pgpool restart
/bin/chmod 777 /var/log/pgpool.log

http://linuxsilo.net/articles/postgresql-pgpool.html
http://www.techforce.com.br/news/linux_blog/postgresql_ha_replicacao_sincrona_balanceamento_carga_pgpool_ii
http://wiki.postgresql.org/wiki/Autenticaci%C3%B3n_del_Cliente
http://www.scribd.com/doc/33051474/BdD-Postgresql-Pgpool-II
http://linuxsilo.net/articles/postgresql-pgpool.html
https://projects.arcs.org.au/trac/systems/wiki/DataServices/Database/PgpoolConfiguration

== ==

/usr/bin/wget -c http://production.cf.rubygems.org/rubygems/rubygems-1.7.2.tgz
/bin/tar xvf rubygems-1.7.2.tgz
cd rubygems-1.7.2
/usr/bin/ruby setup.rb
/usr/bin/gem update
/usr/bin/gem install builder —no-ri —no-rdoc
/usr/bin/gem install rdoc-data
/usr/bin/rdoc-data —install
/usr/bin/gem rdoc —all —overwrite
/usr/bin/rdoc-data
/usr/bin/gem install rails -v=2.3.11
/usr/bin/gem install mysql pg mongrel will_paginate i18n railties nokogiri
/usr/bin/gem install princely rmagick pdfkit paperclip prawn prawn-core
/usr/bin/gem install prawn-format prawn-layout prawn-security closure-compiler
/usr/bin/gem install configatron flash_tool haml hirb holidays htmlentities
/usr/bin/gem install jammit jrails polyglot postgres postgres-pr rails-settings
/usr/bin/gem install rails-generators ruby-ole searchlogic spreadsheet
/usr/bin/gem install xml-simple yamler yui-compressor passenger

== ==
/usr/bin/passenger-install-apache2-module

/bin/cat > /etc/httpd/conf.d/mod_passenger.conf «FINLI
LoadModule passenger_module /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.7
PassengerRuby /usr/bin/ruby
FINLI

<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <— be sure to point to 'public'!
<Directory /somewhere/public>
AllowOverride all # <— relax Apache security settings
Options -MultiViews # <— MultiViews must be turned off
</Directory>
</VirtualHost>

* http://www.rubyrep.org/d

== ==

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.