mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
dbms: Server: Fixed hostname + IP address presentation. [#METR-15859]
This commit is contained in:
parent
6ce28acc0f
commit
550d5e9e7a
@ -63,6 +63,7 @@ public:
|
||||
* </shard>
|
||||
*/
|
||||
Poco::Net::SocketAddress host_port;
|
||||
String host_name;
|
||||
String user;
|
||||
String password;
|
||||
UInt32 replica_num;
|
||||
|
@ -13,8 +13,9 @@ Cluster::Address::Address(const String & config_prefix)
|
||||
{
|
||||
auto & config = Poco::Util::Application::instance().config();
|
||||
|
||||
host_name = config.getString(config_prefix + ".host");
|
||||
host_port = Poco::Net::SocketAddress(
|
||||
config.getString(config_prefix + ".host"),
|
||||
host_name,
|
||||
config.getInt(config_prefix + ".port")
|
||||
);
|
||||
|
||||
|
@ -61,11 +61,16 @@ BlockInputStreams StorageSystemClusters::read(
|
||||
shard_weight_column->insert(static_cast<UInt64>(shard_info.weight));
|
||||
replica_num_column->insert(static_cast<UInt64>(address.replica_num));
|
||||
|
||||
const std::string & source = address.host_port.host().toString();
|
||||
const auto host_entry = Poco::Net::DNS::resolve(source);
|
||||
host_name_column->insert(host_entry.name());
|
||||
host_address_column->insert(host_entry.addresses()[0].toString());
|
||||
host_name_column->insert(address.host_name);
|
||||
|
||||
const auto & ip_address = address.host_port.host();
|
||||
Poco::Net::IPAddress presented_ip_address;
|
||||
if (ip_address.family() == Poco::Net::IPAddress::IPv6)
|
||||
presented_ip_address = ip_address;
|
||||
else
|
||||
presented_ip_address = Poco::Net::IPAddress("::FFFF:" + ip_address.toString());
|
||||
|
||||
host_address_column->insert(presented_ip_address.toString());
|
||||
port_column->insert(static_cast<UInt64>(address.host_port.port()));
|
||||
user_column->insert(address.user);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user