Questo contenuto non è disponibile nella lingua selezionata.
Chapter 8. 3scale backup and restore
This section provides you, as the administrator of a Red Hat 3scale API Management installation, the information needed to:
- Set up the backup procedures for persistent data.
- Perform a restore from backup of the persistent data.
In case of issues with one or more of the MySQL databases, you will be able to restore 3scale correctly to its previous operational state.
8.1. Prerequisites Copia collegamentoCollegamento copiato negli appunti!
- A 3scale 2.10 instance. For more information about how to install 3scale, see Installing 3scale on OpenShift.
- jq: For extraction or transformation of JSON data.
An OpenShift Container Platform 4.x user account with one of the following roles in the OpenShift cluster:
- cluster-admin
- admin
- edit
A user with an edit cluster role locally binded in the namespace of a 3scale installation can perform backup and restore procedures.
The following sections contain information about persistent volumes, using data sets, setting up the backup procedures for persistent data, as well as restoring system databases and OpenShift secrets:
8.2. Persistent volumes and considerations Copia collegamentoCollegamento copiato negli appunti!
Persistent volumes
- A persistent volume (PV) provided to the cluster by the underlying infrastructure.
- Storage service external to the cluster. This can be in the same data center or elsewhere.
Considerations
The backup and restore procedures for persistent data vary depending on the storage type in use. To ensure the backups and restores preserve data consistency, it is not sufficient to backup the underlying PVs for a database. For example, do not capture only partial writes and partial transactions. Use the database’s backup mechanisms instead.
Some parts of the data are synchronized between different components. One copy is considered the source of truth for the data set. The other is a copy that is not modified locally, but synchronized from the source of truth. In these cases, upon completion, the source of truth should be restored, and copies in other components synchronized from it.
8.3. Using data sets Copia collegamentoCollegamento copiato negli appunti!
This section explains in more detail about different data sets in the different persistent stores, their purpose, the storage type used, and whether or not it is the source of truth.
The full state of a 3scale deployment is stored across the following DeploymentConfig
objects and their PVs:
Name | Description |
---|---|
MySQL database ( | |
Volume for Files | |
Redis database ( | |
Redis database ( |
8.3.1. Defining system-mysql Copia collegamentoCollegamento copiato negli appunti!
system-mysql
is a relational database which stores information about users, accounts, APIs, plans, and more, in the 3scale Admin Console.
A subset of this information related to services is synchronized to the Backend
component and stored in backend-redis
. system-mysql
is the source of truth for this information.
8.3.2. Defining system-storage Copia collegamentoCollegamento copiato negli appunti!
System
can be scaled horizontally with multiple pods uploading and reading said static files, hence the need for a ReadWriteMany (RWX) PersistentVolume
system-storage
stores files to be read and written by the System
component.
They fall into two categories:
-
Configuration files read by the
System
component at run-time - Static files, for example, HTML, CSS, JS, uploaded to system by its CMS feature, for the purpose of creating a Developer Portal
System
can be scaled horizontally with multiple pods uploading and reading said static files, hence the need for a ReadWriteMany (RWX) PersistentVolume
.
8.3.3. Defining backend-redis Copia collegamentoCollegamento copiato negli appunti!
backend-redis
contains multiple data sets used by the Backend
component:
-
Usages: This is API usage information aggregated by
Backend
. It is used byBackend
for rate-limiting decisions and bySystem
to display analytics information in the UI or via API. -
Config: This is configuration information about services, rate-limits, and more, that is synchronized from
System
via an internal API. This is not the source of truth of this information, howeverSystem
andsystem-mysql
is. - Queues: This is queues of background jobs to be executed by worker processes. These are ephemeral and are deleted once processed.
8.3.4. Defining system-redis Copia collegamentoCollegamento copiato negli appunti!
system-redis
contains queues for jobs to be processed in background. These are ephemeral and are deleted once processed.
8.4. Backing up system databases Copia collegamentoCollegamento copiato negli appunti!
The following commands are in no specific order and can be used as you need them to back up and archive system databases.
8.4.1. Backing up system-mysql Copia collegamentoCollegamento copiato negli appunti!
Execute MySQL Backup Command:
oc rsh $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq -r '.items[0].metadata.name') bash -c 'export MYSQL_PWD=${MYSQL_ROOT_PASSWORD}; mysqldump --single-transaction -hsystem-mysql -uroot system' | gzip > system-mysql-backup.gz
oc rsh $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq -r '.items[0].metadata.name') bash -c 'export MYSQL_PWD=${MYSQL_ROOT_PASSWORD}; mysqldump --single-transaction -hsystem-mysql -uroot system' | gzip > system-mysql-backup.gz
8.4.2. Backing up system-storage Copia collegamentoCollegamento copiato negli appunti!
Archive the system-storage
files to another storage:
oc rsync $(oc get pods -l 'deploymentConfig=system-app' -o json | jq '.items[0].metadata.name' -r):/opt/system/public/system ./local/dir
oc rsync $(oc get pods -l 'deploymentConfig=system-app' -o json | jq '.items[0].metadata.name' -r):/opt/system/public/system ./local/dir
8.4.3. Backing up backend-redis Copia collegamentoCollegamento copiato negli appunti!
Backup the dump.rdb
file from redis:
oc cp $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb ./backend-redis-dump.rdb
oc cp $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb ./backend-redis-dump.rdb
8.4.4. Backing up system-redis Copia collegamentoCollegamento copiato negli appunti!
Backup the dump.rdb
file from redis:
oc cp $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb ./system-redis-dump.rdb
oc cp $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb ./system-redis-dump.rdb
8.4.5. Backing up zync-database Copia collegamentoCollegamento copiato negli appunti!
Backup the zync_production
database:
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'pg_dump zync_production' | gzip > zync-database-backup.gz
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'pg_dump zync_production' | gzip > zync-database-backup.gz
8.4.6. Backing up OpenShift secrets and ConfigMaps Copia collegamentoCollegamento copiato negli appunti!
The following is the list of commands for OpenShift secrets and ConfigMaps:
8.4.6.1. OpenShift secrets Copia collegamentoCollegamento copiato negli appunti!
8.4.6.2. ConfigMaps Copia collegamentoCollegamento copiato negli appunti!
oc get configmaps system-environment -o json > system-environment.json oc get configmaps apicast-environment -o json > apicast-environment.json
oc get configmaps system-environment -o json > system-environment.json
oc get configmaps apicast-environment -o json > apicast-environment.json
8.5. Restoring system databases Copia collegamentoCollegamento copiato negli appunti!
Prevent record creation by scaling down pods like system-app
or disabling routes.
Use the following procedures to restore OpenShift secrets and system databases:
8.5.1. Restoring a template-based deployment Copia collegamentoCollegamento copiato negli appunti!
Use the following steps to restore a template-based deployment.
Procedure
- Restore secrets before creating deploying template.:
oc apply -f system-smtp.json
oc apply -f system-smtp.json
Template parameters will be read from copied secrets and configmaps:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.2. Restoring an operator-based deployment Copia collegamentoCollegamento copiato negli appunti!
Use the following steps to restore operator-based deployments.
Procedure
- Install the 3scale operator on OpenShift.
Restore secrets before creating an APIManager resource:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore ConfigMaps before creating an APIManager resource:
oc apply -f system-environment.json oc apply -f apicast-environment.json
oc apply -f system-environment.json oc apply -f apicast-environment.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Deploy 3scale with the operator using the APIManager custom resource.
8.5.3. Restoring system-mysql Copia collegamentoCollegamento copiato negli appunti!
Procedure
Copy the MySQL dump to the system-mysql pod:
oc cp ./system-mysql-backup.gz $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq '.items[0].metadata.name' -r):/var/lib/mysql
oc cp ./system-mysql-backup.gz $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq '.items[0].metadata.name' -r):/var/lib/mysql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Decompress the backup file:
oc rsh $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq -r '.items[0].metadata.name') bash -c 'gzip -d ${HOME}/system-mysql-backup.gz'
oc rsh $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq -r '.items[0].metadata.name') bash -c 'gzip -d ${HOME}/system-mysql-backup.gz'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore the MySQL DB Backup file:
oc rsh $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq -r '.items[0].metadata.name') bash -c 'export MYSQL_PWD=${MYSQL_ROOT_PASSWORD}; mysql -hsystem-mysql -uroot system < ${HOME}/system-mysql-backup'
oc rsh $(oc get pods -l 'deploymentConfig=system-mysql' -o json | jq -r '.items[0].metadata.name') bash -c 'export MYSQL_PWD=${MYSQL_ROOT_PASSWORD}; mysql -hsystem-mysql -uroot system < ${HOME}/system-mysql-backup'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.4. Restoring system-storage Copia collegamentoCollegamento copiato negli appunti!
Restore the Backup file to system-storage:
oc rsync ./local/dir/system/ $(oc get pods -l 'deploymentConfig=system-app' -o json | jq '.items[0].metadata.name' -r):/opt/system/public/system
oc rsync ./local/dir/system/ $(oc get pods -l 'deploymentConfig=system-app' -o json | jq '.items[0].metadata.name' -r):/opt/system/public/system
8.5.5. Restoring zync-database Copia collegamentoCollegamento copiato negli appunti!
Instructions to restore zync-database
depend on the deployment type applied for 3scale.
8.5.5.1. Template-based deployments Copia collegamentoCollegamento copiato negli appunti!
Procedure
Scale down the zync DeploymentConfig to 0 pods:
oc scale dc zync --replicas=0 oc scale dc zync-que --replicas=0
oc scale dc zync --replicas=0 oc scale dc zync-que --replicas=0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the Zync database dump to the
zync-database
pod:oc cp ./zync-database-backup.gz $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq '.items[0].metadata.name' -r):/var/lib/pgsql/
oc cp ./zync-database-backup.gz $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq '.items[0].metadata.name' -r):/var/lib/pgsql/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Decompress the backup file:
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'gzip -d ${HOME}/zync-database-backup.gz'
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'gzip -d ${HOME}/zync-database-backup.gz'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore the PostgreSQL DB backup file:
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'psql -f ${HOME}/zync-database-backup'
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'psql -f ${HOME}/zync-database-backup'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore to the original count of replicas, by replacing
${ZYNC_REPLICAS}
with the number of replicas, in the commands below:oc scale dc zync --replicas=${ZYNC_REPLICAS} oc scale dc zync-que --replicas=${ZYNC_REPLICAS}
oc scale dc zync --replicas=${ZYNC_REPLICAS} oc scale dc zync-que --replicas=${ZYNC_REPLICAS}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.5.2. Operator-based deployments Copia collegamentoCollegamento copiato negli appunti!
Follow the instructions under Deploying 3scale using the operator, in particular Deploying the APIManager custom resource to redeploy your 3scale instance.
Procedure
Store the number of replicas, by replacing
${DEPLOYMENT_NAME}
with the name you defined when you created your 3scale deployment:ZYNC_SPEC=`oc get APIManager/${DEPLOYMENT_NAME} -o json | jq -r '.spec.zync'`
ZYNC_SPEC=`oc get APIManager/${DEPLOYMENT_NAME} -o json | jq -r '.spec.zync'`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Scale down the zync DeploymentConfig to 0 pods:
oc patch APIManager/${DEPLOYMENT_NAME} --type merge -p '{"spec": {"zync": {"appSpec": {"replicas": 0}, "queSpec": {"replicas": 0}}}}'
oc patch APIManager/${DEPLOYMENT_NAME} --type merge -p '{"spec": {"zync": {"appSpec": {"replicas": 0}, "queSpec": {"replicas": 0}}}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the Zync database dump to the
zync-database
pod:oc cp ./zync-database-backup.gz $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq '.items[0].metadata.name' -r):/var/lib/pgsql/
oc cp ./zync-database-backup.gz $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq '.items[0].metadata.name' -r):/var/lib/pgsql/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Decompress the backup file:
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'gzip -d ${HOME}/zync-database-backup.gz'
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'gzip -d ${HOME}/zync-database-backup.gz'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore the PostgreSQL DB backup file:
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'psql -f ${HOME}/zync-database-backup'
oc rsh $(oc get pods -l 'deploymentConfig=zync-database' -o json | jq -r '.items[0].metadata.name') bash -c 'psql -f ${HOME}/zync-database-backup'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restore to the original count of replicas:
oc patch APIManager ${DEPLOYMENT_NAME} --type merge -p '{"spec": {"zync":'"${ZYNC_SPEC}"'}}'
oc patch APIManager ${DEPLOYMENT_NAME} --type merge -p '{"spec": {"zync":'"${ZYNC_SPEC}"'}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.5.3. Restoring 3scale options with backend-redis and system-redis Copia collegamentoCollegamento copiato negli appunti!
By restoring 3scale, you will restore backend-redis
and system-redis
. These components have the following functions:
*backend-redis
: The database that supports application authentication and rate limiting in 3scale. It is also used for statistics storage and temporary job storage. *system-redis
: Provides temporary storage for background jobs for 3scale and is also used as a message bus for Ruby processes of system-app
pods.
The backend-redis
component
The backend-redis
component has two databases, data
and queues
. In default 3scale deployment, data
and queues
are deployed in the Redis database, but in different logical database indexes /0
and /1
. Restoring data
database runs without any issues, however restoring queues
database can lead to duplicated jobs.
Regarding duplication of jobs, in 3scale the backend workers process background jobs in a matter of milliseconds. If backend-redis
fails 30 seconds after the last database snapshot and you try to restore it, the background jobs that happened during those 30 seconds are performed twice because backend does not have a system in place to avoid duplication.
In this scenario, you must restore the backup as the /0
database index contains data that is not saved anywhere else. Restoring /0
database index means that you must also restore the /1
database index since one cannot be stored without the other. When you choose to separate databases on different servers and not one database in different indexes, the size of the queue will be approximately zero, so it is preferable not to restore backups and lose a few background jobs. This will be the case in a 3scale Hosted setup you will need to therefore apply different backup and restore strategies for both.
The `system-redis`component
The majority of the 3scale system background jobs are idempotent, that is, identical requests return an identical result no matter how many times you run them.
The following is a list of examples of events handled by background jobs in system:
- Notification jobs such as plan trials about to expire, credit cards about to expire, activation reminders, plan changes, invoice state changes, PDF reports.
- Billing such as invoicing and charging.
- Deletion of complex objects.
- Backend synchronization jobs.
- Indexation jobs, for example with sphinx.
- Sanitisation jobs, for example invoice IDs.
- Janitorial tasks such as purging audits, user sessions, expired tokens, log entries, suspending inactive accounts.
- Traffic updates.
- Proxy configuration change monitoring and proxy deployments.
- Background signup jobs,
- Zync jobs such as Single sign-on (SSO) synchronization, routes creation.
If you are restoring the above list of background jobs, 3scale’s system maintains the state of each restored job. It is important to check the integrity of the system after the restoration is complete.
8.5.6. Ensuring information consistency between Backend and System Copia collegamentoCollegamento copiato negli appunti!
After restoring backend-redis
a sync of the Config information from System
should be forced to ensure the information in Backend
is consistent with that in System
, which is the source of truth.
8.5.6.1. Managing the deployment configuration for backend-redis Copia collegamentoCollegamento copiato negli appunti!
These steps are intended for running instances of backend-redis
.
Procedure
Edit the
redis-config
configmap:oc edit configmap redis-config
oc edit configmap redis-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Comment
SAVE
commands in theredis-config
configmap:#save 900 1 #save 300 10 #save 60 10000
#save 900 1 #save 300 10 #save 60 10000
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
appendonly
to no in theredis-config
configmap:appendonly no
appendonly no
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Redeploy
backend-redis
to load the new configurations:oc rollout latest dc/backend-redis
oc rollout latest dc/backend-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/backend-redis
oc rollout status dc/backend-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Rename the
dump.rdb
file:oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/dump.rdb ${HOME}/data/dump.rdb-old'
oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/dump.rdb ${HOME}/data/dump.rdb-old'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Rename the
appendonly.aof
file:oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/appendonly.aof ${HOME}/data/appendonly.aof-old'
oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/appendonly.aof ${HOME}/data/appendonly.aof-old'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the backup file to the POD:
oc cp ./backend-redis-dump.rdb $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb
oc cp ./backend-redis-dump.rdb $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Redeploy
backend-redis
to load the backup:oc rollout latest dc/backend-redis
oc rollout latest dc/backend-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/backend-redis
oc rollout status dc/backend-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
appendonly
file:oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli BGREWRITEAOF'
oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli BGREWRITEAOF'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After a while, ensure that the AOF rewrite is complete:
oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli info' | grep aof_rewrite_in_progress
oc rsh $(oc get pods -l 'deploymentConfig=backend-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli info' | grep aof_rewrite_in_progress
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
While
aof_rewrite_in_progress = 1
, the execution is in progress. -
Check periodically until
aof_rewrite_in_progress = 0
. Zero indicates that the execution is complete.
-
While
Edit the
redis-config
configmap:oc edit configmap redis-config
oc edit configmap redis-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Uncomment
SAVE
commands in theredis-config
configmap:save 900 1 save 300 10 save 60 10000
save 900 1 save 300 10 save 60 10000
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
appendonly
to yes in theredis-config
configmap:appendonly yes
appendonly yes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Redeploy
backend-redis
to reload the default configurations:oc rollout latest dc/backend-redis
oc rollout latest dc/backend-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/backend-redis
oc rollout status dc/backend-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.6.2. Managing the deployment configuration for system-redis Copia collegamentoCollegamento copiato negli appunti!
These steps are intended for running instances of system-redis
.
Procedure
Edit the
redis-config
configmap:oc edit configmap redis-config
oc edit configmap redis-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Comment
SAVE
commands in theredis-config
configmap:#save 900 1 #save 300 10 #save 60 10000
#save 900 1 #save 300 10 #save 60 10000
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
appendonly
to no in theredis-config
configmap:appendonly no
appendonly no
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Redeploy
system-redis
to load the new configurations:oc rollout latest dc/system-redis
oc rollout latest dc/system-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/system-redis
oc rollout status dc/system-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Rename the
dump.rdb
file:oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/dump.rdb ${HOME}/data/dump.rdb-old'
oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/dump.rdb ${HOME}/data/dump.rdb-old'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Rename the
appendonly.aof
file:oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/appendonly.aof ${HOME}/data/appendonly.aof-old'
oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'mv ${HOME}/data/appendonly.aof ${HOME}/data/appendonly.aof-old'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the
Backup
file to the POD:oc cp ./system-redis-dump.rdb $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb
oc cp ./system-redis-dump.rdb $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r):/var/lib/redis/data/dump.rdb
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Redeploy
system-redis
to load the backup:oc rollout latest dc/system-redis
oc rollout latest dc/system-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/system-redis
oc rollout status dc/system-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
appendonly
file:oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli BGREWRITEAOF'
oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli BGREWRITEAOF'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After a while, ensure that the AOF rewrite is complete:
oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli info' | grep aof_rewrite_in_progress
oc rsh $(oc get pods -l 'deploymentConfig=system-redis' -o json | jq '.items[0].metadata.name' -r) bash -c 'redis-cli info' | grep aof_rewrite_in_progress
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
While
aof_rewrite_in_progress = 1
, the execution is in progress. -
Check periodically until
aof_rewrite_in_progress = 0
. Zero indicates that the execution is complete.
-
While
Edit the
redis-config
configmap:oc edit configmap redis-config
oc edit configmap redis-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Uncomment
SAVE
commands in theredis-config
configmap:save 900 1 save 300 10 save 60 10000
save 900 1 save 300 10 save 60 10000
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
appendonly
to yes in theredis-config
configmap:appendonly yes
appendonly yes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Redeploy
system-redis
to reload the default configurations:oc rollout latest dc/system-redis
oc rollout latest dc/system-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/system-redis
oc rollout status dc/system-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.7. Restoring backend-worker Copia collegamentoCollegamento copiato negli appunti!
Restore to the latest version of backend-worker
:
oc rollout latest dc/backend-worker
oc rollout latest dc/backend-worker
Check the status of the rollout to ensure it has finished:
oc rollout status dc/backend-worker
oc rollout status dc/backend-worker
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.8. Restoring system-app Copia collegamentoCollegamento copiato negli appunti!
Restore to the latest version of system-app
:
oc rollout latest dc/system-app
oc rollout latest dc/system-app
Check the status of the rollout to ensure it has finished:
oc rollout status dc/system-app
oc rollout status dc/system-app
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.9. Restoring system-sidekiq Copia collegamentoCollegamento copiato negli appunti!
Restore to the latest version of
system-sidekiq
:oc rollout latest dc/system-sidekiq
oc rollout latest dc/system-sidekiq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/system-sidekiq
oc rollout status dc/system-sidekiq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.9.1. Restoring system-sphinx Copia collegamentoCollegamento copiato negli appunti!
Restore to the latest version of
system-sphinx
:oc rollout latest dc/system-sphinx
oc rollout latest dc/system-sphinx
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the rollout to ensure it has finished:
oc rollout status dc/system-sphinx
oc rollout status dc/system-sphinx
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.9.2. Restoring OpenShift routes managed by Zync Copia collegamentoCollegamento copiato negli appunti!
Force Zync to recreate missing OpenShift routes:
oc rsh $(oc get pods -l 'deploymentConfig=system-sidekiq' -o json | jq '.items[0].metadata.name' -r) bash -c 'bundle exec rake zync:resync:domains'
oc rsh $(oc get pods -l 'deploymentConfig=system-sidekiq' -o json | jq '.items[0].metadata.name' -r) bash -c 'bundle exec rake zync:resync:domains'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow