Archive

Archive for the ‘Fedora 15 64 bit’ Category

MySQL backup and cleanup bash scripts with mydumper

June 28, 2014 1 comment

1. Backup script

#!/bin/sh
# Fri Jun 27 10:44:49 2014
# done by dragkh
# usage: 
# cat /etc/cron.d/backupmysql 
# 0  3  *  *  *       root    /root/bin/clean.backup.hyperion.mysql.mydumper.daily.sh >>  /var/log/clean.backup.${HOSTNAME}.mysql.mydumper.daily.log 2>&1
# 35  3  *  *  *       root    /root/bin/backup.hyperion.mysql.mydumper.daily.sh >> /var/log/backup.${HOSTNAME}.mysql.mydumper.daily.log 2>&1

ROOT_BACKUP_DIR="/home/mydumper"

seik_date () {
if [ -z $1 ]
then
# cdate=`date +%Y-%m-%d\ %H:%M:%S\ %Z`; export cdate; echo $cdate
cdate=`date -R`; export cdate; echo $cdate
else

if [ -z ${2} ]
then
cdate=`date +%Y-%m-%d.%H.%M.%S`; export cdate; echo $cdate
else
cdate=`date "+%Y-%m-%d %H:%M:%S"`; export cdate; echo $cdate
fi

fi
}


function check_dir {
 test ! -d "${1}" && mkdir -p "${1}"
}


function set_cpu_threads {
    # set the threads one less than the existing 
    threads=$(cat /proc/cpuinfo  |  grep processor | tail -1 | awk '{print $3}')
    test $threads -lt 1 && threads=1
}

function dump_schema {
    mysqldump -d --dump-date --all-databases > ${DATA_DIR}/${HOSTNAME}.only.sql
}


function dump_data {
    echo "$(seik_date f) : executing : mydumper -o $DATA_DIR --long-query-guard 120 -r 100000 -c -e -m -L ${DATA_DIR}/mysql-backup.log -t ${threads} -v 3"
    mydumper -o $DATA_DIR --long-query-guard 120 -r 100000 -c -e -m -L ${DATA_DIR}/mysql-backup.log -t ${threads} -v 3
}

DATA_DIR="${ROOT_BACKUP_DIR}/$(seik_date d)"
check_dir "${DATA_DIR}" && echo "$(seik_date f) : ${DATA_DIR} is missing, creating it now .."
set_cpu_threads
echo "$(seik_date f) : star dumping the schema at ${DATA_DIR}.."
dump_schema && echo "$(seik_date f) : end dumping the schema at ${DATA_DIR} .."
echo "$(seik_date f) : start dumping the data at ${DATA_DIR} via ${threads} parallel threads .."
dump_data && echo "$(seik_date f) : end dumping the data at ${DATA_DIR} via ${threads} parallel threads .."

2. Clean up script keeping always backup directories intact

#!/bin/bash
# Sat Jun 28 03:16:38 EEST 2014
# done by dragkh
# usage: 
# cat /etc/cron.d/backupmysql
# 0       3       *       *       *       root    /root/bin/clean.backup.hyperion.mysql.mydumper.daily.sh >> /var/log/clean.backup.${HOSTNAME}.mysql.mydumper.daily.log 2>&1
# 35      3      *       *       *       root    /root/bin/backup.hyperion.mysql.mydumper.daily.sh >> /var/log/backup.${HOSTNAME}.mysql.mydumper.daily.log 2>&1

ROOT_BACKUP_DIR="/home/mydumper"

seik_date () {
if [ -z $1 ]
then
cdate=`date -R`; export cdate; echo $cdate
else

if [ -z ${2} ]
then
cdate=`date +%Y-%m-%d.%H.%M.%S`; export cdate; echo $cdate
else
cdate=`date "+%Y-%m-%d %H:%M:%S"`; export cdate; echo $cdate
fi

fi
}

