IBM i Metro Mirror Commands

  • Home
  • /
  • Blog
  • /
  • IBM i Metro Mirror Commands

March 2, 2022

What is IBM i Metro Mirror?

IBM i Metro Mirror copies data synchronously between storage systems. You use it for high availability and disaster recovery. It ensures zero data loss when your primary site decides to take an unscheduled nap. PowerHA SystemMirror handles the heavy lifting. It works best for sites within 300 kilometers, unless you enjoy latency that feels like waiting for dial-up internet.

Key features:

  • Writes data to both source and target before giving you the thumbs-up.
  • Uses Independent Auxiliary Storage Pool (IASP) to store your precious data.
  • Switches to the target system faster than you can say “server crash.”
  • Configured with CL commands like CRTCRG and STRASPSSN.

Example: A grocery chain replicates its stock database across two data centers 80 kilometers apart. If the primary site goes offline, the secondary jumps in like a backup dancer, no data missed. Keep latency under 5 milliseconds, or it’ll feel like your system’s stuck in molasses.

Practical steps:

  • Create a cluster: Run ADDCLUNODE CLUSTER(PWRHA_CLU) NODE(DEMOFC (‘10.10.10.1’)).
  • Set up IASP: Run CRTDEVASP DEVD(IASP_LUN) RSRCNAME(IASP_LUN).
  • Start replication: Run STRASPSSN SSN(ASPSSN1) TYPE(*METROMIR).
  • Check status: Run DSPASPCPYD ASPCPY(MYCOPY) OUTPUT(*PRINT).

Test your setup in a lab, unless you want your production system to throw a surprise party.

Use DSPASPSTS to confirm IASP status after switches.

IBM i Metro Mirror Commands

Set Up Your Cluster

Start with cluster creation. Use these commands to build the foundation.

Add nodes to your cluster. Run ADDCLUNODE CLUSTER(PWRHA_CLU) NODE(DEMOFC (‘10.10.10.1’)).

Add nodes to a device domain. Run ADDDEVDMNE CLUSTER(PWRHA_CLU) DEVDMN(PWRHA_DMN) NODE(DEMOFC).

Create Your IASP

Configure independent auxiliary storage pools. These hold your replicated data.

Create the device ASP. Run CRTDEVASP DEVD(IASP_LUN) RSRCNAME(IASP_LUN).

Configure the ASP device. Run CFGDEVASP ASPDEV(IASP_LUN) ACTION(*CREATE) UNITS(DD026 DD025 DD024 DD023).

Balance data across disks. Run STRASPBAL ASPDEV(IASP1) OPTION(*BALANCE).

Verify configuration. Run VRYCFG CFGOBJ((ASPDEV IASP1)).

Create Cluster Resource Group

Define the CRG for failover.

Run CRTCRG CLUSTER(PWRHA_CLU) CRG(PWRHA_CRG3) CRGTYPE(DEV) EXITPGM(NONE) USRPRF(*NONE) RCYDMN((DEMOFC *PRIMARY *LAST SITE1) (DEMOHA *BACKUP *LAST SITE1)).

Add ASP Copy Descriptions

Describe source and target copies.

Run ADDASPCPYD ASPCPY(ASPCPYD1) ASPDEV(IASP1) CRG(PWRHA_CRG1) SITE(SITE1) STGHOST(‘10.10.10.10’) USER(DS_USER) PASSWORD(DS_PASSWORD) LOCATION(NODE1) LUN(‘IBM.2107-75AY032’ ‘A010-A013’).

Start Your ASP Session

Link copies for replication.

Run STRASPSSN SSN(ASPSSN1) TYPE(METROMIR) ASPCPY(ASPCPYD1 ASPCPYD2) FLASHTYPE(NOCOPY) PERSISTENT(*NO).

Manage Your Session

Change session options as needed.

Suspend or resume. Run CHGASPSSN SSN(ASPSSN1) OPTION(*SUSPEND).

Detach copies. Run CHGASPSSN SSN(SVC_GM) OPTION(*DETACH).

Reattach copies. Run CHGASPSSN SSN(SVC_GM) OPTION(REATTACH) SNDINQMSG(YES).

End the session. Run ENDASPSSN SSN(IASP1SSN).

Display session details. Run DSPSVCSSN SSN(SVC_MM) OUTPUT(*PRINT).

Switch Over

Perform planned switches.

Change CRG primary. Run CHGCRGPRI CLUSTER(PWRHA_CLU) CRG(PWRHA_CRG3).

Switch PPRC. Run SWPPRC ENVIRONMENT(TOOLKIT) SWITCHTYPE(UNSCHEDULED) TYPE(MMIR) AUTOREPLICATE(DFT) AUTOVARYON(YES) SWITCHPAUSEDMMIR(*NO).

Check PPRC readiness. Run CHKPPRC ENVIRONMENT(TOOLKIT).

Monitor and Verify

Display ASP copy. Run DSPASPCPYD ASPCPY(MYCOPY) OUTPUT(*PRINT).

Work with copy environments. Run WRKCSE.

Run DS commands. Run RUNDSCMD COLUMNPOSITION(1) EXPECTEDVALUE(‘CMUC00234I’).

You can set up a basic Metro Mirror in 10 steps with these commands. Obviously (duh!) test in a lab first. Use DSPASPSTS to check IASP status after switches.

NickLitten


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits.

Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day.

Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Subscribe NOW
7-day free trial

Take This Course with ALL ACCESS

Unlock your Learning Potential with instant access to every course and all new courses as they are released.
 [ For Serious Software Developers only ]

Online Learning for IBM i Software Technology Professionals

“The more that you read, the more things you will know. The more that you learn, the more places you’ll go.” – Dr. Seuss

>