[TD-1203]

This commit is contained in:
Hui Li 2020-08-27 16:20:48 +08:00
parent a2f484fe0a
commit 460ae42c09
4 changed files with 11 additions and 8 deletions

View File

@ -29,6 +29,7 @@ extern uint16_t tsServerPort;
extern uint16_t tsDnodeShellPort;
extern uint16_t tsDnodeDnodePort;
extern uint16_t tsSyncPort;
extern uint16_t tsArbitratorPort;
extern int32_t tsStatusInterval;
extern int32_t tsNumOfMnodes;
extern int32_t tsEnableVnodeBak;

View File

@ -37,6 +37,7 @@ uint16_t tsServerPort = 6030;
uint16_t tsDnodeShellPort = 6030; // udp[6035-6039] tcp[6035]
uint16_t tsDnodeDnodePort = 6035; // udp/tcp
uint16_t tsSyncPort = 6040;
uint16_t tsArbitratorPort = 6042;
int32_t tsStatusInterval = 1; // second
int32_t tsNumOfMnodes = 3;
int32_t tsEnableVnodeBak = 1;
@ -1331,7 +1332,10 @@ int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
*port = atoi(temp+1);
}
if (*port == 0) *port = tsServerPort;
if (*port == 0) {
*port = tsServerPort;
return -1;
}
return 0;
}

View File

@ -413,9 +413,11 @@ static void syncAddArbitrator(SSyncNode *pNode)
SNodeInfo nodeInfo;
nodeInfo.nodeId = 0;
taosGetFqdnPortFromEp(tsArbitrator, nodeInfo.nodeFqdn, &nodeInfo.nodePort);
nodeInfo.nodePort += TSDB_PORT_SYNC;
int ret = taosGetFqdnPortFromEp(tsArbitrator, nodeInfo.nodeFqdn, &nodeInfo.nodePort);
if (-1 == ret) {
nodeInfo.nodePort = tsArbitratorPort;
}
if (pPeer) {
if ((strcmp(nodeInfo.nodeFqdn, pPeer->fqdn) == 0) && (nodeInfo.nodePort == pPeer->port)) {
return;

View File

@ -40,13 +40,9 @@ typedef struct {
void *pConn;
} SNodeConn;
uint16_t tsArbitratorPort = 0;
int main(int argc, char *argv[]) {
char arbLogPath[TSDB_FILENAME_LEN + 16] = {0};
tsArbitratorPort = tsServerPort + TSDB_PORT_ARBITRATOR;
for (int i=1; i<argc; ++i) {
if (strcmp(argv[i], "-p")==0 && i < argc-1) {
tsArbitratorPort = atoi(argv[++i]);