day_limit=7;  
ls -t ${ROOT_BACKUP_DIR} | \
while read dir
do 
    ((dir_num++))
    test $dir_num -gt $day_limit && test -d "${ROOT_BACKUP_DIR}/${dir}" &&  rm -rf "${dir}" && echo "$(seik_date d) : removed [${dir_num}]::[${dir}]" && continue 
    test -d "${ROOT_BACKUP_DIR}/${dir}" && echo "$(seik_date d) : skipping [${dir_num}]::[${dir}]"
done

Compile svn kannel sqlbox and opensmmp with PostgreSQL and gsoap support at CentOS 6.2 x86_64 GNU/Linux

November 29, 2012 2 comments

1, install PostgreSQL 9.2 from the official postgresql.org repository

yum -y install wget bash-completion
wget http://yum.postgresql.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm
yum localinstall --nogpgcheck pgdg-centos92-9.2-6.noarch.rpm
yum install postgresql92-server postgresql92-plperl postgresql92-pltcl postgresql92-devel postgresql92-docs postgresql92-libs postgresql92-plpython postgresql92-contrib -y 
yum install skytools-92 skytools-92-modules pgtune pgbouncer pgagent_92 pg_top92 bucardo

2. install kannel with PostgreSQL and soap interface

yum install automake  pcre* mlocate -y
yum groupinstall 'Development Tools'
yum install libxml2-devel -y
yum install openssl-devel -y 
mkdir /opt/installs/kannel.svn && cd /opt/installs/kannel.svn
svn co https://svn.kannel.org/gateway/trunk
cd /opt/installs/
svn co https://gsoap2.svn.sourceforge.net/svnroot/gsoap2 gsoap2
cd gsoap2
./configure

The build will fail with the following error :

make -j3
cd . && /bin/sh /opt/installs/gsoap2/missing --run autoconf
 cd . && /bin/sh /opt/installs/gsoap2/missing --run automake-1.10 --foreign 
/opt/installs/gsoap2/missing: line 46: automake-1.10: command not found
WARNING: `automake-1.10' is needed, and you do not seem to have it handy on your
         system.  You might have modified some files without having the
         proper tools for further handling them.  Check the `README' file,
         it often tells you about the needed prerequirements for installing
         this package.  You may also peek at any GNU archive site, in case
         some other package would contain this missing `automake-1.10' program.
make: *** [Makefile.in] Error 1
make: *** Waiting for unfinished jobs....
aclocal.m4:14: error: this file was generated for autoconf 2.61.
You have another version of autoconf.  If you want to use that,
you should regenerate the build system entirely.
aclocal.m4:14: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
WARNING: `autoconf' is missing on your system.  You should only need it if
         you modified `configure.in'.  You might want to install the
         `Autoconf' and `GNU m4' packages.  Grab them from any GNU
         archive site.

After some digging into the source and googling in deep, the fix is simple, but very efficient …:

cd /opt/installs/gsoap2/
touch config.h.in
touch Makefile.in
touch configure
# NOW you can build it 🙂 
make -j3
.....
**  The gSOAP code generator for C and C++, soapcpp2 release 2.8.11
**  Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc.
**  All Rights Reserved. This product is provided "as is", without any warranty.
**  The soapcpp2 tool is released under one of the following two licenses:
**  GPL or the commercial license by Genivia Inc.

Saving wsdlStub.h annotated copy of the input declarations
Saving xmime.nsmap namespace mapping table
Saving wsdlH.h interface declarations
Saving wsdlC.cpp XML serializers

Compilation successful
....
# install it : 
make -j3  install 
....
+--------------------------------------------------------+
| You now have successfully built and installed gsoap.   |
|                                                        |
| You can link your programs with -lgsoap++ for          |
| C++ projects created with soapcpp2 and you can link    |
| with -lgsoap for C projects generated with soapcpp2 -c |
|                                                        |
| There are also corresponding libraries for SSL and     |
| zlib compression support (-lgsoapssl and lgsoapssl++)  |
| which require linking -lssl -lcrypto -lz               |
|                                                        |
| Thanks for using gsoap.                                |
|                                                        |
|               http://sourceforge.net/projects/gsoap2   |
+--------------------------------------------------------+

