tconfig.c 16.0 KB
Newer Older
S
slguan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#define _DEFAULT_SOURCE
#include "os.h"
#include "tconfig.h"
#include "tulog.h"
#include "tsocket.h"
#include "tutil.h"

S
Shuduo Sang 已提交
23
SGlobalCfg tsGlobalConfig[TSDB_CFG_MAX_NUM] = {{0}};
S
slguan 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
int32_t    tsGlobalConfigNum = 0;

static char *tsGlobalUnit[] = {
  " ", 
  "(%)", 
  "(GB)", 
  "(Mb)", 
  "(byte)", 
  "(s)", 
  "(ms)"
};

char *tsCfgStatusStr[] = {
  "none", 
  "system default", 
  "config file", 
  "taos_options", 
  "program argument list"
};

static void taosReadFloatConfig(SGlobalCfg *cfg, char *input_value) {
  float  value = (float)atof(input_value);
  float *option = (float *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%f",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %f", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

T
tickduan 已提交
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
static void taosReadDoubleConfig(SGlobalCfg *cfg, char *input_value) {
  double  value = atof(input_value);
  double *option = (double *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%f",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %f", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

S
slguan 已提交
78 79 80 81 82 83 84 85 86 87 88
static void taosReadInt32Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  int32_t *option = (int32_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
H
Hui Li 已提交
89
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
S
slguan 已提交
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

static void taosReadInt16Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  int16_t *option = (int16_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = (int16_t)value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
static void taosReadUInt16Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  uint16_t *option = (uint16_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = (uint16_t)value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

S
Shengliang Guan 已提交
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
static void taosReadInt8Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  int8_t *option = (int8_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = (int8_t)value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

H
Hongze Cheng 已提交
146
static bool taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
S
TD-1037  
Shengliang Guan 已提交
147
  int   length = (int)strlen(input_value);
S
slguan 已提交
148 149
  char *option = (char *)cfg->ptr;
  if (length <= 0 || length > cfg->ptrLength) {
S
TD-1767  
Shengliang Guan 已提交
150 151 152
    uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s", cfg->option,
           input_value, cfg->ptrLength, option);
    return false;
S
slguan 已提交
153 154
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
S
Shengliang Guan 已提交
155 156
      taosExpandDir(input_value, option, cfg->ptrLength);
      taosRealPath(option, cfg->ptrLength);
S
TD-1767  
Shengliang Guan 已提交
157

158
      if (!taosMkDir(option)) {
S
TD-1767  
Shengliang Guan 已提交
159 160 161
        uError("config option:%s, input value:%s, directory not exist, create fail:%s", cfg->option, input_value,
               strerror(errno));
        return false;
S
slguan 已提交
162 163 164 165 166 167 168
      }
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], option);
    }
  }
S
TD-1767  
Shengliang Guan 已提交
169 170

  return true;
S
slguan 已提交
171 172 173
}

static void taosReadIpStrConfig(SGlobalCfg *cfg, char *input_value) {
174
  uint32_t value = taosInetAddr(input_value);
S
slguan 已提交
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
  char *   option = (char *)cfg->ptr;
  if (value == INADDR_NONE) {
    uError("config option:%s, input value:%s, is not a valid ip address, use default value:%s",
           cfg->option, input_value, option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      strncpy(option, input_value, cfg->ptrLength);
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], option);
    }
  }
}

static void taosReadStringConfig(SGlobalCfg *cfg, char *input_value) {
S
TD-1037  
Shengliang Guan 已提交
191
  int   length = (int) strlen(input_value);
S
slguan 已提交
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
  char *option = (char *)cfg->ptr;
  if (length <= 0 || length > cfg->ptrLength) {
    uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s",
           cfg->option, input_value, cfg->ptrLength, option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      strncpy(option, input_value, cfg->ptrLength);
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], option);
    }
  }
}

