Difference between revisions of "RucioUpdateToNewVersion"

From GridPP Wiki
Jump to: navigation, search
(Instructions To Update Rucio)
(Pre-steps)
Line 1: Line 1:
 
== Instructions To Update Rucio ==
 
== Instructions To Update Rucio ==
  
===Pre-steps===
+
=== Pre-steps ===
 +
 
 +
# Get snapshots for VMs
 +
* Edit /etc/sysconfig/network-scripts/ifcfg-eth0 commenting out HWADDR
 +
* Take snapshots
  
 
# Using the daily backup of DB02 move this to DB03 and apply the database
 
# Using the daily backup of DB02 move this to DB03 and apply the database
Line 28: Line 32:
 
This process will take some time (between 40-60 mins)
 
This process will take some time (between 40-60 mins)
  
* Update the database -> takes roughly an hour
+
=== Upgrade Steps ===
* Connect alembic to database
+
 
 +
==== Update the database -> takes roughly an hour ====
 +
 
 +
* Connect alembic and rucio.cfg to database
 
  cd /opt/rucio
 
  cd /opt/rucio
 
  vi alembic.ini
 
  vi alembic.ini
 
Edit the path to the database
 
Edit the path to the database
 +
cd etc
 +
vi rucio.cfg
 +
Edit database default to the database
 +
 
* Run alembic for a few upgrades
 
* Run alembic for a few upgrades
 +
cd /opt/rucio
 
  alembic upgrade c0937668555f
 
  alembic upgrade c0937668555f
 
  alembic upgrade 8ea9122275b1
 
  alembic upgrade 8ea9122275b1
Line 40: Line 52:
 
* If this failed find instructions
 
* If this failed find instructions
 
  alembic upgrade d23453595260 --sql
 
  alembic upgrade d23453595260 --sql
* Run each instruction manually
+
* Run each instruction manually on the database from the database server
 
* Upgrade to head
 
* Upgrade to head
 
  alembic upgrade head
 
  alembic upgrade head

Revision as of 11:06, 27 August 2021

Instructions To Update Rucio

Pre-steps

  1. Get snapshots for VMs
  • Edit /etc/sysconfig/network-scripts/ifcfg-eth0 commenting out HWADDR
  • Take snapshots
  1. Using the daily backup of DB02 move this to DB03 and apply the database
  • Find the latest backup
grep  Transferred  /var/log/atlasbackup/atlasbackup.log | tail -1
  • Retrieve the backup
[root@ruciodb02 ~]# tape -r csfserv <BackUpNumber> <location for backup>/tape.<BackUpNumber>
  • Move the backup to DB03 using SCP if backup not availale
[root@ruciodb02 ~]# scp -i <Path/To/PrivateKey> /mnt/backfs/ruciodb02_db_backup_202108241613 root@ruciodb03.gridpp.rl.ac.uk:/var/lib/pgsql
  • Move the tape backup to DB03
[root@ruciodb02 ~]# scp -i <Path/To/PrivateKey> <<location for backup>/tape.<BackUpNumber> root@ruciodb03.gridpp.rl.ac.uk:/var/lib/pgsql
  • Unpack the tape backup
[root@ruciodb03 ~]# tar xf tape.<BackUpNumber>
  • Find the database name on DB03
[root@ruciodb03 ~]# su postgres
bash-4.2$ psql
postgres-# \c 
You are now connected to database "<DB_Name>" as user "postgres".
postgres-# \q
bash-4.2$
  • Drop the current database
bash-4.2$ dropdb <DB_Name>
  • Create a new databse and apply backup
bash-4.2$ createdb -T template0 <DB_Name>
psql  -v  -d <DB_Name> -f  <Path/To/Backup>/ruciodb02_<ID> 

This process will take some time (between 40-60 mins)

Upgrade Steps

Update the database -> takes roughly an hour

  • Connect alembic and rucio.cfg to database
cd /opt/rucio
vi alembic.ini

Edit the path to the database

cd etc
vi rucio.cfg

Edit database default to the database

  • Run alembic for a few upgrades
cd /opt/rucio
alembic upgrade c0937668555f
alembic upgrade 8ea9122275b1
  • Attempt upgrade to d23d23453595260
alembic upgrade d23453595260 --sql
  • If this failed find instructions
alembic upgrade d23453595260 --sql
  • Run each instruction manually on the database from the database server
  • Upgrade to head
alembic upgrade head