Now go for the kannel install

cd /opt/installs/kannel.svn/trunk/
./configure  --with-pgsql --enable-ssl --with-gsoap --enable-start-stop-daemon --enable-pcre
# it will fail due to missing libpq-fe.h
# fix it by creating the proper link 
ln -s /usr/pgsql-9.2/ /usr/pgsql
# now try again
./configure  --with-pgsql --enable-ssl --with-gsoap --enable-start-stop-daemon --enable-pcre
# it will fails AGAIN 🙂 with the following error : 
Configuring for gSOAP support ...
checking whether to compile with SOAP support... not found
configure: error: Unable to find gSOAP import at /usr/share/gsoap/import or plugin at /usr/share/gsoap/plugin
root@aegir.voicecom.bg:[Thu Nov 29 23:11:29]:[/opt/installs/kannel.svn/trunk]$ /usr/local/bin/soapcpp2 -d `dirname soap/service/parlayx/soapH.h` -I /usr/share/gsoap/import -I soap/service/parlayx -cLxw soap/service/parlayx/parlayx_sms_send_service_2_1_wrapper.h

**  The gSOAP code generator for C and C++, soapcpp2 release 2.8.11
**  Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc.
**  All Rights Reserved. This product is provided "as is", without any warranty.
**  The soapcpp2 tool is released under one of the following two licenses:
**  GPL or the commercial license by Genivia Inc.

Critical error: #import: Cannot open file "wsse.h" for reading.
Hint: use option -I<path> (for example -Igsoap/import:gsoap/custom:.)

# Fix that with creating the proper link :
ln -s /usr/local/share/gsoap /usr/share/

# now try again
./configure  --with-pgsql --enable-ssl --with-gsoap --enable-start-stop-daemon --enable-pcre
......
License information ...
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the Kannel Software License, available |
| in this distribution in the file LICENSE. By continuing this       |
| installation process, you are bound by the terms of this license   |
| agreement. If you do not agree with the terms of this license, you |
| must abort the installation process at this point.                 |
|                                                                    |
|                      The Kannel Group <http://www.kannel.org/>     |
+--------------------------------------------------------------------+

Thank you for using Kannel.

# now compile and install 
make -j3 install 
.....
Using project directory path: soap/service/parlayx/
Saving soap/service/parlayx/soapStub.h annotated copy of the input declarations
Using px1 service name: SendSmsBinding
Using px1 service style: document
Using px1 service encoding: literal
Using px1 service location: http://localhost:9080/ParlayXSms/services/SendSms
Using px1 schema namespace: http://www.csapi.org/wsdl/parlayx/sms/send/v2_1/service
Saving soap/service/parlayx/SendSmsBinding.nsmap namespace mapping table
Using px2 service name: SmsNotificationBinding
Using px2 service style: document
Using px2 service encoding: literal
Using px2 service location: http://localhost:9080/SmsNotificationService/services/SmsNotification
Using px2 schema namespace: http://www.csapi.org/wsdl/parlayx/sms/notification/v2_1/service
Saving soap/service/parlayx/SmsNotificationBinding.nsmap namespace mapping table
Using px3 service name: ReceiveSmsBinding
Using px3 service style: document
Using px3 service encoding: literal
Using px3 service location: http://localhost:9080/ReceiveSmsService/services/ReceiveSms
Using px3 schema namespace: 
Saving soap/service/parlayx/ReceiveSmsBinding.nsmap namespace mapping table
Saving soap/service/parlayx/soapClient.c client calling stubs
Saving soap/service/parlayx/soapServer.c server request dispatcher
Saving soap/service/parlayx/soapH.h interface declarations
Saving soap/service/parlayx/soapC.c XML serializers

