cm两节点部署cm_server.conf参数third_party_gateway_ip支持以逗号分隔
This commit is contained in:
parent
a7ad16c4e3
commit
943abc13d7
@ -1322,11 +1322,25 @@ status_t IsReachableIP(char *ip)
|
||||
if (ip == nullptr) {
|
||||
return CM_ERROR;
|
||||
}
|
||||
char tmpIp[CM_IP_LENGTH];
|
||||
int rc = -1;
|
||||
rc = strcpy_s(tmpIp, CM_IP_LENGTH, ip);
|
||||
securec_check_errno(rc, (void)rc);
|
||||
char *saveptr = NULL;
|
||||
char *token = strtok_r(tmpIp, ",", &saveptr);
|
||||
char cmd[MAXPGPATH] = {0};
|
||||
int rc = snprintf_s(cmd, MAXPGPATH, MAXPGPATH - 1, "timeout 2 ping -c 2 %s > /dev/null 2>&1", ip);
|
||||
securec_check_intval(rc, (void)rc);
|
||||
rc = system(cmd);
|
||||
return rc == 0 ? CM_SUCCESS : CM_ERROR;
|
||||
while (token != NULL) {
|
||||
rc = memset_s(cmd, MAXPGPATH, 0, MAXPGPATH);
|
||||
securec_check_errno(rc, (void)rc);
|
||||
rc = snprintf_s(cmd, MAXPGPATH, MAXPGPATH - 1, "timeout 2 ping -c 2 %s > /dev/null 2>&1", token);
|
||||
securec_check_intval(rc, (void)rc);
|
||||
rc = system(cmd);
|
||||
if (rc == 0) {
|
||||
return CM_SUCCESS;
|
||||
}
|
||||
token = strtok_r(NULL, ",", &saveptr);
|
||||
}
|
||||
return CM_ERROR;
|
||||
}
|
||||
|
||||
bool IsIPAddrValid(const char *ipAddr)
|
||||
|
@ -74,6 +74,7 @@ agent_network_timeout = 6
|
||||
dn_arbitrate_mode = quorum
|
||||
agent_fault_timeout = 60
|
||||
third_party_gateway_ip = '' # used in 2 nodes cluster for ddb role arbitration with network isolation,
|
||||
# support multiple iP addresses separated by commas, like '172.0.0.1,172.0.0.2'
|
||||
# when cms_enable_failover_on2nodes is true.
|
||||
# default ''. if cms_enable_failover_on2nodes is true, this param must be configured.
|
||||
cms_enable_failover_on2nodes = false # used in 2 nodes cluster. if true, will use third_party_gateway_ip as an arbitrator,
|
||||
|
@ -71,6 +71,7 @@ agent_network_timeout = 6
|
||||
dn_arbitrate_mode = quorum
|
||||
delay_arbitrate_max_cluster_timeout = 300 # When resources are in the startup process, delay arbitration of the maximum cluster.
|
||||
third_party_gateway_ip = '' # used in 2 nodes cluster for ddb role arbitration with network isolation,
|
||||
# support multiple iP addresses separated by commas, like '172.0.0.1,172.0.0.2'
|
||||
# when cms_enable_failover_on2nodes is true.
|
||||
# default ''. if cms_enable_failover_on2nodes is true, this param must be configured.
|
||||
cms_enable_failover_on2nodes = false # used in 2 nodes cluster. if true, will use third_party_gateway_ip as an arbitrator,
|
||||
|
@ -71,6 +71,7 @@ ddb_log_suppress_enable = 1 # Indicates whether to enable the log s
|
||||
ddb_election_timeout = 3 # DCC election timeout interval [1S,600S]
|
||||
share_disk_path = ''
|
||||
third_party_gateway_ip = '' # used in 2 nodes cluster for ddb role arbitration with network isolation,
|
||||
# support multiple iP addresses separated by commas, like '172.0.0.1,172.0.0.2'
|
||||
# when cms_enable_failover_on2nodes is true.
|
||||
# default ''. if cms_enable_failover_on2nodes is true, this param must be configured.
|
||||
cms_enable_failover_on2nodes = false # used in 2 nodes cluster. if true, will use third_party_gateway_ip as an arbitrator,
|
||||
|
@ -352,10 +352,19 @@ void GetTwoNodesArbitrateParams(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (g_paramsOn2Nodes.cmsEnableFailoverOn2Nodes == true && !IsIPAddrValid(g_paramsOn2Nodes.thirdPartyGatewayIp)) {
|
||||
write_runlog(ERROR, "parameter \"cms_enable_failover_on2nodes\" is true, "
|
||||
"but parameter \"third_party_gateway_ip\" is invalid, please check!\n");
|
||||
exit(1);
|
||||
if (g_paramsOn2Nodes.cmsEnableFailoverOn2Nodes) {
|
||||
char tmpIp[MAXPGPATH];
|
||||
strcpy_s(tmpIp, MAXPGPATH, g_paramsOn2Nodes.thirdPartyGatewayIp);
|
||||
char *saveptr = NULL;
|
||||
char *token = strtok_r(tmpIp, ",", &saveptr);
|
||||
while (token != NULL) {
|
||||
if (!IsIPAddrValid(token)) {
|
||||
write_runlog(ERROR, "parameter \"cms_enable_failover_on2nodes\" is true, "
|
||||
"but parameter \"third_party_gateway_ip\" is invalid, please check!\n");
|
||||
exit(1);
|
||||
}
|
||||
token = strtok_r(NULL, ",", &saveptr);
|
||||
}
|
||||
}
|
||||
|
||||
g_paramsOn2Nodes.cmsNetworkIsolationTimeout = (uint32)get_int_value_from_config(configDir,
|
||||
|
Loading…
x
Reference in New Issue
Block a user