Skip to main content
Level 4
Nov 23, 2016 6:22 AM UTC
Solved

CQ 5.56 How to identify Master or slave

Hi,

I am using CQ 5.56 as clustering running as master and slave.

Is there any api to identity which is master or salve?

 

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Nov 23, 2016 10:30 AM UTC

Hi 

Please have a look at this article:-

Link:-http://therealcq.blogspot.in/2014/05/cq5aem-how-do-i-detect-from.html

// How do I detect from a SlingServlet whether it is running on the Master or Slave instance 

Basically you can add a message in a log like this: 

    final String isMaster = repository.getDescriptor("crx.cluster.master");
    return StringUtils.isNotBlank(isMaster) && Boolean.parseBoolean(isMaster);

I hope this would help you.

~kautuk

Kautuk Sahni

2 replies

kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Nov 23, 2016 10:30 AM UTC

Hi 

Please have a look at this article:-

Link:-http://therealcq.blogspot.in/2014/05/cq5aem-how-do-i-detect-from.html

// How do I detect from a SlingServlet whether it is running on the Master or Slave instance 

Basically you can add a message in a log like this: 

    final String isMaster = repository.getDescriptor("crx.cluster.master");
    return StringUtils.isNotBlank(isMaster) && Boolean.parseBoolean(isMaster);

I hope this would help you.

~kautuk

Translate
Kautuk Sahni
joerghoh
Adobe Employee
Adobe Employee
Nov 23, 2016 8:34 PM UTC

Please check [1] for some hints how to do that (including sample code).

Jörg

[1] https://helpx.adobe.com/experience-manager/kb/create-cluster-aware-osgi-service.html

Translate