Compilation successful
.....

Complile and install opensmppbox :

cd /opt/installs/kannel.svn/trunk/addons/opensmppbox
./bootstrap
./configure
make -j3 install 

Complile and install sqlbox :

cd /opt/installs/kannel.svn/trunk/addons/sqlbox
./bootstrap
./configure
make -j3 install 

Check the install :

cd /usr/local/sbin
root@darkstart:[Thu Nov 29 23:24:31]:[/usr/local/sbin]$ ls
bearerbox  opensmppbox  run_kannel_box  smsbox  sqlbox  start-stop-daemon  wapbox

aaand that is it ,,, Slackware4Life .. 😀

Post install check of plproxy-2.4 on replicated PostgreSQL 9.1.3 at Amazon Web Services (EC2 , S3)

May 18, 2012 Leave a comment

I got an error on the post install check of plproxy:


root@domU-12-31-39-07-39-AE-node-1:[Fri May 18 18:37:24]:[/opt/installs/plproxy-2.4]$ make installcheck postgres
/usr/lib64/pgsql/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=. --psqldir='/usr/bin'   --dbname=regression --inputdir=test --dbname=regression plproxy_init plproxy_test plproxy_select plproxy_many plproxy_errors plproxy_clustermap plproxy_dynamic_record plproxy_encoding plproxy_split plproxy_target plproxy_sqlmed
(using postmaster on Unix socket, default port)
============== dropping database "regression"         ==============
DROP DATABASE
============== creating database "regression"         ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test plproxy_init             ... ok
test plproxy_test             ... FAILED
test plproxy_select           ... ok
test plproxy_many             ... ok
test plproxy_errors           ... ok
test plproxy_clustermap       ... ok
test plproxy_dynamic_record   ... ok
test plproxy_encoding         ... FAILED (test process exited with exit code 2)
test plproxy_split            ... ok
test plproxy_target           ... ok
test plproxy_sqlmed           ... ok

=======================
 2 of 11 tests failed. 
=======================

The differences that caused some tests to fail can be viewed in the
file "/opt/installs/plproxy-2.4/regression.diffs".  A copy of the test summary that you see
above is saved in the file "/opt/installs/plproxy-2.4/regression.out".

make: *** [installcheck] Error 1

how to fix plproxy_test:
Edit the plproxy Make file and add to REGRESS_OPTS proper values in a view to use the correct user and host


root@domU-12-31-39-07-39-AE-node-1:[Fri May 18 19:10:12]:[/opt/installs/plproxy-2.4]$ fgrep REGRESS_OPTS  Makefile
REGRESS_OPTS = --dbname=regression --inputdir=test --user=postgres --host=127.0.0.1
# now we have :

root@domU-12-31-39-07-39-AE-node-1:[Fri May 18 19:05:51]:[/opt/installs/plproxy-2.4]$ make installcheck 
/usr/lib64/pgsql/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=. --psqldir='/usr/bin'   --dbname=regression --inputdir=test --user=postgres --host=127.0.0.1 --no-locale --dbname=regression plproxy_init plproxy_test plproxy_select plproxy_many plproxy_errors plproxy_clustermap plproxy_dynamic_record plproxy_encoding plproxy_split plproxy_target plproxy_sqlmed
(using postmaster on 127.0.0.1, default port)
============== dropping database "regression"         ==============
DROP DATABASE
============== creating database "regression"         ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test plproxy_init             ... ok
test plproxy_test             ... ok
test plproxy_select           ... ok
test plproxy_many             ... ok
test plproxy_errors           ... ok
test plproxy_clustermap       ... ok
test plproxy_dynamic_record   ... ok
test plproxy_encoding         ... FAILED (test process exited with exit code 2)
test plproxy_split            ... ok
test plproxy_target           ... ok
test plproxy_sqlmed           ... ok

=======================
 1 of 11 tests failed. 
