mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #33450 from wuxueyang96/add_switch_enable_ipv4or6
Add config to enable ipv4 or ipv6.
This commit is contained in:
commit
6dbbf6b4dd
2
contrib/NuRaft
vendored
2
contrib/NuRaft
vendored
@ -1 +1 @@
|
||||
Subproject commit ff100a8713146e1ca4b4158dd6cc4eef9af47fc3
|
||||
Subproject commit c2043aa250e53ad5cf75e596e319d587af4dcb3c
|
@ -41,6 +41,7 @@ const String KeeperConfigurationAndSettings::DEFAULT_FOUR_LETTER_WORD_CMD = "con
|
||||
|
||||
KeeperConfigurationAndSettings::KeeperConfigurationAndSettings()
|
||||
: server_id(NOT_EXIST)
|
||||
, enable_ipv6(true)
|
||||
, tcp_port(NOT_EXIST)
|
||||
, tcp_port_secure(NOT_EXIST)
|
||||
, standalone_keeper(false)
|
||||
@ -67,6 +68,9 @@ void KeeperConfigurationAndSettings::dump(WriteBufferFromOwnString & buf) const
|
||||
writeText("server_id=", buf);
|
||||
write_int(server_id);
|
||||
|
||||
writeText("enable_ipv6=", buf);
|
||||
write_bool(enable_ipv6);
|
||||
|
||||
if (tcp_port != NOT_EXIST)
|
||||
{
|
||||
writeText("tcp_port=", buf);
|
||||
@ -156,6 +160,8 @@ KeeperConfigurationAndSettings::loadFromConfig(const Poco::Util::AbstractConfigu
|
||||
ret->server_id = config.getInt("keeper_server.server_id");
|
||||
ret->standalone_keeper = standalone_keeper_;
|
||||
|
||||
ret->enable_ipv6 = config.getBool("keeper_server.enable_ipv6", true);
|
||||
|
||||
if (config.has("keeper_server.tcp_port"))
|
||||
{
|
||||
ret->tcp_port = config.getInt("keeper_server.tcp_port");
|
||||
|
@ -63,6 +63,7 @@ struct KeeperConfigurationAndSettings
|
||||
KeeperConfigurationAndSettings();
|
||||
int server_id;
|
||||
|
||||
bool enable_ipv6;
|
||||
int tcp_port;
|
||||
int tcp_port_secure;
|
||||
|
||||
|
@ -276,7 +276,7 @@ void KeeperDispatcher::initialize(const Poco::Util::AbstractConfiguration & conf
|
||||
try
|
||||
{
|
||||
LOG_DEBUG(log, "Waiting server to initialize");
|
||||
server->startup();
|
||||
server->startup(configuration_and_settings->enable_ipv6);
|
||||
LOG_DEBUG(log, "Server initialized, waiting for quorum");
|
||||
|
||||
if (!start_async)
|
||||
|
@ -107,7 +107,7 @@ KeeperServer::KeeperServer(
|
||||
LOG_WARNING(log, "Quorum reads enabled, Keeper will work slower.");
|
||||
}
|
||||
|
||||
void KeeperServer::startup()
|
||||
void KeeperServer::startup(bool enable_ipv6)
|
||||
{
|
||||
state_machine->init();
|
||||
|
||||
@ -171,13 +171,14 @@ void KeeperServer::startup()
|
||||
#endif
|
||||
}
|
||||
|
||||
launchRaftServer(params, asio_opts);
|
||||
launchRaftServer(enable_ipv6, params, asio_opts);
|
||||
|
||||
if (!raft_instance)
|
||||
throw Exception(ErrorCodes::RAFT_ERROR, "Cannot allocate RAFT instance");
|
||||
}
|
||||
|
||||
void KeeperServer::launchRaftServer(
|
||||
bool enable_ipv6,
|
||||
const nuraft::raft_params & params,
|
||||
const nuraft::asio_service::options & asio_opts)
|
||||
{
|
||||
@ -192,7 +193,7 @@ void KeeperServer::launchRaftServer(
|
||||
|
||||
nuraft::ptr<nuraft::logger> logger = nuraft::cs_new<LoggerWrapper>("RaftInstance", coordination_settings->raft_logs_level);
|
||||
asio_service = nuraft::cs_new<nuraft::asio_service>(asio_opts, logger);
|
||||
asio_listener = asio_service->create_rpc_listener(state_manager->getPort(), logger);
|
||||
asio_listener = asio_service->create_rpc_listener(state_manager->getPort(), logger, enable_ipv6);
|
||||
|
||||
if (!asio_listener)
|
||||
return;
|
||||
|
@ -44,6 +44,7 @@ private:
|
||||
/// Almost copy-paste from nuraft::launcher, but with separated server init and start
|
||||
/// Allows to avoid race conditions.
|
||||
void launchRaftServer(
|
||||
bool enable_ipv6,
|
||||
const nuraft::raft_params & params,
|
||||
const nuraft::asio_service::options & asio_opts);
|
||||
|
||||
@ -57,7 +58,7 @@ public:
|
||||
SnapshotsQueue & snapshots_queue_);
|
||||
|
||||
/// Load state machine from the latest snapshot and load log storage. Start NuRaft with required settings.
|
||||
void startup();
|
||||
void startup(bool enable_ipv6 = true);
|
||||
|
||||
/// Put local read request and execute in state machine directly and response into
|
||||
/// responses queue
|
||||
|
Loading…
Reference in New Issue
Block a user