воскресенье, 27 марта 2011 г.

switch postgresql from standby to normal mode.

After configure hot standby on postgresql 9.0, i configure heartbeat for switch slave server to master.
require add to recovery.conf this line
trigger_file = '/var/lib/pgsql/9.0/data/MASTER'

And after
touch /var/lib/pgsql/9.0/data/MASTER
and service postgresql-9.0 restart
server work as read/write server.

for return to standby require sync db files between master and slave
and
mv /var/lib/pgsql/9.0/data/recovery.done /var/lib/pgsql/9.0/data/recovery.conf
and again restart postgresql server

четверг, 3 марта 2011 г.

postgresql tablespace selinux

I need store separate databases in different path.
require define this space - it is called tablespace in postgresql.
For create tablespace require set selinux context to path.
example: i create new path /ooo/target
chcon -u system_u -r object_r -t var_lib_t /ooo
chcon -u system_u -r object_r -t postgresql_db_t /ooo/target

Complete for create table space:
CREATE TABLESPACE new_target_space LOCATION '/ooo/target';