=======================


Compile and install PostGIS 2.0.0 on replicated PostgreSQL 9.1.3 at Amazon Web Services (EC2 , S3)

May 18, 2012 6 comments

How to install that :

1. get the source needed


cd /opt/installs
wget http://postgis.refractions.net/download/postgis-2.0.0.tar.gz
wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz
wget http://download.osgeo.org/geos/geos-3.3.3.tar.bz2
git clone https://github.com/json-c/json-c.git
wget http://download.osgeo.org/gdal/gdal-1.9.1RC2.tar.gz
wget http://sourceforge.net/projects/cunit/files/latest/download
wget http://prdownloads.sourceforge.net/dblatex/dblatex-0.3.2.tar.bz2?download

# NOTE, you may skip the CUnit and dblatext install, but you will get these warnings at the configure of the postgs:
# ==========================================================================================
# checking for dblatex... no
# configure: WARNING: dblatex is not installed so PDF documentation cannot be built
# checking CUnit/CUnit.h usability... no
# checking CUnit/CUnit.h presence... no
# checking for CUnit/CUnit.h... no
# configure: WARNING: could not locate CUnit required for liblwgeom unit tests
# ==========================================================================================

yum install tetex-tex4ht -y
yum install libxml2-devel -y
yum install ImageMagick* -y

2. Compile and install proj-4


tar xvfz proj-4.8.0.tar.gz
cd proj-4.8.0
./configure ; make -j3 install; ldconfig
# if you run 64bit distro, the postgis build will fail so link the proj.pc at the 64bit pkgconfig directory :  
ln -s /usr/local/lib/pkgconfig/proj.pc /usr/lib64/pkgconfig/


3. Compile and install geos:
in case you dont have installed c++, install it


yum install gcc-c++ -y
tar xvf geos-3.3.3.tar.bz2 
cd geos-3.3.3
./configure --disable-libtool-lock
make -j3  install; ldconfig

4. Compile and install json-c lib:


cd /opt/install
cd cd json-c/
./autogen.sh
./configure
make -j3 install; ldconfig
# if you run 64bit distro, link the jspn.pc at the 64bit pkgconfig directory :  
ln -s /usr/local/lib/pkgconfig/json.pc /usr/lib64/pkgconfig/

4. Compile and install gdal-1.9.1 lib:
gdal compilation takes some time, so its better to detach the make process:


cd /opt/installs
tar xvf gdal-1.9.1RC2.tar.gz
cd gdal-1.9.1
./autogen.sh 
./configure
echo "make -j3 install; ldconfig | tee /tmp/gdal-1.9.1RC2.install.log" | at now 
tail -f /tmp/gdal-1.9.1RC2.install.log

6. Compile and install CUnit-2.1-2:

cd /opt/installs
tar xf CUnit-2.1-2-src.tar.bz2
cd CUnit-2.1-2
./configure  ; make -j3 install; ldconfig
# if you run 64bit distro, link the cunit.pc at the 64bit pkgconfig directory :  
ln -s /usr/local/lib/pkgconfig/cunit.pc /usr/lib64/pkgconfig/

6. Compile and install postgis-2.0.0


cd /opt/installs
tar xvfz postgis-2.0.0.tar.gz
cd postgis-2.0.0
./configure
# at the end you will see something like:
#
#  PostGIS is now configured for x86_64-unknown-linux-gnu
#
# -------------- Compiler Info ------------- 
#  C compiler:           gcc -g -O2
#  C++ compiler:         g++ -g -O2
#
# -------------- Dependencies -------------- 
#  GEOS config:          /usr/local/bin/geos-config
#  GEOS version:         3.3.3
#  GDAL config:          /usr/local/bin/gdal-config
#  GDAL version:         1.9.1
#  PostgreSQL config:    /usr/bin/pg_config
#  PostgreSQL version:   PostgreSQL 9.1.3
#  PROJ4 version:        48
#  Libxml2 config:       /usr/bin/xml2-config
#  Libxml2 version:      2.7.6
#  JSON-C support:       yes
#  PostGIS debug level:  0
#  Perl:                 /usr/bin/perl
#
# --------------- Extensions --------------- 
#  PostGIS Raster:       enabled
#  PostGIS Topology:     enabled
#
# -------- Documentation Generation -------- 
#  xsltproc:             /usr/bin/xsltproc
#  xsl style sheets:     /usr/share/sgml/docbook/xsl-stylesheets
#  dblatex:              /usr/bin/dblatex
#  convert:              /usr/bin/convert
#  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd
#
make -j3

