[TBASE-1241]
This commit is contained in:
parent
b9a62d60dc
commit
fe4fb35392
|
@ -74,7 +74,6 @@ extern int tsMetricMetaKeepTimer;
|
|||
extern float tsNumOfThreadsPerCore;
|
||||
extern float tsRatioOfQueryThreads;
|
||||
extern char tsPublicIp[];
|
||||
extern char tsInternalIp[];
|
||||
extern char tsPrivateIp[];
|
||||
extern char tsServerIpStr[];
|
||||
extern short tsNumOfVnodesPerCore;
|
||||
|
@ -151,6 +150,7 @@ extern int tsTelegrafUseFieldNum;
|
|||
extern int tsAdminRowLimit;
|
||||
|
||||
extern int tsTscEnableRecordSql;
|
||||
extern int tsAnyIp;
|
||||
|
||||
extern char tsMonitorDbName[];
|
||||
extern char tsInternalPass[];
|
||||
|
|
|
@ -113,11 +113,7 @@ void monitorInitConn(void *para, void *unused) {
|
|||
monitor->state = MONITOR_STATE_INITIALIZING;
|
||||
|
||||
if (monitor->privateIpStr[0] == 0) {
|
||||
#ifdef CLUSTER
|
||||
strcpy(monitor->privateIpStr, tsPrivateIp);
|
||||
#else
|
||||
strcpy(monitor->privateIpStr, tsInternalIp);
|
||||
#endif
|
||||
for (int i = 0; i < TSDB_IPv4ADDR_LEN; ++i) {
|
||||
if (monitor->privateIpStr[i] == '.') {
|
||||
monitor->privateIpStr[i] = '_';
|
||||
|
@ -167,11 +163,7 @@ void dnodeBuildMonitorSql(char *sql, int cmd) {
|
|||
tsMonitorDbName, IP_LEN_STR + 1);
|
||||
} else if (cmd == MONITOR_CMD_CREATE_TB_DN) {
|
||||
snprintf(sql, SQL_LENGTH, "create table if not exists %s.dn_%s using %s.dn tags('%s')", tsMonitorDbName,
|
||||
#ifdef CLUSTER
|
||||
monitor->privateIpStr, tsMonitorDbName, tsPrivateIp);
|
||||
#else
|
||||
monitor->privateIpStr, tsMonitorDbName, tsInternalIp);
|
||||
#endif
|
||||
} else if (cmd == MONITOR_CMD_CREATE_MT_ACCT) {
|
||||
snprintf(sql, SQL_LENGTH,
|
||||
"create table if not exists %s.acct(ts timestamp "
|
||||
|
@ -226,10 +218,8 @@ void monitorInitDatabaseCb(void *param, TAOS_RES *result, int code) {
|
|||
taosLogSqlFp = monitorExecuteSQL;
|
||||
#ifdef CLUSTER
|
||||
taosLogAcctFp = monitorSaveAcctLog;
|
||||
monitorLPrint("dnode:%s is started", tsPrivateIp);
|
||||
#else
|
||||
monitorLPrint("dnode:%s is started", tsInternalIp);
|
||||
#endif
|
||||
monitorLPrint("dnode:%s is started", tsPrivateIp);
|
||||
}
|
||||
monitor->cmdIndex++;
|
||||
monitorInitDatabase();
|
||||
|
@ -245,11 +235,7 @@ void monitorStopSystem() {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLUSTER
|
||||
monitorLPrint("dnode:%s monitor module is stopped", tsPrivateIp);
|
||||
#else
|
||||
monitorLPrint("dnode:%s monitor module is stopped", tsInternalIp);
|
||||
#endif
|
||||
monitor->state = MONITOR_STATE_STOPPED;
|
||||
taosLogFp = NULL;
|
||||
if (monitor->initTimer != NULL) {
|
||||
|
@ -439,11 +425,7 @@ void monitorSaveLog(int level, const char *const format, ...) {
|
|||
va_end(argpointer);
|
||||
if (len > max_length) len = max_length;
|
||||
|
||||
#ifdef CLUSTER
|
||||
len += sprintf(sql + len, "', '%s')", tsPrivateIp);
|
||||
#else
|
||||
len += sprintf(sql + len, "', '%s')", tsInternalIp);
|
||||
#endif
|
||||
sql[len++] = 0;
|
||||
|
||||
monitorTrace("monitor:%p, save log, sql: %s", monitor->conn, sql);
|
||||
|
|
|
@ -381,8 +381,8 @@ bool taosGetCardName(char *ip, char *name) {
|
|||
bool taosGetCardInfo(int64_t *bytes) {
|
||||
static char tsPublicCard[1000] = {0};
|
||||
if (tsPublicCard[0] == 0) {
|
||||
if (!taosGetCardName(tsInternalIp, tsPublicCard)) {
|
||||
pError("can't get card name from ip:%s", tsInternalIp);
|
||||
if (!taosGetCardName(tsPrivateIp, tsPublicCard)) {
|
||||
pError("can't get card name from ip:%s", tsPrivateIp);
|
||||
return false;
|
||||
}
|
||||
int cardNameLen = (int)strlen(tsPublicCard);
|
||||
|
|
|
@ -139,7 +139,7 @@ int dnodeInitSystem() {
|
|||
vnodeInitMgmtIp();
|
||||
|
||||
tsPrintGlobalConfig();
|
||||
dPrint("Server IP address is:%s", tsInternalIp);
|
||||
dPrint("Server IP address is:%s", tsPrivateIp);
|
||||
|
||||
taosSetCoreDump();
|
||||
|
||||
|
|
|
@ -79,11 +79,8 @@ int mgmtInitShell() {
|
|||
if (numOfThreads < 1) numOfThreads = 1;
|
||||
|
||||
memset(&rpcInit, 0, sizeof(rpcInit));
|
||||
#ifdef CLUSTER
|
||||
rpcInit.localIp = tsInternalIp;
|
||||
#else
|
||||
rpcInit.localIp = "0.0.0.0";
|
||||
#endif
|
||||
|
||||
rpcInit.localIp = tsAnyIp ? "0.0.0.0" : tsPrivateIp;;
|
||||
rpcInit.localPort = tsMgmtShellPort;
|
||||
rpcInit.label = "MND-shell";
|
||||
rpcInit.numOfThreads = numOfThreads;
|
||||
|
|
|
@ -143,11 +143,9 @@ int vnodeInitShell() {
|
|||
if (numOfThreads < 1) numOfThreads = 1;
|
||||
|
||||
memset(&rpcInit, 0, sizeof(rpcInit));
|
||||
#ifdef CLUSTER
|
||||
rpcInit.localIp = tsInternalIp;
|
||||
#else
|
||||
rpcInit.localIp = "0.0.0.0";
|
||||
#endif
|
||||
|
||||
rpcInit.localIp = tsAnyIp ? "0.0.0.0" : tsPrivateIp;
|
||||
|
||||
rpcInit.localPort = tsVnodeShellPort;
|
||||
rpcInit.label = "DND-shell";
|
||||
rpcInit.numOfThreads = numOfThreads;
|
||||
|
|
|
@ -27,7 +27,7 @@ int mgmtUpdateDnode(SDnodeObj *pDnode) { return 0; }
|
|||
void mgmtCleanUpDnodes() {}
|
||||
|
||||
int mgmtInitDnodes() {
|
||||
dnodeObj.privateIp = inet_addr(tsInternalIp);;
|
||||
dnodeObj.privateIp = inet_addr(tsPrivateIp);;
|
||||
dnodeObj.createdTime = (int64_t)tsRebootTime * 1000;
|
||||
dnodeObj.lastReboot = tsRebootTime;
|
||||
dnodeObj.numOfCores = (uint16_t)tsNumOfCores;
|
||||
|
|
|
@ -75,7 +75,6 @@ int tsMetricMetaKeepTimer = 600; // second
|
|||
float tsNumOfThreadsPerCore = 1.0;
|
||||
float tsRatioOfQueryThreads = 0.5;
|
||||
char tsPublicIp[TSDB_IPv4ADDR_LEN] = {0};
|
||||
char tsInternalIp[TSDB_IPv4ADDR_LEN] = {0};
|
||||
char tsPrivateIp[TSDB_IPv4ADDR_LEN] = {0};
|
||||
char tsServerIpStr[TSDB_IPv4ADDR_LEN] = "127.0.0.1";
|
||||
short tsNumOfVnodesPerCore = 8;
|
||||
|
@ -164,6 +163,7 @@ int tsAdminRowLimit = 10240;
|
|||
|
||||
int tsTscEnableRecordSql = 0;
|
||||
int tsEnableCoreFile = 0;
|
||||
int tsAnyIp = 1;
|
||||
|
||||
int tsRpcTimer = 300;
|
||||
int tsRpcMaxTime = 600; // seconds;
|
||||
|
@ -448,9 +448,6 @@ static void doInitGlobalConfig() {
|
|||
tsInitConfigOption(cfg++, "privateIp", tsPrivateIp, TSDB_CFG_VTYPE_IPSTR,
|
||||
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLUSTER,
|
||||
0, 0, TSDB_IPv4ADDR_LEN, TSDB_CFG_UTYPE_NONE);
|
||||
tsInitConfigOption(cfg++, "internalIp", tsInternalIp, TSDB_CFG_VTYPE_IPSTR,
|
||||
TSDB_CFG_CTYPE_B_CONFIG,
|
||||
0, 0, TSDB_IPv4ADDR_LEN, TSDB_CFG_UTYPE_NONE);
|
||||
tsInitConfigOption(cfg++, "localIp", tsLocalIp, TSDB_CFG_VTYPE_IPSTR,
|
||||
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT,
|
||||
0, 0, TSDB_IPv4ADDR_LEN, TSDB_CFG_UTYPE_NONE);
|
||||
|
@ -709,7 +706,7 @@ static void doInitGlobalConfig() {
|
|||
1, 100000, 0, TSDB_CFG_UTYPE_NONE);
|
||||
tsInitConfigOption(cfg++, "httpEnableRecordSql", &tsHttpEnableRecordSql, TSDB_CFG_VTYPE_INT,
|
||||
TSDB_CFG_CTYPE_B_CONFIG,
|
||||
1, 100000, 0, TSDB_CFG_UTYPE_NONE);
|
||||
0, 1, 0, TSDB_CFG_UTYPE_NONE);
|
||||
tsInitConfigOption(cfg++, "telegrafUseFieldNum", &tsTelegrafUseFieldNum, TSDB_CFG_VTYPE_INT,
|
||||
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW,
|
||||
0, 1, 1, TSDB_CFG_UTYPE_NONE);
|
||||
|
@ -773,11 +770,15 @@ static void doInitGlobalConfig() {
|
|||
|
||||
tsInitConfigOption(cfg++, "tscEnableRecordSql", &tsTscEnableRecordSql, TSDB_CFG_VTYPE_INT,
|
||||
TSDB_CFG_CTYPE_B_CONFIG,
|
||||
1, 100000, 0, TSDB_CFG_UTYPE_NONE);
|
||||
0, 1, 0, TSDB_CFG_UTYPE_NONE);
|
||||
|
||||
tsInitConfigOption(cfg++, "enableCoreFile", &tsEnableCoreFile, TSDB_CFG_VTYPE_INT,
|
||||
TSDB_CFG_CTYPE_B_CONFIG,
|
||||
1, 100000, 0, TSDB_CFG_UTYPE_NONE);
|
||||
0, 1, 0, TSDB_CFG_UTYPE_NONE);
|
||||
|
||||
tsInitConfigOption(cfg++, "anyIp", &tsAnyIp, TSDB_CFG_VTYPE_INT,
|
||||
TSDB_CFG_CTYPE_B_CONFIG,
|
||||
0, 1, 0, TSDB_CFG_UTYPE_NONE);
|
||||
|
||||
// version info
|
||||
tsInitConfigOption(cfg++, "gitinfo", gitinfo, TSDB_CFG_VTYPE_STRING,
|
||||
|
@ -904,10 +905,6 @@ bool tsReadGlobalConfig() {
|
|||
strcpy(tsPublicIp, tsPrivateIp);
|
||||
}
|
||||
|
||||
if (tsInternalIp[0] == 0) {
|
||||
strcpy(tsInternalIp, tsPrivateIp);
|
||||
}
|
||||
|
||||
if (tsLocalIp[0] == 0) {
|
||||
strcpy(tsLocalIp, tsPrivateIp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue