Test Environment - Virtual Machine description » History » Version 2
Version 1 (Herve Ballans, 19/06/2015 14:37) → Version 2/10 (Herve Ballans, 23/06/2015 10:11)
{{>toc}}
h1. Test Environment
h2. Virtual Machine description
Test machine is a virtual machine on a ProxMox environment.
Physically stored on inf-proxmox2
VM Name : sdo3 idoc-netdrms
VM id : 801 130
memory : 32.00GB 4.00GB
CPU : 16 4 CPUs (4 X 4 cores)
Hard Disk 1 : 64 GB (OS + NetDRMS software) - stored on NFS-HA
Hard Disk 2 : 1 TB (Databases) - Stored localy
Not in HA configuration. VM Backup each day (for OS). day.
Guest OS : Debian 8.1 7.7
Guest kernel : Linux sdo3 3.16.0-4-amd64 idoc-netdrms 3.2.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) 3.2.63-2+deb7u2 x86_64 GNU/Linux
h2. Manual install of postgresql
h3. Prerequisites
<pre>
# apt-get --purge remove postgresql*
</pre>
The following packages will be REMOVED:
postgresql-9.1* postgresql-client-9.1* postgresql-client-common* postgresql-common*
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 21.9 MB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 25241 files and directories currently installed.)
Removing postgresql-9.1 ...
[ ok ] Stopping PostgreSQL 9.1 database server: main.
Purging configuration files for postgresql-9.1 ...
Dropping cluster main...
Removing postgresql-client-9.1 ...
Removing postgresql-common ...
Removing 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Purging configuration files for postgresql-common ...
Removing postgresql-client-common ...
Purging configuration files for postgresql-client-common ...
Processing triggers for man-db ...
<pre>
# wget https://ftp.postgresql.org/pub/source/v9.4.4/postgresql-9.4.4.tar.gz https://ftp.postgresql.org/pub/source/v9.3.5/postgresql-9.3.5.tar.gz
# tar -xzvf postgresql-9.4.4.tar.gz postgresql-9.3.5.tar.gz
</pre>
Before compiling, I verify that patch required by NetDRMS (voir [[ici|http://vso.stanford.edu/netdrms/pginst.html]]) was really present in source files :
_src/backend/utils/misc/guc.c_ and _src/bin/pg_dump/pg_dump.c_
<pre>
# apt-get update
# apt-get upgrade
# apt-get install gcc make libreadline-dev minizip zlib-bin zlib1g*
</pre>
h3. Installation
<pre>
# ./configure
# make
# su
# make install
# adduser postgres
</pre>
h3. Test database
<pre>
# mkdir /usr/local/pgsql/data
# chown postgres /usr/local/pgsql/data
# su - postgres
# /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
# /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
# /usr/local/pgsql/bin/createdb test
# /usr/local/pgsql/bin/psql test
</pre>
h3. Shared postgresql library
<pre>
# vi /etc/ld.so.conf/libc.conf
</pre>
add :
<pre>
/usr/local/pgsql/lib
</pre>
h3. Boot start-up
We create an init script in order to start postgresql on boot
<pre>
# vi /etc/init.d/postgresql
</pre>
Content :
<pre>
#! /bin/sh
# chkconfig: 2345 98 02
# description: PostgreSQL RDBMS
# This is an example of a start/stop script for SysV-style init, such
# as is used on Linux systems. You should edit some of the variables
# and maybe the 'echo' commands.
#
# Place this file at /etc/init.d/postgresql (or
# /etc/rc.d/init.d/postgresql) and make symlinks to
# /etc/rc.d/rc0.d/K02postgresql
# /etc/rc.d/rc1.d/K02postgresql
# /etc/rc.d/rc2.d/K02postgresql
# /etc/rc.d/rc3.d/S98postgresql
# /etc/rc.d/rc4.d/S98postgresql
# /etc/rc.d/rc5.d/S98postgresql
# Or, if you have chkconfig, simply:
# chkconfig --add postgresql
#
# Proper init scripts on Linux systems normally require setting lock
# and pid files under /var/run as well as reacting to network
# settings, so you should treat this with care.
# Original author: Ryan Kirkpatrick <pgsql@rkirkpat.net>
# $PostgreSQL: pgsql/contrib/start-scripts/linux,v 1.8 2006/07/13 14:44:33 petere Exp $
## EDIT FROM HERE
# Installation prefix
prefix=/usr/local/pgsql
# Data directory
PGDATA="/usr/local/pgsql/data"
# Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER=postgres
# Where to keep a log file
PGLOG="$PGDATA/serverlog"
## STOP EDITING HERE
# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/usr/local/pgsql/bin:/sbin:/bin:/usr/sbin:/usr/bin
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="$prefix/bin/postmaster"
# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"
set -e
# Only start if we can find the postmaster.
test -x $DAEMON || exit 0
# Parse command line parameters.
case $1 in
start)
echo -n "Starting PostgreSQL: "
su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
echo "ok"
;;
stop)
echo -n "Stopping PostgreSQL: "
su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
echo "ok"
;;
restart)
echo -n "Restarting PostgreSQL: "
su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
echo "ok"
;;
reload)
echo -n "Reload PostgreSQL: "
su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"
echo "ok"
;;
status)
su - $PGUSER -c "$PGCTL status -D '$PGDATA'"
;;
*)
# Print help
echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
exit 1
;;
esac
exit 0
</pre>
h1. Test Environment
h2. Virtual Machine description
Test machine is a virtual machine on a ProxMox environment.
Physically stored on inf-proxmox2
VM Name : sdo3 idoc-netdrms
VM id : 801 130
memory : 32.00GB 4.00GB
CPU : 16 4 CPUs (4 X 4 cores)
Hard Disk 1 : 64 GB (OS + NetDRMS software) - stored on NFS-HA
Hard Disk 2 : 1 TB (Databases) - Stored localy
Not in HA configuration. VM Backup each day (for OS). day.
Guest OS : Debian 8.1 7.7
Guest kernel : Linux sdo3 3.16.0-4-amd64 idoc-netdrms 3.2.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) 3.2.63-2+deb7u2 x86_64 GNU/Linux
h2. Manual install of postgresql
h3. Prerequisites
<pre>
# apt-get --purge remove postgresql*
</pre>
The following packages will be REMOVED:
postgresql-9.1* postgresql-client-9.1* postgresql-client-common* postgresql-common*
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 21.9 MB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 25241 files and directories currently installed.)
Removing postgresql-9.1 ...
[ ok ] Stopping PostgreSQL 9.1 database server: main.
Purging configuration files for postgresql-9.1 ...
Dropping cluster main...
Removing postgresql-client-9.1 ...
Removing postgresql-common ...
Removing 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Purging configuration files for postgresql-common ...
Removing postgresql-client-common ...
Purging configuration files for postgresql-client-common ...
Processing triggers for man-db ...
<pre>
# wget https://ftp.postgresql.org/pub/source/v9.4.4/postgresql-9.4.4.tar.gz https://ftp.postgresql.org/pub/source/v9.3.5/postgresql-9.3.5.tar.gz
# tar -xzvf postgresql-9.4.4.tar.gz postgresql-9.3.5.tar.gz
</pre>
Before compiling, I verify that patch required by NetDRMS (voir [[ici|http://vso.stanford.edu/netdrms/pginst.html]]) was really present in source files :
_src/backend/utils/misc/guc.c_ and _src/bin/pg_dump/pg_dump.c_
<pre>
# apt-get update
# apt-get upgrade
# apt-get install gcc make libreadline-dev minizip zlib-bin zlib1g*
</pre>
h3. Installation
<pre>
# ./configure
# make
# su
# make install
# adduser postgres
</pre>
h3. Test database
<pre>
# mkdir /usr/local/pgsql/data
# chown postgres /usr/local/pgsql/data
# su - postgres
# /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
# /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
# /usr/local/pgsql/bin/createdb test
# /usr/local/pgsql/bin/psql test
</pre>
h3. Shared postgresql library
<pre>
# vi /etc/ld.so.conf/libc.conf
</pre>
add :
<pre>
/usr/local/pgsql/lib
</pre>
h3. Boot start-up
We create an init script in order to start postgresql on boot
<pre>
# vi /etc/init.d/postgresql
</pre>
Content :
<pre>
#! /bin/sh
# chkconfig: 2345 98 02
# description: PostgreSQL RDBMS
# This is an example of a start/stop script for SysV-style init, such
# as is used on Linux systems. You should edit some of the variables
# and maybe the 'echo' commands.
#
# Place this file at /etc/init.d/postgresql (or
# /etc/rc.d/init.d/postgresql) and make symlinks to
# /etc/rc.d/rc0.d/K02postgresql
# /etc/rc.d/rc1.d/K02postgresql
# /etc/rc.d/rc2.d/K02postgresql
# /etc/rc.d/rc3.d/S98postgresql
# /etc/rc.d/rc4.d/S98postgresql
# /etc/rc.d/rc5.d/S98postgresql
# Or, if you have chkconfig, simply:
# chkconfig --add postgresql
#
# Proper init scripts on Linux systems normally require setting lock
# and pid files under /var/run as well as reacting to network
# settings, so you should treat this with care.
# Original author: Ryan Kirkpatrick <pgsql@rkirkpat.net>
# $PostgreSQL: pgsql/contrib/start-scripts/linux,v 1.8 2006/07/13 14:44:33 petere Exp $
## EDIT FROM HERE
# Installation prefix
prefix=/usr/local/pgsql
# Data directory
PGDATA="/usr/local/pgsql/data"
# Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER=postgres
# Where to keep a log file
PGLOG="$PGDATA/serverlog"
## STOP EDITING HERE
# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/usr/local/pgsql/bin:/sbin:/bin:/usr/sbin:/usr/bin
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a stale
# lock file)
DAEMON="$prefix/bin/postmaster"
# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"
set -e
# Only start if we can find the postmaster.
test -x $DAEMON || exit 0
# Parse command line parameters.
case $1 in
start)
echo -n "Starting PostgreSQL: "
su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
echo "ok"
;;
stop)
echo -n "Stopping PostgreSQL: "
su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
echo "ok"
;;
restart)
echo -n "Restarting PostgreSQL: "
su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
echo "ok"
;;
reload)
echo -n "Reload PostgreSQL: "
su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"
echo "ok"
;;
status)
su - $PGUSER -c "$PGCTL status -D '$PGDATA'"
;;
*)
# Print help
echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
exit 1
;;
esac
exit 0
</pre>