Disaster Recovery for Oracle Analytics Server on Oracle Cloud Using RCU Schemas Replication and File System Replication with Rsync

March 19, 2024 | 6 minute read
Veera Raghavendra Rao Koka
Consulting Member of Technical Staff
Text Size 100%:

REDWOOD

A previous blog described how to use snapshot replication to implement disaster recovery for Oracle Analytics Server (OAS) on Oracle Cloud Infrastructure (OCI).

This blog describes how to configure OAS disaster recovery on OCI using the Database Cloud Service (DBCS) Repository Creation Utility (RCU) schema replication and file system replication using rsync.

Architecture

OASDR_RCU_Rsync1

This diagram shows OAS disaster recovery (DR) architecture and configuration across multiple OCI regions.

For details on how to deploy OAS on Oracle Cloud, and configure RCU schemas DBCS instance, a load balancer, and an OAS DR environment, refer to our recent blog: Disaster Recovery of Oracle Analytics Server on Oracle Cloud using RCU Schemas and Block Volume Replication, which desribes how to configure OAS DR using block volume and RCU DB replication.

This blog explains how to use rsync for the OAS file system replication (instead of using OCI cross-region block volume replication). Follow all the steps in the above blog except for the sections that describe block volume creation and replication.

File System Replication Between Two Compute Instances in Different Regions Using Rsync

In this example, there are two OAS environments with RCU DBCS instances, in two different OCI regions (a primary region a DR region). For example, Ashburn and Phoenix.

Prerequisites

  • Rsync must be installed on the OAS compute instances.
  • The user who installed OAS (that is, oracle), must have SUDO privileges without a password prompt.
  • SSH trust must be set up between the source and target OAS servers for the user who installed OAS (that is, oracle).
  • Dynamic Routing Gateway (DRG) and Remote Peering Connection (RPC) must be configured between the primary and DR OAS compute instance’s VCN.
  • When configuring DRG and RPC on the primary and DR OAS’s VCN, the CIDR ranges must not overlap.
  • The security list must be configured for SSH access at 22 port numbers between the primary and DR OAS’s VCN and its subnets.

On the OCI Primary Region (Ashburn)

Log in to the primary OAS instance as the oracle user.

Generate the SSH key for rsync.

  • ssh-keygen -t rsa -b 4096 -N "" -f /home/oracle/.ssh/rsync_rsa
  • OASDR_RCU_Rsync2

On the primary OAS compute instance, create the file: /home/oracle/.ssh/authorized_keys

  • touch /home/oracle/.ssh/authorized_keys
  • chmod 0600 /home/oracle/.ssh/authorized_keys

Copy the public key's content (/home/oracle/.ssh/rsync_rsa.pub) and save it to the file /home/oracle/.ssh/authorized_keys on the primary OAS compute instance.

  • cat /home/oracle/.ssh/rsync_rsa.pub > /home/oracle/.ssh/authorized_keys

On the OCI Secondary Region (Phoenix)

  1. Log in to the DR OAS instance as the oracle user.
  2. Create the SSH trust between the primary and DR OAS compute instances.
  3. Create a .ssh folder under /home/oracle on the DR OAS compute instance.
  4. Copy the public key (/home/oracle/.ssh/rsync_rsa.pub), the private key (/home/oracle/.ssh/rsync_rsa) and the authorized_keys (/home/oracle/.ssh/authorized_keys) from the primary OAS compute instance to the DR OAS compute instance folder: /home/oracle/.ssh folder
  5. Set the file permissions of the public key, private key, and authorized_keys to 0644, 0600, and 0600, respectively, as [Public – 0644, Private – 0600, and authorized_keys – 0600].

chmod 0644 /home/oracle/.ssh/rsync_rsa.pub

chmod 0600 /home/oracle/.ssh/rsync_rsa

chmod 0600 /home/oracle/.ssh/authorized_keys

Test SSH Access

Since the primary OAS and DR OAS are in two different OCI regions, and you configured DRG and RPC between the two VCNs and subnets, you can test the SSH access from one instance to another and vice versa.

Test SSH access to the DR OAS compute instance from the primary OAS compute instance

ssh -i /home/oracle/.ssh/rsync_rsa oracle@<IP_DR_OAS_Compute_Instance>

