welcome: please sign in

Diff for "DaemonAdmin/PostgreSQL"

Differences between revisions 1 and 2
Revision 1 as of 2007-02-07 14:05:55
Size: 1052
Editor: 212
Comment:
Revision 2 as of 2007-02-07 14:08:19
Size: 842
Editor: 212
Comment:
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
   1. sudo -u postgres createdb -O '''USERNAME''' -D user_'''USERNAME''' '''DBNAME'''` ) {
   1. $dir = /afs/hcoop.net/common/databases/USERNAME/postgres/'''DBNAME'''
   1. chown -R postgres:postgres "$dir"
   1. chmod -R 0700 "$dir"
   1. fs setacl -dir $dir/'''DBNAME'''/ -acl postgres all
   1. sudo -u postgres createdb -O '''USERNAME''' -D user_'''USERNAME''' '''DBNAME'''

See MySQL for list of things that have to be done for any database (both MySQL and Postgres).

1. Postgres-specific setup

  1. $dir = /afs/hcoop.net/common/databases/USERNAME/postgres

If $dir does NOT exist:

  1. sudo -u postgres psql -c "CREATE USER USERNAME" template1

  2. mkdir -p $dir
  3. chown postgres:postgres "$dir"
  4. fs setacl -dir $dir -acl postgres write
  5. fs setacl -dir $dir -acl databases none # (keep out other databases, just in case)
  6. fs setacl -dir $dir -acl system:backup rl # (should be inherited from parent dir)
  7. sudo -u postgres psql -c "CREATE TABLESPACE user_USERNAME OWNER USERNAME LOCATION '$dir'" template1

When it does, go directly to database creation step:

  1. sudo -u postgres createdb -O USERNAME -D user_USERNAME DBNAME

DaemonAdmin/PostgreSQL (last edited 2012-12-25 21:30:22 by ClintonEbadi)