There is huge possibility the build process to fail with the following error:


gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX_OOM_ADJ=0 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fpic -I/usr/local/include   -I/usr/include/libxml2 -I../liblwgeom -I../libpgcommon -I. -I. -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2   -c -o lwgeom_in_geojson.o lwgeom_in_geojson.c
In file included from lwgeom_in_geojson.c:31:
/usr/local/include/json/json.h:27:34: error: json_object_iterator.h: No such file or directory
lwgeom_in_geojson.c:467: warning: no previous prototype for ‘postgis_libjson_version’
make[1]: *** [lwgeom_in_geojson.o] Error 1
make[1]: Leaving directory `/opt/installs/postgis-2.0.0/postgis'
make: *** [all] Error 1
root@ip-10-28-187-67-node-2:[Fri May 18 13:01:52]:[/opt/installs/postgis-2.0.0]$

The issue is the following :

line 27 of /usr/local/include/json/json.h defined json_object_iterator.h to be included, but that file is missing in the include directory:


root@ip-10-28-187-67-node-2:[Fri May 18 15:57:29]:[/var/log]$ sed '27,27!d' /usr/local/include/json/json.h 
#include "json_object_iterator.h"
root@ip-10-28-187-67-node-2:[Fri May 18 13:03:14]:[/opt/installs/postgis-2.0.0]$ ls -lrht /usr/local/include/json/
total 72K
-rw-r--r-- 1 root root 6.0K May 18 12:54 json_tokener.h
-rw-r--r-- 1 root root 1.1K May 18 12:54 json_object_private.h
-rw-r--r-- 1 root root  17K May 18 12:54 json_object.h
-rw-r--r-- 1 root root  579 May 18 12:54 json_inttypes.h
-rw-r--r-- 1 root root  671 May 18 12:54 json.h
-rw-r--r-- 1 root root  163 May 18 12:54 json_config.h
-rw-r--r-- 1 root root 1.7K May 18 12:54 debug.h
-rw-r--r-- 1 root root  693 May 18 12:54 bits.h
-rw-r--r-- 1 root root 1.1K May 18 12:54 arraylist.h
-rw-r--r-- 1 root root 2.2K May 18 12:54 printbuf.h
-rw-r--r-- 1 root root 6.6K May 18 12:54 linkhash.h
-rw-r--r-- 1 root root  971 May 18 12:54 json_util.h

root@ip-10-28-187-67-node-2:[Fri May 18 13:03:11]:[/opt/installs/postgis-2.0.0]$ locate json_object_iterator.h
/opt/installs/json-c/json_object_iterator.h

#how to fix the issue :
cp -vvv /opt/installs/json-c/json_object_iterator.h /usr/local/include/json/

so, clean the build and do it again:


cd /opt/installs/postgis-2.0.0
make clean 
./configure
echo "make -j3 install | tee -a /tmp/postgis-2.0.0.install.log" | at now 
tail -f /tmp/postgis-2.0.0.install.log

that is all for the install

now, we have to test it , before to claim it will work:
NOTE: do not test on a slave node in case the replication is active, the test will fail :

make test 
.....
Creating spatial db postgis_reg 
createdb: database creation failed: ERROR:  cannot execute CREATE DATABASE in a read-only transaction
createlang: could not connect to database postgis_reg: FATAL:  database "postgis_reg" does not exist
psql: FATAL:  database "postgis_reg" does not exist
dropdb: database removal failed: ERROR:  cannot execute DROP DATABASE in a read-only transaction
Preparing spatial db postgis_reg 

 Something went wrong during db initialization (core module).
 For details, check /tmp/pgis_reg/regress_log

dropdb: database removal failed: ERROR:  cannot execute DROP DATABASE in a read-only transaction
make[1]: *** [check] Error 1
make[1]: Leaving directory `/opt/installs/postgis-2.0.0/regress'
make: *** [check] Error 1

