Some discussion notes with @terrymanu . It's related to ElasticJob and ShardingSphere Proxy Mode.
Currently, registry center client will be created, all of them use configuration from mode in server.yaml:
ModeScheduleContext.initRegistryCenter, create org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter. Which is used by db-discovery rule.
CoordinatorRegistryCenterInitializer.createRegistryCenter, create org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter. Which is used by scaling.
ClusterPersistRepositoryFactory.getInstance, create org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository. Which is used by proxy.
It means it might create 3 ZooKeeper client if mode Cluster type is ZooKeeper.
Why there're several registry center client?
org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter is different with org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository, seems could not be wrappered simply.
Since modules dependency hierarchy, ModeScheduleContext could not reuse CoordinatorRegistryCenterInitializer.
Some discussion notes with @terrymanu . It's related to ElasticJob and ShardingSphere Proxy Mode.
Currently, registry center client will be created, all of them use configuration from mode in server.yaml:
It means it might create 3 ZooKeeper client if mode Cluster type is ZooKeeper.
Why there're several registry center client?
org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter
is different withorg.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository
, seems could not be wrappered simply.ModeScheduleContext
could not reuseCoordinatorRegistryCenterInitializer
.It's better to use unified registry center client, just reuse the proxy one.