static void taosReadLogOption(char *option, char *value) {
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_CONFIG) || !(cfg->cfgType & TSDB_CFG_CTYPE_B_LOG)) continue;
    if (strcasecmp(cfg->option, option) != 0) continue;

    switch (cfg->valType) {
      case TAOS_CFG_VTYPE_INT32:
        taosReadInt32Config(cfg, value);
S
Shengliang Guan 已提交
216 217 218
        // if (strcasecmp(cfg->option, "debugFlag") == 0) {
        //   taosSetAllDebugFlag();
        // }
S
slguan 已提交
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
        break;
      case TAOS_CFG_VTYPE_DIRECTORY:
        taosReadDirectoryConfig(cfg, value);
        break;
      default:
        break;
    }
    break;
  }
}

SGlobalCfg *taosGetConfigOption(const char *option) {
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (strcasecmp(cfg->option, option) != 0) continue;
    return cfg;
  }
  return NULL;
}

S
TD-1767  
Shengliang Guan 已提交
239
static void taosReadConfigOption(const char *option, char *value, char *value2, char *value3) {
S
slguan 已提交
240 241 242 243 244 245
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_CONFIG)) continue;
    if (strcasecmp(cfg->option, option) != 0) continue;

    switch (cfg->valType) {
S
Shengliang Guan 已提交
246 247 248
      case TAOS_CFG_VTYPE_INT8:
        taosReadInt8Config(cfg, value);
        break;
S
slguan 已提交
249 250 251 252 253 254
      case TAOS_CFG_VTYPE_INT16:
        taosReadInt16Config(cfg, value);
        break;
      case TAOS_CFG_VTYPE_INT32:
        taosReadInt32Config(cfg, value);
        break;
255 256 257
      case TAOS_CFG_VTYPE_UINT16:
        taosReadUInt16Config(cfg, value);
        break;
S
slguan 已提交
258 259 260
      case TAOS_CFG_VTYPE_FLOAT:
        taosReadFloatConfig(cfg, value);
        break;
T
tickduan 已提交
261 262 263
      case TAOS_CFG_VTYPE_DOUBLE:
        taosReadDoubleConfig(cfg, value);
        break;
S
slguan 已提交
264 265 266 267 268 269 270 271 272
      case TAOS_CFG_VTYPE_STRING:
        taosReadStringConfig(cfg, value);
        break;
      case TAOS_CFG_VTYPE_IPSTR:
        taosReadIpStrConfig(cfg, value);
        break;
      case TAOS_CFG_VTYPE_DIRECTORY:
        taosReadDirectoryConfig(cfg, value);
        break;
S
TD-1767  
Shengliang Guan 已提交
273
      case TAOS_CFG_VTYPE_DATA_DIRCTORY:
S
TD-1767  
Shengliang Guan 已提交
274
        if (taosReadDirectoryConfig(cfg, value)) {
S
Shengliang Guan 已提交
275
          // taosReadDataDirCfg(value, value2, value3);
S
TD-1767  
Shengliang Guan 已提交
276 277
        }
        break;
S
slguan 已提交
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
      default:
        uError("config option:%s, input value:%s, can't be recognized", option, value);
        break;
    }
    break;
  }
}

void taosInitConfigOption(SGlobalCfg cfg) {
  tsGlobalConfig[tsGlobalConfigNum++] = cfg;
}

