How to revert the patch in Diyotta Components ?
How to revert the patch in Diyotta Components ?
Diyotta Allows you to downgrade your version to any older version.
Note: This process will work only If user opted to take backup during upgrade process.
To Downgrade any instance to older version, user should have the backup files of controller, agent and metadata. These backup files are getting generated during upgrade process. Default Locations of the backup files are:
Controller backup: $DIYOTTA_HOME/controller/backups/controller_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz
Agent Backup: $DIYOTTA_HOME/agent/backups/agent_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz
Metadata Backup: $DIYOTTA_HOME/controller-repo/backups/direpdb_<OLDVERSION>_<TIMESTAMP>.tar.gz
Controller and Agent backup files does not contain “controller/app” and “agent/app” folders. Also, any Hadoop extension Jars are excluded from backup file.
Downgrade process is same of both Embedded and External Postgres Metadata. Just need to make sure the Postgres instance is running during downgrade process.
This process will downgrade controller and controller-broker both components.
Login as controller user to the Linux host and stop the controller:
# $DI_HOME/bin/servershutdown.sh
Copy the backup file from “$DIYOTTA_HOME/controller/backups” folder to “$DIYOTTA_HOME”. Backup file contains all the files with relative paths. That’s why it’s necessary to move backup file to $DIYOTTA_HOME Folder.
# cd $DIYOTTA_HOME/controller/backups/
# cp controller_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz $DIYOTTA_HOME
# cd $DIYOTTA_HOME
Backup file contains all the files with relative paths, so extracting backup files from DIYOTTA_HOME will replace all the files inside controller.
# cd $DIYOTTA_HOME
# tar -zxvf controller_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz
Once tar file extracted successfully, User can verify by checking version.txt file. This file will show the version which is extracted.
# cat $DI_HOME/server/tomcat/webapps/ROOT/version.txt
(Note: its recommended to take full Metadata backup before running this process.)
Downgrading metadata for Embedded and External is same. In this process, user need to import old PG backup in existing database.
If user want to downgrade embedded metadata, Just make sure that database is up and running before starting process. To start only Embedded Metadata, run below command
# $DIYOTTA_HOME/controller-repo/startdb.sh
Note: Skip Above Step if controller is configured on External Metadata
Copy Metadata backup file from “controller-repo/backups” folder to DIYOTTA_HOME path.
# cd $DIYOTTA_HOME/controller-repo/backups/
# cp direpdb_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz $DIYOTTA_HOME
# cd $DIYOTTA_HOME
Its mandatory to drop existing “direp” schema from metadata before downgrade. Otherwise restore process will give error. Schema “direp” is default schema of Diyotta Metadata. To Drop schema, follow below process
- Connect to Metadata through CLI
CLI utilities are present in controller-repo folder. User can connect to both external and embedded metadata from controller-repo/bin folder.
# cd $DIYOTTA_HOME/controller-repo/bin
# ./psql -h <PG_HOST> -p PG_PORT -U <PG_USER> -d <DB>
- Drop Schema
Run below command to drop schema
drop schema direp cascade;
- Exit from PG CLI
Once schema is dropped successfully, run quit command to come out from cli.
Diyotta Controller contains PG restore script which will import the backup file to Metadata. This script is always present in “controller/bin” folder. To restore metadata from follow below steps:
# cd $DIYOTTA_HOME/controller/bin
# ./pgrestore.sh -f $DIYOTTA_HOME/direpdb_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz
Once the restore script completed successfully, we can connect to PG and verify the metadata version. It should show the details of older version.
# cd $DIYOTTA_HOME/controller-repo/bin
# ./psql -h <PG_HOST> -p PG_PORT -U <PG_USER> -d <DB>
Run below query to check Metadata version:
# select * from rep;
Its Output will show the details of metadata: like below
After Successful restore, stop embedded database using below command:
# cd $DIYOTTA_HOME/controller-repo/
# ./stopdb.sh
Agent downgrade process is like controller downgrade process.
Login as Agent user to the Linux host and stop the controller:
# $DI_FLA_HOME/bin/agentshutdown.sh
In a case of default agent, use below command
# $DIYOTTA_HOME/agent/bin/agentshutdown.sh
Copy the backup file from “agent/backups” folder to “$DIYOTTA_HOME”. Backup file contains all the files with relative paths. That’s why its necessary to move backup file to $DIYOTTA_HOME Folder.
# cd $DIYOTTA_HOME/agent/backups/
# cp agent_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz $DIYOTTA_HOME
# cd $DIYOTTA_HOME
Backup file contains all the files with relative paths, so extracting backup files from DIYOTTA_HOME will replace all the files inside controller.
# cd $DIYOTTA_HOME
# tar -zxvf agent_<OLDVERSION>_backup_<TIMESTAMP>.tar.gz
Once tar file extracted successfully, User can verify by checking version.txt file. This file will show the version which is extracted.
# cat $DIYOTTA_HOME/agent/version.txt