Manual PRI and RSS switch-over
Posted in 2023
Dennis Melnikov asked how to swap the primary and an RSS secondary. Art Kagel advised promoting the RSS to HDR and using hdrmkpri.sh and hdrmksec.sh; Mike Walker and Andreas Legner offered simpler variants. Melnikov finished with a tested sequence in his QA landscape: onmode -d secondary, swap with the two scripts, then onmode -d RSS.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
Hi, We have two servers setup, PRI and RSS. How to switch their roles? I suspect the Admin Guide omits some significant steps. ------------------------------ Sincerely, Dennis ------------------------------
Dennis:
The first step is to promote the RSS to HDR because an RSS cannot directly become a primary. Once that's done, there are two scripts in $INFORMIXDIR/bin that are used to swap roles. Once the original primary has been made the HDR secondary you can change it do RSS. The two scripts are:
/opt/informix/infmx/bin/hdrmkpri.sh -- This is run on the HDR secondary to make it the new primary
/opt/informix/infmx/bin/hdrmksec.sh -- This is run on the original primary to make it the new HDR secondary
Running them tells you what to do:
$ /opt/informix/infmx/bin/hdrmkpri.shThis script changes the type of the Data replication server to Primary.
Steps to switch server types in an HDR pair:
Instance A (currently Primary) Instance B (currently Secondary)
------------------------------ --------------------------------
1] onmode -ky (server should be up)
2] hdrmkpri.sh <primary_server_name>
3] hdrmksec.sh <secondary_server_name>
(now a Secondary server) 4] oninit (now a Primary server)
WARNING: Please ensure the following before proceeding further:
1] the paired database server is OFFLINE,
2] the current database server is up, and
3] the current database server has Data replication turned off.
Not doing so, shall make the two database servers in the
Data replication pair out-of-sync, and shall require
re-establishing the pair.
Press return to continue...
The note about "Data replication" is referring to ER.
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
------------------------------
Art:
Please, is it a correct sequence for the first step, to promote the RSS to HDR secondary?
PRI> onmode -u
RSS> onmode -ky
RSS> oninit -PHY
PRI> onmode -d primary RSS
RSS> onmode -d secondary PRI
------------------------------
Sincerely,
Dennis
------------------------------
Much easier...as long as you don't
already
have an HDR (i.e. it is ONLY a Primary and RSS).
Just run that last command on the RSS. Both instances can remain online.
(on the RSS instance) onmode -d secondary <primary_name>
That should be it.
As a quick note, I have
sometimes
found it necessary to delete the RSS from the Primary to avoid issues later on, with (on the Primary) onmode -d delete RSS <rss_name>
------------------------------
Mike Walker
xDB Systems, Inc
www.xdbsystems.com
------------------------------
Dennis:
OK, so, in reality an RSS secondary does nit need a primary but can work with a standalone as its "primary". So you could convert the RSS to a standalone to master the other server. The problem is that the current primary is either in primary mode or standalone mode and my not sync to the former RSS
You can try it does not always work which is why i recommended converting to HDR first.If it fails you will have to restore or ifxclone from the former RSS to recreate the new RSS. Here are the steps:
on the primary: onmode -ky
on the RSS: onmode - d standalone
on the original primary: oninit -PHY
then: onmode -d RSS other's_name
on the former RSS: onmode -d add RSS old_prime_name
Art
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
------------------------------
Art, What is a less risky way to convert an HDR secondary to a RSS? ------------------------------ Sincerely, Dennis ------------------------------
Dennis:
I'm confused. I thought you were trying to swap roles between your primary and an RSS secondary?
As for how to convert an HDR secondary to an RSS secondary, you just have to run:
On the primary:
onmode -d add RSS <secondary>On the HDR secondary:
onmode -d RSS <primary>If you will not need any HDR secondaries running, you can convert the primary to a standalone server (RSS does not need its "primary" to be in "primary mode":
on the primary:
onmode -d standardArt
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
------------------------------
Oh, just note, while an HDR does not need this, RSS secondaries must have LOG_INDEX_BUILDS set, so you may have to set that before changing the secondary's mode:
onmode -wf LOG_INDEX_BUILDS=1
------------------------------Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
------------------------------
Hi Art,
that 'onmode -d add RSS <rss_name>' on primary isn't even needed - it would occur implicitly when running 'onmode -d RSS <pri_name>' on the HDR secondary.
It would even be safer to do it this way; I think I remember ambiguous behavior and hangs when first adding the same server as an RSS that already is connected as HDR secondary.
Cheers,
Andreas
------------------------------
Andreas Legner
------------------------------
Finally, that's a sequence I used in my QA landscape:
Start: idspri (Primary), idssec (RSS)
Finish: idspri (RSS), idspri (Primary)
Turn RSS into HDR secondary
`idssec> onmode -d secondary idspri`
Swap HDR roles
`idspri> onmode -ky`
`idssec> hdrmkpri.sh`
`idspri> hdrmksec.sh idssec`
`idssec> oninit`
Turn new HDR secondary into RSS
`idspri> onmode -d RSS idssec`
It's likely the shortest path possible.
------------------------------
Sincerely,
Dennis
------------------------------