mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
support passing fqdn to register cluster node in keeper
This commit is contained in:
parent
4e3188126f
commit
6e80537ab6
@ -125,10 +125,12 @@ ClusterDiscovery::ClusterDiscovery(
|
|||||||
ClusterInfo(
|
ClusterInfo(
|
||||||
/* name_= */ key,
|
/* name_= */ key,
|
||||||
/* zk_root_= */ config.getString(prefix + ".path"),
|
/* zk_root_= */ config.getString(prefix + ".path"),
|
||||||
|
/* host_name= */ config.getString(prefix + ".my_hostname", getFQDNOrHostName()),
|
||||||
/* port= */ context->getTCPPort(),
|
/* port= */ context->getTCPPort(),
|
||||||
/* secure= */ config.getBool(prefix + ".secure", false),
|
/* secure= */ config.getBool(prefix + ".secure", false),
|
||||||
/* shard_id= */ config.getUInt(prefix + ".shard", 0),
|
/* shard_id= */ config.getUInt(prefix + ".shard", 0),
|
||||||
/* observer_mode= */ ConfigHelper::getBool(config, prefix + ".observer")
|
/* observer_mode= */ ConfigHelper::getBool(config, prefix + ".observer"),
|
||||||
|
/* invisible_mode= */ ConfigHelper::getBool(config, prefix + ".invisible")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -294,6 +296,12 @@ bool ClusterDiscovery::updateCluster(ClusterInfo & cluster_info)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cluster_info.current_cluster_is_invisible)
|
||||||
|
{
|
||||||
|
LOG_DEBUG(log, "cluster '{}' is invisible!", cluster_info.name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!needUpdate(node_uuids, nodes_info))
|
if (!needUpdate(node_uuids, nodes_info))
|
||||||
{
|
{
|
||||||
LOG_DEBUG(log, "No update required for cluster '{}'", cluster_info.name);
|
LOG_DEBUG(log, "No update required for cluster '{}'", cluster_info.name);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <Common/ConcurrentBoundedQueue.h>
|
#include <Common/ConcurrentBoundedQueue.h>
|
||||||
#include <Common/ThreadPool.h>
|
#include <Common/ThreadPool.h>
|
||||||
#include <Common/ZooKeeper/Common.h>
|
#include <Common/ZooKeeper/Common.h>
|
||||||
#include <base/getFQDNOrHostName.h>
|
|
||||||
#include <Interpreters/Cluster.h>
|
#include <Interpreters/Cluster.h>
|
||||||
|
|
||||||
#include <Poco/Logger.h>
|
#include <Poco/Logger.h>
|
||||||
@ -78,16 +77,24 @@ private:
|
|||||||
/// Current node may not belong to cluster, to be just an observer.
|
/// Current node may not belong to cluster, to be just an observer.
|
||||||
bool current_node_is_observer = false;
|
bool current_node_is_observer = false;
|
||||||
|
|
||||||
|
/// For internal management need.
|
||||||
|
/// Is it designed that when deploying multiple compute groups,
|
||||||
|
/// they are mutually invisible to each other.
|
||||||
|
bool current_cluster_is_invisible = false;
|
||||||
|
|
||||||
explicit ClusterInfo(const String & name_,
|
explicit ClusterInfo(const String & name_,
|
||||||
const String & zk_root_,
|
const String & zk_root_,
|
||||||
|
const String & host_name,
|
||||||
UInt16 port,
|
UInt16 port,
|
||||||
bool secure,
|
bool secure,
|
||||||
size_t shard_id,
|
size_t shard_id,
|
||||||
bool observer_mode)
|
bool observer_mode,
|
||||||
|
bool invisible)
|
||||||
: name(name_)
|
: name(name_)
|
||||||
, zk_root(zk_root_)
|
, zk_root(zk_root_)
|
||||||
, current_node(getFQDNOrHostName() + ":" + toString(port), secure, shard_id)
|
, current_node(host_name + ":" + toString(port), secure, shard_id)
|
||||||
, current_node_is_observer(observer_mode)
|
, current_node_is_observer(observer_mode)
|
||||||
|
, current_cluster_is_invisible(invisible)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user