cancel
Showing results for 
Search instead for 
Did you mean: 

How to ensure only one node runs the LDAP sync?

jonnyg
Confirmed Champ
Confirmed Champ
In our environment, all of our deployments are automated, and we at present have no way of distinguishing one node from another.
We will probably find a way to do this, but it won't be completely failsafe.

I ask this to see that we can have just one server run the LDAP sync.
Testing in 1.4.2, we see that nodes will run the LDAP sync simultaneously; there is no database lock to prevent others from running. This doesn't seem to be a bad thing, but we do want to avoid having these run in parallel.

One possible solution – suppose each node were to register on startup with its url (host/port/context) in the database… a function could then check whether the node we're running on is the "first" one (either by registration timestamp, or other calculation) – and then only this node will run this.

Is this possible today?
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
> but we do want to avoid having these run in parallel.

Indeed the simplest way is disabling ldap sync on the other nodes  (using the ldap.synchronization.full.enabled and ldap.differential.full.enabled) properties on the other nodes.

However, if you can't distinguish nodes from each other … that's not going to work … I would indeed go for the route you suggest there: have something that all nodes can write to globally and to the 'selecting the master node' via that data. Could use the database for it … that will do the trick for sure or maybe something like Hazelcast. And then triggers the ldap sync bean when it becomes the master.