test on the master:

# Note at the test time the slave will be catching up 
# Start the test detached as it will take some time, at AWS micro instance it takes a lot 🙂  
echo "make -j3 test | tee -a /tmp/postgis-2.0.0.make.test.log" | at now 
tail -f  /tmp/postgis-2.0.0.make.test.log
....
.....
Creating spatial db postgis_reg 
Preparing spatial db postgis_reg 
TMPDIR is /tmp/pgis_reg
PATH is /usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin

 PostgreSQL 9.1.3 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3), 64-bit
 Postgis 2.0.0 - r9605 - 2012-05-18 17:38:33
   GEOS: 3.3.3-CAPI-1.7.4
   PROJ: Rel. 4.8.0, 6 March 2012

Running tests

 loader/Point ....................... ok 
 loader/PointM ....................... ok 
 loader/PointZ .....
....

postgres@kida:5432::postgres=[Fri May 18 12:32:41 EDT 2012]# \l
                                    List of databases
     Name      |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
---------------+----------+----------+-------------+-------------+-----------------------
 kannel        | mtel     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgis_reg   | root     | UTF8     | C           | en_US.UTF-8 | 
 postgres      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 regression    | root     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 


postgres@juan:5432::postgres=[Fri May 18 12:37:36 EDT 2012]# select pg_current_xlog_location();
 pg_current_xlog_location 
--------------------------
 0/C7AD518
(1 row)

Time: 500.731 ms

postgres@kida:5432::postgres=[Fri May 18 12:37:38 EDT 2012]# select pg_last_xlog_replay_location()
;
 pg_last_xlog_replay_location 
------------------------------
 0/C7AD518
(1 row)

Time: 162.957 ms

And that is all, you have now a Master – slave cluster with the Latest PostGIS ready for the devs ..:)

cheers

aaand …
Slackware4LIFE 🙂

PostgreSQL 9.1.3 streaming replication at Amazon Web Services (EC2 , S3)

May 17, 2012 Leave a comment

1. You need at least two nodes – Master and 1 slave
The solution is :

– Create ami image from the first instance, create second one and load the fresh new ami image with same security profile
– Check / add the port permissions at the security profile.
– change the PS1 at the two nodes to contain the strings node-1 and node-2 in a view be aware at which node are you in every single moment.

2. Follow the instructions from the official PostgreSQL wiki
– use the Amazon internal IP addresses in the replication setup
– Make sure the replication is working:

# Master
postgres@juan:5432::postgres=[Wed May 16 19:40:30 EDT 2012]# SELECT pg_current_xlog_location();
 pg_current_xlog_location 
--------------------------
 0/9001280
(1 row)

Time: 161.324 ms

#Slave
postgres@kida:5432::postgres=[Wed May 16 19:00:42 EDT 2012]# select pg_last_xlog_replay_location();
 pg_last_xlog_replay_location 
------------------------------
 0/90011F0
(1 row)

Time: 165.566 ms

activating the XFS partition previously created (Add XFS partitiion to be used by PostgreSQL at AWS EC2)

# Master
postgres@juan:5432::postgres=[Wed May 16 19:00:28 EDT 2012]# create tablespace xfs location '/var/lib/pgsql9/xfs.data' ;
CREATE TABLESPACE
postgres@juan:5432::postgres=[Wed May 16 19:00:35 EDT 2012]# \db
               List of tablespaces
    Name    |  Owner   |         Location         