void taosReadGlobalLogCfg() {
  FILE * fp;
  char * line, *option, *value;
  int    olen, vlen;
  char   fileName[PATH_MAX] = {0};

S
Shengliang Guan 已提交
296
  taosExpandDir(configDir, configDir, PATH_MAX);
297
  taosReadLogOption("logDir", tsLogDir);
S
slguan 已提交
298 299 300 301 302 303 304
  
  sprintf(fileName, "%s/taos.cfg", configDir);
  fp = fopen(fileName, "r");
  if (fp == NULL) {
    printf("\nconfig file:%s not found, all variables are set to default\n", fileName);
    return;
  }
305 306

  ssize_t _bytes = 0;
S
slguan 已提交
307 308 309 310 311 312 313 314 315
  size_t len = 1024;
  line = calloc(1, len);
  
  while (!feof(fp)) {
    memset(line, 0, len);
    
    option = value = NULL;
    olen = vlen = 0;

316 317 318 319 320 321
    _bytes = tgetline(&line, &len, fp);
    if (_bytes < 0)
    {
      break;
    }

S
slguan 已提交
322
    line[len - 1] = 0;
323

S
slguan 已提交
324 325 326 327 328 329 330 331 332 333 334
    paGetToken(line, &option, &olen);
    if (olen == 0) continue;
    option[olen] = 0;

    paGetToken(option + olen + 1, &value, &vlen);
    if (vlen == 0) continue;
    value[vlen] = 0;

    taosReadLogOption(option, value);
  }

S
TD-1848  
Shengliang Guan 已提交
335
  tfree(line);
S
slguan 已提交
336 337 338 339
  fclose(fp);
}

bool taosReadGlobalCfg() {
S
TD-1767  
Shengliang Guan 已提交
340 341
  char * line, *option, *value, *value2, *value3;
  int    olen, vlen, vlen2, vlen3;
S
slguan 已提交
342 343 344
  char   fileName[PATH_MAX] = {0};

  sprintf(fileName, "%s/taos.cfg", configDir);
S
Shengliang Guan 已提交
345
  FILE *fp = fopen(fileName, "r");
346 347 348 349 350 351
  if (fp == NULL) {
    fp = fopen(configDir, "r");
    if (fp == NULL) {
      return false;
    }
  }
352 353

  ssize_t _bytes = 0;
S
slguan 已提交
354 355 356
  size_t len = 1024;
  line = calloc(1, len);
  
357 358
  while (!feof(fp)) {
    memset(line, 0, len);
S
slguan 已提交
359

S
TD-1767  
Shengliang Guan 已提交
360 361
    option = value = value2 = value3 = NULL;
    olen = vlen = vlen2 = vlen3 = 0;
S
slguan 已提交
362

363 364 365 366 367 368
    _bytes = tgetline(&line, &len, fp);
    if (_bytes < 0)
    {
      break;
    }

369 370 371 372 373
    line[len - 1] = 0;
    
    paGetToken(line, &option, &olen);
    if (olen == 0) continue;
    option[olen] = 0;
S
slguan 已提交
374

375 376 377
    paGetToken(option + olen + 1, &value, &vlen);
    if (vlen == 0) continue;
    value[vlen] = 0;
S
slguan 已提交
378

S
TD-1767  
Shengliang Guan 已提交
379
    paGetToken(value + vlen + 1, &value2, &vlen2);
S
TD-1767  
Shengliang Guan 已提交
380 381 382 383 384
    if (vlen2 != 0) {
      value2[vlen2] = 0;
      paGetToken(value2 + vlen2 + 1, &value3, &vlen3);
      if (vlen3 != 0) value3[vlen3] = 0;
    }
S
TD-1767  
Shengliang Guan 已提交
385 386

    taosReadConfigOption(option, value, value2, value3);
S
slguan 已提交
387 388
  }

389 390
  fclose(fp);

S
TD-1848  
Shengliang Guan 已提交
391
  tfree(line);
S
TD-1663  
Shengliang Guan 已提交
392

S
Shengliang Guan 已提交
393 394 395
  // if (debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG || debugFlag & DEBUG_DUMP) {
  //   taosSetAllDebugFlag();
  // }
S
TD-1663  
Shengliang Guan 已提交
396

S
slguan 已提交
397 398 399 400
  return true;
}

