From 46b3f5207733a7bc06d9766df8367f8fa0029509 Mon Sep 17 00:00:00 2001 From: slguan Date: Tue, 24 Dec 2019 17:00:29 +0800 Subject: [PATCH] #1003 [TBASE-779] --- packaging/cfg/taos.cfg | 84 ++++++++++++++++++++++++++++++++------ src/client/src/tscServer.c | 4 +- src/client/src/tscSql.c | 10 ++--- src/inc/tglobalcfg.h | 2 - src/util/src/tglobalcfg.c | 11 +++-- 5 files changed, 82 insertions(+), 29 deletions(-) diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index fa289c277c..14bd948b79 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -5,14 +5,39 @@ # # ######################################################## +# master IP for TDengine system +# masterIp 127.0.0.1 -# Internal IP address of the server, which can be acquired by using ifconfig command. -# internalIp 127.0.0.1 +# second IP for TDengine system, for cluster version only +# secondIp 127.0.0.1 + +# IP address of the server +# privateIp 127.0.0.1 + +# public IP of server, on which the tdengine are deployed +# this IP is assigned by cloud service provider, for cluster version only +# publicIp 127.0.0.1 + +# network is bound to 0.0.0.0 +# anyIp 1 + +# set socket type ("udp" and "tcp") +# the server and client should have the same socket type. Otherwise, connect will fail +# sockettype udp # client local IP # localIp 127.0.0.1 -# data file's directory +# for the cluster version, data file's directory is configured this way +# option mount_path tier_level +# dataDir /mnt/disk1/taos 0 +# dataDir /mnt/disk2/taos 0 +# dataDir /mnt/disk3/taos 0 +# dataDir /mnt/disk4/taos 0 +# dataDir /mnt/disk5/taos 0 +# dataDir /mnt/disk6/taos 1 +# dataDir /mnt/disk7/taos 1 +# for the stand-alone version, data file's directory is configured this way # dataDir /var/lib/taos # log file's directory @@ -27,6 +52,18 @@ # port for DNode connect to Client, default udp[6035-6039] tcp[6035] # vnodeShellPort 6035 +# port for MNode connect to VNode, default udp[6040-6044] tcp[6040], for cluster version only +# mgmtVnodePort 6040 + +# port for DNode connect to DNode, default tcp[6045], for cluster version only +# vnodeVnodePort 6045 + +# port for MNode connect to MNode, default udp[6050], for cluster version only +# mgmtMgmtPort 6050 + +# port sync file MNode and MNode, default tcp[6050], for cluster version only +# mgmtSyncPort 6050 + # number of threads per CPU core # numOfThreadsPerCore 1 @@ -54,11 +91,7 @@ # interval of system monitor # monitorInterval 60 -# set socket type("udp" and "tcp"). -# The server and client should have the same socket type. Otherwise, connect will fail. -# sockettype udp - -# The compressed rpc message, option: +# the compressed rpc message, option: # -1 (no compression) # 0 (all message compressed), # > 0 (rpc message body which larger than this value will be compressed) @@ -73,12 +106,18 @@ # commit interval,unit is second # ctime 3600 -# interval of DNode report status to MNode, unit is Second +# interval of DNode report status to MNode, unit is Second, for cluster version only # statusInterval 1 # interval of Shell send HB to MNode, unit is Second # shellActivityTimer 3 +# interval of DNode send HB to DNode, unit is Second, for cluster version only +# vnodePeerHBTimer 1 + +# interval of MNode send HB to MNode, unit is Second, for cluster version only +# mgmtPeerHBTimer 1 + # time to keep MeterMeta in Cache, seconds # meterMetaKeepTimer 7200 @@ -94,6 +133,12 @@ # max number of tables # maxTables 650000 +# max number of Dnodes, for cluster version only +# maxDnodes 1000 + +# Max number of VGroups, for cluster version only +# maxVGroups 1000 + # system locale # locale en_US.UTF-8 @@ -118,6 +163,9 @@ # number of days to keep DB file # keep 3650 +# number of replications, for cluster version only +# replications 1 + # client default database(database should be created) # defaultDB @@ -139,22 +187,34 @@ # max connection to Vnode # maxVnodeConnections 10000 -# start http service in the cluster +# mnode take into account while balance, for cluster version only +# mgmtEqualVnodeNum 4 + +# number of seconds allowed for a dnode to be offline, for cluster version only +# offlineThreshold 864000 + +# start http service # http 1 -# start system monitor module in the cluster +# start system monitor moduler # monitor 1 +# maximum number of rows returned by the restful interface +# restfulRowLimit 10240 + # number of threads used to process http requests # httpMaxThreads 2 # pre-allocated number of http sessions # httpCacheSessions 100 +# whether to enable HTTP compression transmission +# httpEnableCompress 0 + # whether the telegraf table name contains the number of tags and the number of fields # telegrafUseFieldNum 0 -# enable table names generated by telegraf can be configured +# enable table names generated by telegraf is configured # use /etc/taos/taos.telegraf.cfg as the configuration file, such as # { # "metrics": [ diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 37bbd93ec6..b3521a555b 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -183,7 +183,7 @@ void tscGetConnToMgmt(SSqlObj *pSql, uint8_t *pCode) { #ifdef CLUSTER connInit.peerIp = tscMgmtIpList.ipstr[pSql->index]; #else - connInit.peerIp = tsServerIpStr; + connInit.peerIp = tsMasterIp; #endif thandle = taosOpenRpcConn(&connInit, pCode); } @@ -291,7 +291,7 @@ void tscGetConnToVnode(SSqlObj *pSql, uint8_t *pCode) { connInit.peerId = htonl((pVPeersDesc[0].vnode << TSDB_SHELL_VNODE_BITS)); connInit.shandle = pVnodeConn; connInit.ahandle = pSql; - connInit.peerIp = tsServerIpStr; + connInit.peerIp = tsMasterIp; connInit.peerPort = tsVnodeShellPort; thandle = taosOpenRpcConn(&connInit, pCode); vidIndex = (vidIndex + 1) % tscNumOfThreads; diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 15095a7fb9..c9d9050a29 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -70,8 +70,8 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const } #else if (ip && ip[0]) { - if (ip != tsServerIpStr) { - strcpy(tsServerIpStr, ip); + if (ip != tsMasterIp) { + strcpy(tsMasterIp, ip); } tsServerIp = inet_addr(ip); } @@ -153,11 +153,7 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) { if (ip == NULL || (ip != NULL && (strcmp("127.0.0.1", ip) == 0 || strcasecmp("localhost", ip) == 0))) { -#ifdef CLUSTER ip = tsMasterIp; -#else - ip = tsServerIpStr; -#endif } tscTrace("try to create a connection to %s", ip); @@ -181,7 +177,7 @@ TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void *param, void **taos) { #ifndef CLUSTER if (ip == NULL) { - ip = tsServerIpStr; + ip = tsMasterIp; } #endif return taos_connect_imp(ip, user, pass, db, port, fp, param, taos); diff --git a/src/inc/tglobalcfg.h b/src/inc/tglobalcfg.h index 37e8e20681..c4407f7d55 100644 --- a/src/inc/tglobalcfg.h +++ b/src/inc/tglobalcfg.h @@ -75,7 +75,6 @@ extern float tsNumOfThreadsPerCore; extern float tsRatioOfQueryThreads; extern char tsPublicIp[]; extern char tsPrivateIp[]; -extern char tsServerIpStr[]; extern short tsNumOfVnodesPerCore; extern short tsNumOfTotalVnodes; extern short tsCheckHeaderFile; @@ -148,7 +147,6 @@ extern int tsHttpMaxThreads; extern int tsHttpEnableCompress; extern int tsHttpEnableRecordSql; extern int tsTelegrafUseFieldNum; -extern int tsAdminRowLimit; extern int tsTscEnableRecordSql; extern int tsAnyIp; diff --git a/src/util/src/tglobalcfg.c b/src/util/src/tglobalcfg.c index 4d4bace681..2db036824d 100644 --- a/src/util/src/tglobalcfg.c +++ b/src/util/src/tglobalcfg.c @@ -56,7 +56,11 @@ int tscEmbedded = 0; */ int64_t tsMsPerDay[] = {86400000L, 86400000000L}; +#ifdef CLUSTER char tsMasterIp[TSDB_IPv4ADDR_LEN] = {0}; +#else +char tsMasterIp[TSDB_IPv4ADDR_LEN] = "127.0.0.1"; +#endif char tsSecondIp[TSDB_IPv4ADDR_LEN] = {0}; uint16_t tsMgmtShellPort = 6030; // udp[6030-6034] tcp[6030] uint16_t tsVnodeShellPort = 6035; // udp[6035-6039] tcp[6035] @@ -76,7 +80,6 @@ float tsNumOfThreadsPerCore = 1.0; float tsRatioOfQueryThreads = 0.5; char tsPublicIp[TSDB_IPv4ADDR_LEN] = {0}; char tsPrivateIp[TSDB_IPv4ADDR_LEN] = {0}; -char tsServerIpStr[TSDB_IPv4ADDR_LEN] = "127.0.0.1"; short tsNumOfVnodesPerCore = 8; short tsNumOfTotalVnodes = 0; short tsCheckHeaderFile = 0; @@ -118,7 +121,7 @@ int tsBalanceMonitorInterval = 2; // seconds int tsBalanceStartInterval = 300; // seconds int tsBalancePolicy = 0; // 1-use sys.montor int tsOfflineThreshold = 864000; // seconds 10days -int tsMgmtEqualVnodeNum = 0; +int tsMgmtEqualVnodeNum = 4; int tsEnableHttpModule = 1; int tsEnableMonitorModule = 1; @@ -160,7 +163,6 @@ int tsHttpMaxThreads = 2; int tsHttpEnableCompress = 0; int tsHttpEnableRecordSql = 0; int tsTelegrafUseFieldNum = 0; -int tsAdminRowLimit = 10240; int tsTscEnableRecordSql = 0; int tsEnableCoreFile = 0; @@ -447,9 +449,6 @@ static void doInitGlobalConfig() { tsInitConfigOption(cfg++, "secondIp", tsSecondIp, TSDB_CFG_VTYPE_IPSTR, TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_CLUSTER, 0, 0, TSDB_IPv4ADDR_LEN, TSDB_CFG_UTYPE_NONE); - tsInitConfigOption(cfg++, "serverIp", tsServerIpStr, TSDB_CFG_VTYPE_IPSTR, - TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_LITE, - 0, 0, TSDB_IPv4ADDR_LEN, TSDB_CFG_UTYPE_NONE); tsInitConfigOption(cfg++, "publicIp", tsPublicIp, TSDB_CFG_VTYPE_IPSTR, TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLUSTER, 0, 0, TSDB_IPv4ADDR_LEN, TSDB_CFG_UTYPE_NONE); -- GitLab