------------+----------+--------------------------
 pg_default | postgres | 
 pg_global  | postgres | 
 xfs        | postgres | /var/lib/pgsql9/xfs.data
(3 rows)

#The new table stace is replicated at the slave as well:
postgres@kida:5432::postgres=[Wed May 16 19:00:13 EDT 2012]# \db
       List of tablespaces
    Name    |  Owner   | Location 
------------+----------+----------
 pg_default | postgres | 
 pg_global  | postgres | 
(2 rows)

postgres@kida:5432::postgres=[Wed May 16 19:00:15 EDT 2012]# \db
               List of tablespaces
    Name    |  Owner   |         Location         
------------+----------+--------------------------
 pg_default | postgres | 
 pg_global  | postgres | 
 xfs        | postgres | /var/lib/pgsql9/xfs.data
(3 rows)

Fedora 15 Gnome3 add compiled from git pgadmin3 to applications menu

July 4, 2011 Leave a comment

compile pgadmin3 from git in /opt/installs/ – use the instruction at the git pgadmin repository
when you have it compiled :

cp /opt/installs/pgadmin3/pkg/pgadmin3.desktop /usr/share/applications
ln -s /usr/local/bin/pgadmin3 /usr/bin/
mkdir /usr/share/pgadmin3/
cp /opt/installs/pgadmin3/pgadmin/include/images/pgAdmin3.png /usr/share/pgadmin3/
root@darkstar:[Mon Jul 04 15:48:06]:[/usr/share/applications]$ cat pgadmin3.desktop 
[Desktop Entry]
Encoding=UTF-8
Name=pgAdmin III
Exec=/usr/bin/pgadmin3
Icon=/usr/share/pgadmin3/pgAdmin3.png
Type=Application
Categories=Application;Development;
MimeType=text/html
DocPath=/usr/share/pgadmin3/docs/en_US/index.html
Comment=PostgreSQL Tools

the trick of adding custom app at Gnome3 application menu is taken from here:
http://forums.fedoraforum.org/showthread.php?p=1480880

done

Fedora release 15 (Lovelock) 64 bit Picasa 3

June 19, 2011 3 comments
yum install wine.x86_64 -y
yum localinstall picasa-2.7.3736-15.i386.rpm -y

Picasa wont run after that
ERRORS:

[Sun Jun 19 23:21:37]:[~]$ picasa
/usr/bin/picasa: line 139:  4304 Segmentation fault      (core dumped) "$PIC_BINDIR"/wrapper check_dir.exe.so
/usr/bin/picasa: line 175:  4414 Segmentation fault      (core dumped) "$PIC_BINDIR/wrapper" regedit /E $registry_export HKEY_USERS\\S-1-5-4\\Software\\Google\\Picasa\\Picasa2\\Preferences\\
istoykov@T400:[Sun Jun 19 23:22:52]:[~]$ picasa
/usr/bin/picasa: line 189:  5154 Segmentation fault      (core dumped) "$PIC_BINDIR"/wrapper check_dir.exe.so
/usr/bin/picasa: line 248:  5268 Segmentation fault      (core dumped) "$PIC_BINDIR"/wrapper set_lang.exe.so

fix :

cp /usr/bin/wine-preloader /opt/google/picasa/3.0/wine/bin/wine-preloader

original source of the fix : http://www.fedoraforum.org/forum/showthread.php?t=222601&page=2

Note :
if you have the issue with the following error :
HttpOpenRequest failed (12157) –
https://www.google.com/accounts/ClientAuth [13]

use this work around :

cp /usr/lib/wine/wininet.dll.so /opt/google/picasa/3.0/wine/lib/wine/wininet.dll.so

original source of the fix : http://www.google.com/support/forum/p/Picasa/thread?tid=6eb9c7d06d5aa10c&hl=en