mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
cluster discovery init only with zookeeper
This commit is contained in:
parent
4816d1afcc
commit
e7d3dbeebd
@ -46,7 +46,7 @@ void ClusterCopier::init()
|
||||
reloadTaskDescription();
|
||||
|
||||
task_cluster->loadTasks(*task_cluster_current_config);
|
||||
getContext()->setClustersConfig(task_cluster_current_config, task_cluster->clusters_prefix);
|
||||
getContext()->setClustersConfig(task_cluster_current_config, false, task_cluster->clusters_prefix);
|
||||
|
||||
/// Set up shards and their priority
|
||||
task_cluster->random_engine.seed(task_cluster->random_device());
|
||||
|
@ -841,7 +841,7 @@ if (ThreadFuzzer::instance().isEffective())
|
||||
// in a lot of places. For now, disable updating log configuration without server restart.
|
||||
//setTextLog(global_context->getTextLog());
|
||||
updateLevels(*config, logger());
|
||||
global_context->setClustersConfig(config);
|
||||
global_context->setClustersConfig(config, has_zookeeper);
|
||||
global_context->setMacros(std::make_unique<Macros>(*config, "macros", log));
|
||||
global_context->setExternalAuthenticatorsConfig(*config);
|
||||
|
||||
@ -1555,6 +1555,7 @@ if (ThreadFuzzer::instance().isEffective())
|
||||
server.start();
|
||||
LOG_INFO(log, "Ready for connections.");
|
||||
|
||||
if (has_zookeeper)
|
||||
global_context->registerNodeForClusterDiscovery();
|
||||
|
||||
SCOPE_EXIT_SAFE({
|
||||
|
@ -2206,11 +2206,11 @@ void Context::registerNodeForClusterDiscovery()
|
||||
|
||||
|
||||
/// On repeating calls updates existing clusters and adds new clusters, doesn't delete old clusters
|
||||
void Context::setClustersConfig(const ConfigurationPtr & config, const String & config_name)
|
||||
void Context::setClustersConfig(const ConfigurationPtr & config, bool enable_discovery, const String & config_name)
|
||||
{
|
||||
std::lock_guard lock(shared->clusters_mutex);
|
||||
|
||||
if (!shared->cluster_discovery)
|
||||
if (enable_discovery && !shared->cluster_discovery)
|
||||
{
|
||||
shared->cluster_discovery = std::make_unique<ClusterDiscovery>(*config, shared_from_this());
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ public:
|
||||
std::shared_ptr<Clusters> getClusters() const;
|
||||
std::shared_ptr<Cluster> getCluster(const std::string & cluster_name) const;
|
||||
std::shared_ptr<Cluster> tryGetCluster(const std::string & cluster_name) const;
|
||||
void setClustersConfig(const ConfigurationPtr & config, const String & config_name = "remote_servers");
|
||||
void setClustersConfig(const ConfigurationPtr & config, bool enable_discovery = false, const String & config_name = "remote_servers");
|
||||
|
||||
void registerNodeForClusterDiscovery();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user