Difference between revisions of "HowTo: Reset Billing PostgreSQL"
Jump to navigation
Jump to search
(Created page with "* No scheduled downtime is required because service is unaffected (accounting is affected). * Steps :# Connect to dcip.pic.es (where the billing database resides) :# Make a ba...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
:# Connect to dcip.pic.es (where the billing database resides) | :# Connect to dcip.pic.es (where the billing database resides) | ||
:# Make a backup of the DB (or pick one from /DBbackups and save for future references). Bacula should be keeping track of this directory... | :# Make a backup of the DB (or pick one from /DBbackups and save for future references). Bacula should be keeping track of this directory... | ||
− | :# /etc/init.d/dcache httpd stop | + | :# <tt>/etc/init.d/dcache httpd stop</tt> |
− | :# /etc/init.d/postgresql stop | + | :# <tt>/etc/init.d/postgresql stop</tt> |
− | :# mv /var/lib/pgsql/data /var/lib/pgsql/data.toremove | + | :# <tt>mv /var/lib/pgsql/data /var/lib/pgsql/data.toremove</tt> |
− | :# /etc/init.d/postgresql initdb | + | :# <tt>/etc/init.d/postgresql initdb</tt> |
− | :# Create srmdcache user/role: | + | :# Create '''srmdcache''' user / role: |
− | + | :#: <tt>su - postgres</tt> | |
− | + | :#: <tt>createuser srmdcache # Answer yes</tt> | |
− | + | :#: <tt>createdb -U srmdcache billing</tt> | |
− | + | :#: <tt>exit</tt> | |
− | :# /etc/init.d/dcache httpd start | + | :# <tt>/etc/init.d/dcache httpd start</tt> |
+ | * 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 | |
− | + | ::* More information under http://wiki.pic.es/index.php/HowTo:_PNFS_backup_in_PITR | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | It is necessary to |
Latest revision as of 07:45, 7 August 2015
- No scheduled downtime is required because service is unaffected (accounting is affected).
- Steps
- Connect to dcip.pic.es (where the billing database resides)
- Make a backup of the DB (or pick one from /DBbackups and save for future references). Bacula should be keeping track of this directory...
- /etc/init.d/dcache httpd stop
- /etc/init.d/postgresql stop
- mv /var/lib/pgsql/data /var/lib/pgsql/data.toremove
- /etc/init.d/postgresql initdb
- Create srmdcache user / role:
- su - postgres
- createuser srmdcache # Answer yes
- createdb -U srmdcache billing
- exit
- /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
- More information under http://wiki.pic.es/index.php/HowTo:_PNFS_backup_in_PITR