void taosPrintGlobalCfg() {
401 402
  uInfo("   taos config & system info:");
  uInfo("==================================");
S
slguan 已提交
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417

  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (tscEmbedded == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue;
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_NOT_PRINT) continue;
    
    int optionLen = (int)strlen(cfg->option);
    int blankLen = TSDB_CFG_PRINT_LEN - optionLen;
    blankLen = blankLen < 0 ? 0 : blankLen;

    char blank[TSDB_CFG_PRINT_LEN];
    memset(blank, ' ', TSDB_CFG_PRINT_LEN);
    blank[blankLen] = 0;

    switch (cfg->valType) {
S
Shengliang Guan 已提交
418 419 420
      case TAOS_CFG_VTYPE_INT8:
        uInfo(" %s:%s%d%s", cfg->option, blank, *((int8_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
slguan 已提交
421
      case TAOS_CFG_VTYPE_INT16:
422
        uInfo(" %s:%s%d%s", cfg->option, blank, *((int16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
423 424
        break;
      case TAOS_CFG_VTYPE_INT32:
425
        uInfo(" %s:%s%d%s", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
426
        break;
427 428 429
      case TAOS_CFG_VTYPE_UINT16:
        uInfo(" %s:%s%d%s", cfg->option, blank, *((uint16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
slguan 已提交
430
      case TAOS_CFG_VTYPE_FLOAT:
431
        uInfo(" %s:%s%f%s", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
432
        break;
T
tickduan 已提交
433 434 435
      case TAOS_CFG_VTYPE_DOUBLE:
        uInfo(" %s:%s%f%s", cfg->option, blank, *((double *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
slguan 已提交
436 437 438
      case TAOS_CFG_VTYPE_STRING:
      case TAOS_CFG_VTYPE_IPSTR:
      case TAOS_CFG_VTYPE_DIRECTORY:
439
        uInfo(" %s:%s%s%s", cfg->option, blank, (char *)cfg->ptr, tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
440 441 442 443 444 445 446
        break;
      default:
        break;
    }
  }

  taosPrintOsInfo();
S
Shengliang Guan 已提交
447
  // taosPrintDataDirCfg();
S
TD-1767  
Shengliang Guan 已提交
448
  uInfo("==================================");
S
slguan 已提交
449
}
S
stephenkgu 已提交
450 451 452 453 454 455 456 457 458 459 460

static void taosDumpCfg(SGlobalCfg *cfg) {
    int optionLen = (int)strlen(cfg->option);
    int blankLen = TSDB_CFG_PRINT_LEN - optionLen;
    blankLen = blankLen < 0 ? 0 : blankLen;

    char blank[TSDB_CFG_PRINT_LEN];
    memset(blank, ' ', TSDB_CFG_PRINT_LEN);
    blank[blankLen] = 0;

    switch (cfg->valType) {
S
Shengliang Guan 已提交
461 462 463
      case TAOS_CFG_VTYPE_INT8:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((int8_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
stephenkgu 已提交
464 465 466 467 468 469
      case TAOS_CFG_VTYPE_INT16:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((int16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
      case TAOS_CFG_VTYPE_INT32:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
470 471 472
      case TAOS_CFG_VTYPE_UINT16:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((uint16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
stephenkgu 已提交
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
      case TAOS_CFG_VTYPE_FLOAT:
        printf(" %s:%s%f%s\n", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
      case TAOS_CFG_VTYPE_STRING:
      case TAOS_CFG_VTYPE_IPSTR:
      case TAOS_CFG_VTYPE_DIRECTORY:
        printf(" %s:%s%s%s\n", cfg->option, blank, (char *)cfg->ptr, tsGlobalUnit[cfg->unitType]);
        break;
      default:
        break;
    }
}

void taosDumpGlobalCfg() {
  printf("taos global config:\n");
  printf("==================================\n");
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (tscEmbedded == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue;
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_NOT_PRINT) continue;
    if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_SHOW)) continue;

    taosDumpCfg(cfg);
  }

  printf("\ntaos local config:\n");
  printf("==================================\n");

  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (tscEmbedded == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue;
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_NOT_PRINT) continue;
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_SHOW) continue;

    taosDumpCfg(cfg);
  }
}