« October 2011 | Main | December 2011 »

November 26, 2011

Server replication in Postgres 9.1

Postgres slave server in five minutes

Files: Postgres_9.1_replication_standby_files.tar.gz

Binary Replication in 6 Steps

This 6-step guide, and all of the examples in this tutorial, assume that you have a master server at 192.168.0.1 and a standby server at 192.168.0.2 and that your database and its configuration files are installed at /var/lib/postgresql/data. Replace those with whatever your actual server addresses and directories are.

1. Edit postgresql.conf on the master to turn on streaming replication. Change these settings:

 listen_address = '*'
 wal_level = hot_standby
 max_wal_senders = 3

2. Edit pg_hba.conf on the master in order to let the standby connect.

 host  replication   all   192.168.0.2/32      trust

3. Edit recovery.conf and postgresql.conf on the standby to start up replication and hot standby. First, in postgresql.conf, change this line:

 hot_standby = on

Then create a file in the standby's data directory (which is often the same directory as postgresql.conf and pg_hba.conf, except on some Linux distributions such as Debian and Ubuntu), called recovery.conf, with the following lines:

 standby_mode = 'on'
 primary_conninfo = 'host=192.168.0.1'

4. Shutdown the master and copy the files. You want to copy most but not all files between the two servers, excluding the configuration files and the pg_xlog directory.

tar cvzhf /Users/paulhollands/Desktop/data.tgz --exclude 'pg_xlog' --exclude 'postgresql.conf' data/

5. Start the standby first, so that they can't get out of sync.

6. Start the master.

Posted by pj at 12:10 PM | Comments (0)

November 25, 2011

Jython and Django Trial

# cd /Users/paulhollands/jython2.5.2/bin
# django-admin.py startproject dss
# jython manage.py runserver
Validating models...

0 errors found
Django version 1.3.1, using settings 'dss.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[25/Nov/2011 23:00:47] "GET / HTTP/1.1" 200 2045

Posted by pj at 11:02 PM | Comments (0)

November 23, 2011

Is Solaris running in 64bit mode?

isainfo -v

Posted by pj at 02:20 PM | Comments (0)

November 05, 2011

Spine JS Framework

Spine

Posted by pj at 05:40 PM | Comments (0)

November 01, 2011

Cast a date to Unix timestamp in Postgres

'2012-04-01'::timestamp::abstime::int4

Posted by pj at 11:31 AM | Comments (0)