Difference between revisions of "HowTo: Reset Billing PostgreSQL"

From Public PIC Wiki
Jump to navigation Jump to search
Line 7: Line 7:
 
:# <tt>mv /var/lib/pgsql/data /var/lib/pgsql/data.toremove</tt>
 
:# <tt>mv /var/lib/pgsql/data /var/lib/pgsql/data.toremove</tt>
 
:# <tt>/etc/init.d/postgresql initdb</tt>
 
:# <tt>/etc/init.d/postgresql initdb</tt>
:# Create srmdcache user/role:
+
:# Create '''srmdcache''' user / role:
 
:#: <tt>su - postgres</tt>
 
:#: <tt>su - postgres</tt>
 
:#: <tt>createuser srmdcache # Answer yes</tt>
 
:#: <tt>createuser srmdcache # Answer yes</tt>
Line 15: Line 15:
  
  
 +
* Now you've a fresh new DB and all old data in the backup.
 +
: If everything looks as you like you can now remove the old db:
 +
rm -rf /var/lib/pgsql/data.toremove
  
Now you've a fresh new DB and all old data in the backup.
+
* It is necessary to re-synchronize the '''''streaming replica''''' of the database. O
 
+
:* The replica is running in dcns05.pic.es  
If everything looks as you like you can now remove the old db:
+
::* More information under http://wiki.pic.es/index.php/HowTo:_PNFS_backup_in_PITR
 
 
rm -rf /var/lib/pgsql/data.toremove
 
 
 
 
 
It is necessary to resyncronize the Streaming replica of the database. On 9/6/2011 the replica is running in dcns05.pic.es More information under http://wiki.pic.es/index.php/HowTo:_PNFS_backup_in_PITR
 

Revision as of 07:45, 7 August 2015

  • No scheduled downtime is required because service is unaffected (accounting is affected).
  • Steps
  1. Connect to dcip.pic.es (where the billing database resides)
  2. Make a backup of the DB (or pick one from /DBbackups and save for future references). Bacula should be keeping track of this directory...
  3. /etc/init.d/dcache httpd stop
  4. /etc/init.d/postgresql stop
  5. mv /var/lib/pgsql/data /var/lib/pgsql/data.toremove
  6. /etc/init.d/postgresql initdb
  7. Create srmdcache user / role:
    su - postgres
    createuser srmdcache # Answer yes
    createdb -U srmdcache billing
    exit
  8. /etc/init.d/dcache httpd start


  • Now you've a fresh new DB and all old data in the backup.
If everything looks as you like you can now remove the old db:
rm -rf /var/lib/pgsql/data.toremove
  • It is necessary to re-synchronize the streaming replica of the database. O
  • The replica is running in dcns05.pic.es