提交 654a5061 编写于 作者: H hjxilinx

configure the socket type(TCP/UDP) in config file.#671

上级 ba197c2d
......@@ -54,6 +54,9 @@
# interval of system monitor
# monitorInterval 60
# set socket type(UDP by default). if udpsocket is 0, TCP is applied for all connections
# udpsocket 1
# RPC re-try timer, millisecond
# rpcTimer 300
......
......@@ -118,7 +118,7 @@ void taos_init_imp() {
rpcInit.sessionsPerChann = tsMaxVnodeConnections / tscNumOfThreads;
rpcInit.idMgmt = TAOS_ID_FREE;
rpcInit.noFree = 0;
rpcInit.connType = TAOS_CONN_UDP;
rpcInit.connType = TAOS_CONN_SOCKET_TYPE_C();
rpcInit.qhandle = tscQhandle;
pVnodeConn = taosOpenRpc(&rpcInit);
if (pVnodeConn == NULL) {
......@@ -139,7 +139,7 @@ void taos_init_imp() {
rpcInit.sessionsPerChann = tsMaxMgmtConnections;
rpcInit.idMgmt = TAOS_ID_FREE;
rpcInit.noFree = 0;
rpcInit.connType = TAOS_CONN_UDP;
rpcInit.connType = TAOS_CONN_SOCKET_TYPE_C();
rpcInit.qhandle = tscQhandle;
pTscMgmtConn = taosOpenRpc(&rpcInit);
if (pTscMgmtConn == NULL) {
......
......@@ -132,6 +132,8 @@ extern int tsStreamCompRetryDelay;
extern int tsProjectExecInterval;
extern int64_t tsMaxRetentWindow;
extern int tsUDPSocket;
extern char tsHttpIp[];
extern short tsHttpPort;
extern int tsHttpCacheSessions;
......@@ -182,12 +184,12 @@ void tsSetTimeZone();
void tsSetLocale();
void tsInitGlobalConfig();
#define TSDB_CFG_CTYPE_B_CONFIG 1 // can be configured from file
#define TSDB_CFG_CTYPE_B_SHOW 2 // can displayed by "show configs" commands
#define TSDB_CFG_CTYPE_B_LOG 4 // is a log type configuration
#define TSDB_CFG_CTYPE_B_CLIENT 8 // can be displayed in the client log
#define TSDB_CFG_CTYPE_B_OPTION 16 // can be configured by taos_options function
#define TSDB_CFG_CTYPE_B_NOT_PRINT 32
#define TSDB_CFG_CTYPE_B_CONFIG 1U // can be configured from file
#define TSDB_CFG_CTYPE_B_SHOW 2U // can displayed by "show configs" commands
#define TSDB_CFG_CTYPE_B_LOG 4U // is a log type configuration
#define TSDB_CFG_CTYPE_B_CLIENT 8U // can be displayed in the client log
#define TSDB_CFG_CTYPE_B_OPTION 16U // can be configured by taos_options function
#define TSDB_CFG_CTYPE_B_NOT_PRINT 32U
#define TSDB_CFG_CSTATUS_NONE 0 // not configured
#define TSDB_CFG_CSTATUS_DEFAULT 1 // use system default value
......
......@@ -34,6 +34,9 @@ extern "C" {
#define TAOS_ID_FREE 1
#define TAOS_ID_REALLOCATE 2
#define TAOS_CONN_SOCKET_TYPE_S() ((tsUDPSocket == 1)? TAOS_CONN_UDPS:TAOS_CONN_TCPS)
#define TAOS_CONN_SOCKET_TYPE_C() ((tsUDPSocket == 1)? TAOS_CONN_UDP:TAOS_CONN_TCPC)
#define taosSendMsgToPeer(x, y, z) taosSendMsgToPeerH(x, y, z, NULL)
#define taosOpenRpcChann(x, y, z) taosOpenRpcChannWithQ(x, y, z, NULL)
#define taosBuildReqMsg(x, y) taosBuildReqMsgWithSize(x, y, 512)
......
......@@ -64,7 +64,7 @@ int mgmtInitShell() {
rpcInit.numOfChanns = 1;
rpcInit.sessionsPerChann = tsMaxShellConns;
rpcInit.idMgmt = TAOS_ID_FREE;
rpcInit.connType = TAOS_CONN_UDPS;
rpcInit.connType = TAOS_CONN_SOCKET_TYPE_S();
rpcInit.idleTime = tsShellActivityTimer * 2000;
rpcInit.qhandle = mgmtQhandle;
rpcInit.afp = mgmtRetriveUserAuthInfo;
......
......@@ -127,7 +127,7 @@ int vnodeInitShell() {
rpcInit.numOfChanns = TSDB_MAX_VNODES;
rpcInit.sessionsPerChann = 16;
rpcInit.idMgmt = TAOS_ID_FREE;
rpcInit.connType = TAOS_CONN_UDPS;
rpcInit.connType = TAOS_CONN_SOCKET_TYPE_S();
rpcInit.idleTime = tsShellActivityTimer * 2000;
rpcInit.qhandle = rpcQhandle[0];
rpcInit.efp = vnodeSendVpeerCfgMsg;
......
......@@ -122,6 +122,8 @@ int tsStreamCompRetryDelay = 10; // the stream computing delay
int tsProjectExecInterval = 10000; // every 10sec, the projection will be executed once
int64_t tsMaxRetentWindow = 24 * 3600L; // maximum time window tolerance
int tsUDPSocket = 1; // use UDP by default, if tsUDPSocket equals to 0, all connection use TCP socket
char tsHttpIp[TSDB_IPv4ADDR_LEN] = "0.0.0.0";
short tsHttpPort = 6020; // only tcp, range tcp[6020]
// short tsNginxPort = 6060; //only tcp, range tcp[6060]
......@@ -494,7 +496,12 @@ void tsInitGlobalConfig() {
tsInitConfigOption(cfg++, "defaultUser", tsDefaultUser, TSDB_CFG_VTYPE_STRING,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT, 0, 0, TSDB_USER_LEN, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "defaultPass", tsDefaultPass, TSDB_CFG_VTYPE_STRING,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_NOT_PRINT, 0, 0, TSDB_PASSWORD_LEN, TSDB_CFG_UTYPE_NONE);
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_NOT_PRINT, 0, 0,
TSDB_PASSWORD_LEN, TSDB_CFG_UTYPE_NONE);
// socket type, udp by default
tsInitConfigOption(cfg++, "udpsocket", &tsUDPSocket, TSDB_CFG_VTYPE_INT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW, 0, 1, 1, TSDB_CFG_UTYPE_NONE);
// locale & charset
tsInitConfigOption(cfg++, "timezone", tsTimezone, TSDB_CFG_VTYPE_STRING,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册