MDC Switch – Configuring Multi-Data Center Types

INTRODUCTION

This post discusses the steps required to configure a “master” data center to a “clone” data center and visa-versa.

If you are not familiar with Multi-Data Center (MDC) implementation and Automated Policy Synchronization (APS) please read the following links:

http://www.ateam-oracle.com/multi-data-center-implemenation-in-oracle-access-manager/

http://www.ateam-oracle.com/automated-policy-synchronization-aps-for-oam-cloned-environment/

MAIN ARTICLE

Use Case: Customer wants to convert an existing data center type from “master” to “clone” and the “clone” data center to a “master”.

One scenario for this use case is where the customer is adding a new data center and wants to designate the data center as the “master” and set the old “master” site as “clone”.  Other scenarios include configuring disaster recovery (DR) sites for example.

 

Implementation

I like to automate things where applicable so after each step below I provide a simple bash script via gitlab link that you can use as a baseline for your environment. Scripting the process is helpful for quickly switching the data center type. There are some caveats that I will be discussing after each step as well.

NOTE: In order for the MDC switch to work, both the “master” and “clone” Weblogic Administration servers must be up and running.

The steps provided below was tested on Oracle Access Manager (OAM) version 11.1.2.3.3 (PS3/BP03) and Weblogic 10.3.6.

  • Step 1) Disable/Delete existing APS agreement.

a) First get the list of agreements:

curl -k -u weblogic:Welcome1 ‘http://dc1.ateam.com:7001/oam/services/rest/_replication/agreements

b) Using the replication agreement ID above, disable the consumer agreement:

curl -u weblogic:Welcome1 -H ‘Content-Type: application/json’ -X PUT ‘http://dc1.ateam.com:7001/oam/service/rest/_replication/201409231329353668’ -d ‘{“enabled”:”false”,”replicaType”:”CONSUMER”}’

c) Disable supplier

curl -u weblogic:Welcome1 -H ‘Content-Type: application/json’ -X PUT ‘http://dec1.ateam.com:7001/oam/service/rest/_replication/201409231329353668’ -d ‘{“enabled”:”false”,”replicaType”:”SUPPLIER”}’

d) Delete both the consumer and supplier agreements

curl -u weblogic:Welcome1 -H ‘Content-Type: application/json’ -X DELETE ‘http://dc1.ateam.com:7001/oam/services/rest/_replication/201409231329353668’

Here is a link to the script:

https://gitlab.com/vkalra/OAMScripts/blob/master/removeAPS.sh

First notice that the curl command requires a user name and password. The user here must be part of the ‘system store’. By default the system store is WebLogic embedded LDAP. For a better understanding check out this link:

http://www.ateam-oracle.com/oam-11g-configuring-data-sources/

Now if you changed the system store after the replication agreement was created you may have issues removing the agreement. You have two options here; one you can revert the system store configuration and try the script again or you can delete the replication agreement directly from the Database.

Below is a screen shot of SQL Developer that shows the value of the replication agreement in the database. From SQL Developer you can delete the replication agreement. Make sure that you remove both entries from the master and clone database. The replication agreement can be found under the AM_REPLICATION_SETTINGS table.

 

OEL6.6 DC1 (APS working with PS3 base and external LDAP) [Running] - Oracle VM VirtualBox_034

  • Step 2) Modify Clone DC

Run wlst script:

connect() (enter parameters to connect)

domainRuntime()

a) Set write enabled flag to ‘true’

setMultiDataCenterWrite(WriteEnabledFlag=”true”)

b) Set to data center to “master”

setMultiDataCenterType(DataCenterType=”Master”)

  • Step 3) Modify Master DC

Run wlst script:

connect() (enter parameters to connect)

domainRuntime()

a) Set data center type to clone

setMultiDataCenterType(DataCenterType=”Clone”)

b) Set write enabled flag to ‘false’

setMultiDataCenterWrite(WriteEnabledFlag=”false”)

Here is a link to the script:

https://gitlab.com/vkalra/OAMScripts/blob/master/mdcSwitch.py

 

  • Step 4) Setup a new replication agreement

a) Make sure replication is enabled

curl -u weblogic:Welcome1 ‘https://dc2-ateam.com:7001/oam/services/rest/_replication/hello’

b) Create the agreement and note the agreement ID

Make sure the host is pointing to the new master site (dc2)

curl -u weblogic:Welcome1 -H ‘Content-Type: application/json’ -X POST ‘http://dc2.ateam.com:7001/oam/services/rest/_replication/setup’ -d  ‘{“name”:”DC22DC1″, “source”:”dc2East”,”target”:”dc1West”,”documentType”:”ENTITY”}’

{“enabled”:”true”,”identifier”:”201510160547491349″,”ok”:”true”,”pollInterval”:”900″,”startingSequenceNumber”:”1761″,”state”:”READY”}

c) Shorten the poll interval for testing purposes

curl -u weblogic:Welcome1 -H ‘Content-Type: application/json’  -X PUT ‘http://dc2.ateam.com:7001/oam/services/rest/_replication/201409040157218184′ -d ‘{“pollInterval”:”60″,”replicaType”:”consumer”}’

Here is the link to the script:

https://gitlab.com/vkalra/OAMScripts/blob/master/createAPS.sh

Once this step is complete, you will need to restart the clone admin and managed srevers as per the documentation:

Once replication agreement is created successfully, the clone/consumer will start polling for changes from next restart of clone AdminServer onwards. The default poll interval for changes is ‘900’ seconds or 15 mins. The poll interval can be changed by executing an edit replication agreement command.

Done!

Add Your Comment