提交 a65ebcee 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

add option "fqdn" to configure local FQDN

上级 cae80f40
...@@ -53,6 +53,7 @@ extern int64_t tsMsPerDay[3]; ...@@ -53,6 +53,7 @@ extern int64_t tsMsPerDay[3];
extern char tsFirst[]; extern char tsFirst[];
extern char tsSecond[]; extern char tsSecond[];
extern char tsLocalFqdn[];
extern char tsLocalEp[]; extern char tsLocalEp[];
extern uint16_t tsServerPort; extern uint16_t tsServerPort;
extern uint16_t tsDnodeShellPort; extern uint16_t tsDnodeShellPort;
......
...@@ -65,6 +65,7 @@ int64_t tsMsPerDay[] = {86400000L, 86400000000L, 86400000000000L}; ...@@ -65,6 +65,7 @@ int64_t tsMsPerDay[] = {86400000L, 86400000000L, 86400000000000L};
char tsFirst[TSDB_EP_LEN] = {0}; char tsFirst[TSDB_EP_LEN] = {0};
char tsSecond[TSDB_EP_LEN] = {0}; char tsSecond[TSDB_EP_LEN] = {0};
char tsArbitrator[TSDB_EP_LEN] = {0}; char tsArbitrator[TSDB_EP_LEN] = {0};
char tsLocalFqdn[TSDB_FQDN_LEN] = {0};
char tsLocalEp[TSDB_EP_LEN] = {0}; // Local End Point, hostname:port char tsLocalEp[TSDB_EP_LEN] = {0}; // Local End Point, hostname:port
uint16_t tsServerPort = 6030; uint16_t tsServerPort = 6030;
uint16_t tsDnodeShellPort = 6030; // udp[6035-6039] tcp[6035] uint16_t tsDnodeShellPort = 6030; // udp[6035-6039] tcp[6035]
...@@ -305,6 +306,16 @@ static void doInitGlobalConfig() { ...@@ -305,6 +306,16 @@ static void doInitGlobalConfig() {
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosInitConfigOption(cfg);
cfg.option = "fqdn";
cfg.ptr = tsLocalFqdn;
cfg.valType = TAOS_CFG_VTYPE_STRING;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
cfg.minValue = 0;
cfg.maxValue = 0;
cfg.ptrLength = TSDB_FQDN_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
// port // port
cfg.option = "serverPort"; cfg.option = "serverPort";
cfg.ptr = &tsServerPort; cfg.ptr = &tsServerPort;
...@@ -1251,9 +1262,13 @@ bool taosCheckGlobalCfg() { ...@@ -1251,9 +1262,13 @@ bool taosCheckGlobalCfg() {
taosSetAllDebugFlag(); taosSetAllDebugFlag();
} }
taosGetFqdn(tsLocalEp); if (tsLocalFqdn[0] == 0)
sprintf(tsLocalEp + strlen(tsLocalEp), ":%d", tsServerPort); taosGetFqdn(tsLocalEp);
uPrint("localEp is %s", tsLocalEp); else
strcpy(tsLocalEp, tsLocalFqdn);
snprintf(tsLocalEp + strlen(tsLocalEp), sizeof(tsLocalEp), ":%d", tsServerPort);
uPrint("localEp is: %s", tsLocalEp);
if (tsFirst[0] == 0) { if (tsFirst[0] == 0) {
strcpy(tsFirst, tsLocalEp); strcpy(tsFirst, tsLocalEp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册