This commit is contained in:
parent
bdfc2b7f05
commit
aa296b8ca6
|
@ -168,6 +168,13 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) {
|
||||||
|
|
||||||
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
|
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
|
||||||
tscTrace("try to create a connection to %s", ip);
|
tscTrace("try to create a connection to %s", ip);
|
||||||
|
if (port != 0) {
|
||||||
|
tsServerPort = port;
|
||||||
|
tsMnodeShellPort = tsServerPort + TSDB_PORT_MNODESHELL;
|
||||||
|
tsDnodeShellPort = tsServerPort + TSDB_PORT_DNODESHELL;
|
||||||
|
tsMnodeDnodePort = tsServerPort + TSDB_PORT_MNODEDNODE;
|
||||||
|
tsDnodeMnodePort = tsServerPort + TSDB_PORT_DNODEMNODE;
|
||||||
|
}
|
||||||
|
|
||||||
STscObj *pObj = taosConnectImpl(ip, user, pass, db, port, NULL, NULL, NULL);
|
STscObj *pObj = taosConnectImpl(ip, user, pass, db, port, NULL, NULL, NULL);
|
||||||
if (pObj != NULL) {
|
if (pObj != NULL) {
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct arguments {
|
||||||
int threadNum;
|
int threadNum;
|
||||||
char* commands;
|
char* commands;
|
||||||
int abort;
|
int abort;
|
||||||
|
int port;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************** Function declarations ****************/
|
/**************** Function declarations ****************/
|
||||||
|
|
|
@ -81,7 +81,7 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) {
|
||||||
// for management port
|
// for management port
|
||||||
else if (strcmp(argv[i], "-P") == 0) {
|
else if (strcmp(argv[i], "-P") == 0) {
|
||||||
if (i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
tsMnodeShellPort = atoi(argv[++i]);
|
arguments->port = atoi(argv[++i]);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "option -P requires an argument\n");
|
fprintf(stderr, "option -P requires an argument\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -68,7 +68,7 @@ TAOS *shellInit(struct arguments *args) {
|
||||||
tsMeterMetaKeepTimer = 3000;
|
tsMeterMetaKeepTimer = 3000;
|
||||||
|
|
||||||
// Connect to the database.
|
// Connect to the database.
|
||||||
TAOS *con = taos_connect(args->host, args->user, args->password, args->database, tsMnodeShellPort);
|
TAOS *con = taos_connect(args->host, args->user, args->password, args->database, args->port);
|
||||||
if (con == NULL) {
|
if (con == NULL) {
|
||||||
return con;
|
return con;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
if (arg) {
|
if (arg) {
|
||||||
tsMnodeShellPort = atoi(arg);
|
arguments->port = atoi(arg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid port\n");
|
fprintf(stderr, "Invalid port\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -61,7 +61,7 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) {
|
||||||
// for management port
|
// for management port
|
||||||
else if (strcmp(argv[i], "-P") == 0) {
|
else if (strcmp(argv[i], "-P") == 0) {
|
||||||
if (i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
tsMnodeShellPort = atoi(argv[++i]);
|
arguments->port = atoi(argv[++i]);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "option -P requires an argument\n");
|
fprintf(stderr, "option -P requires an argument\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
Loading…
Reference in New Issue