Test SSH access to the primary OAS compute instance from the DR OAS compute instance

ssh -i /home/oracle/.ssh/rsync_rsa oracle@<IP_Primary_OAS_Compute_Instance>

Define File System Folders for Rsync

On OAS (deployed on OCI Marketplace, OCI Compute, On-Premises), you need the JAVA_HOME, Oracle_Home, and Domain_Home folders to be synchronized between the primary and DR compute instances.

If you have OAS deployments with their respective JAVA_HOME and ORACLE_HOME, and have the same patchset updates installed across the two OAS environments, you need to sync only the Domain_Home folder.

In an OAS clustered environment, you may need to sync the SDD folder where the cluster nodes share the BI components and cache configurations.

Push and Pull Approaches with Rsync

When you use the commands below to sync a local folder on the primary OAS instance to the remote DR OAS instance, this sync process is called a push operation.

rsync -a /u01/data oracle@<IP_DR_OAS_Compute_Instance>:/u01/data

When you use the commands below to sync a remote folder on the primary OAS instance to a local DR OAS instance, this sync process is called a pull operation.

rsync -a oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Add compression during the sync process:

rsync -az oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Add a progress bar during the sync process (-P or --progress):

rsync -azP oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Define exclude files or directories during the sync process:

rsync -azP --exclude=<pattern_to_exclude> oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Delete files on the destination if the source files are deleted:

rsync -azP --delete --exclude=<pattern_to_exclude> oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Output a verbose set of statistics on the file transfer:

rsync -azP --delete --stats --exclude=<pattern_to_exclude> oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Perform a dry-run rsync:

rsync -azPn --delete --stats --exclude=<pattern_to_exclude> oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Run rsync with SSH access:

rsync -azPn --delete --stats -e "ssh -i /home/oracle/.ssh/rsync_rsa" --exclude=<pattern_to_exclude> oracle@<IP_Primary_OAS_Compute_Instance>:/u01/data /u01/data

Automation

You can create a custom script to run rsync using all these commands and options.

You can also use logrotate to manage logs generated by the rsync script.

Script (rsync_fs_sync.sh)

#!/bin/bash
# Rsync script to automate the file system sync between two OAS compute instances across different OCI regions.
# Run this script from the /home/oracle/.ssh folder of the DR OAS instance.
##########################
# Enter the variable values
##########################
Primary_OAS_IP_Address=10.0.0.203
Sync_Primary_Folder=/u01/data
Sync_DR_Folder=/u01/data

# Exclude files or directories from rsync
echo "/u01/data/domains/bi/servers/AdminServer/logs
/u01/data/domains/bi/servers/bi_server1/logs
/u01/data/domains/bi/servers/*/logs" > exclude-files.txt

echo "Starting file system sync between OAS instances across primary and DR OCI regions"

#Run the command below on the DR OAS instance to sync the/u01/data folder from the primary OAS instance to the DR OAS instance

sudo rsync -aviuhncAX --delete --stats --progress -e "ssh -i /home/oracle/.ssh/rsync_rsa" --exclude-from=exclude-files.txt oracle@${Primary_OAS_IP_Address}:${Sync_Primary_Folder} ${Sync_DR_Folder}

rm -rf exclude-files.txt

Rsync Synchronization Frequency

You can define the frequency of the rsync between the primary and DR OAS instances.

Run the automation scripts every 6 hours, 12 hours, or daily before business hours start. This depends on your business requirement for DR management.

To run the automation script frequently, create a cron job and run the rsync automation script from the DR OAS compute instance.

crontab -e

0 */6 * * * /home/oracle/.ssh/rsync_fs_sync.sh

Explore More

The OAS on OCI compute instance, its block volume, DBCS RCU, and ADW data source can be automatically replicated from the primary OCI region to the DR OCI region using the OCI full stack disaster recovery feature. See Overview of Full Stack Disaster Recovery.

REDWOOD

 

Veera Raghavendra Rao Koka

Consulting Member of Technical Staff

Oracle Analytics Service Excellence, CEAL Team


Previous Post

Disaster Recovery for Oracle Analytics Server on Oracle Cloud Using RCU Schemas and Block Volume Replication

Next Post


Time Travel Made Easy: Working with Time Series Functions in Oracle Analytics

Luis Rivas | 5 min read