提交 84bc54c6 编写于 作者: L lihui

[modify for supporting oem]

上级 feea8174
...@@ -77,7 +77,7 @@ void taos_init_imp() { ...@@ -77,7 +77,7 @@ void taos_init_imp() {
// For log directory // For log directory
if (stat(logDir, &dirstat) < 0) mkdir(logDir, 0755); if (stat(logDir, &dirstat) < 0) mkdir(logDir, 0755);
sprintf(temp, "%s/taoslog", logDir); sprintf(temp, "%s/%slog", logDir, DB_CLIENT_NAME);
if (taosInitLog(temp, tsNumOfLogLines, 10) < 0) { if (taosInitLog(temp, tsNumOfLogLines, 10) < 0) {
printf("failed to open log file in directory:%s\n", logDir); printf("failed to open log file in directory:%s\n", logDir);
} }
......
...@@ -32,16 +32,16 @@ void insertChar(Command *cmd, char *c, int size); ...@@ -32,16 +32,16 @@ void insertChar(Command *cmd, char *c, int size);
void printHelp() { void printHelp() {
char indent[10] = " "; char indent[10] = " ";
printf("taos shell is used to test the TDEngine database\n"); printf("%s shell is used to test the %s database\n", DB_CLIENT_NAME, DB_FULL_NAME);
printf("%s%s\n", indent, "-h"); printf("%s%s\n", indent, "-h");
printf("%s%s%s\n", indent, indent, "TDEngine server IP address to connect. The default host is localhost."); printf("%s%s%s\n", indent, indent, DB_FULL_NAME" server IP address to connect. The default host is localhost.");
printf("%s%s\n", indent, "-p"); printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server.");
printf("%s%s\n", indent, "-P"); printf("%s%s\n", indent, "-P");
printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection"); printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection");
printf("%s%s\n", indent, "-u"); printf("%s%s\n", indent, "-u");
printf("%s%s%s\n", indent, indent, "The TDEngine user name to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The "DB_FULL_NAME" user name to use when connecting to the server.");
printf("%s%s\n", indent, "-c"); printf("%s%s\n", indent, "-c");
printf("%s%s%s\n", indent, indent, "Configuration directory."); printf("%s%s%s\n", indent, indent, "Configuration directory.");
printf("%s%s\n", indent, "-s"); printf("%s%s\n", indent, "-s");
......
...@@ -26,10 +26,12 @@ ...@@ -26,10 +26,12 @@
#include <regex.h> #include <regex.h>
/**************** Global variables ****************/ /**************** Global variables ****************/
char CLIENT_VERSION[] = "Welcome to the TDengine shell from %s, Client Version:%s\n" char CLIENT_VERSION[] = "Welcome to the " DB_FULL_NAME " shell from %s, Client Version:%s\n"
"Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.\n\n"; "Copyright (c) 2017 by " DB_COPYRIGHT ", Inc. All rights reserved.\n\n";
char PROMPT_HEADER[] = "taos> "; //char PROMPT_HEADER[] = "taos> ";
char CONTINUE_PROMPT[] = " -> "; //char CONTINUE_PROMPT[] = " -> ";
char PROMPT_HEADER[16] = {0};
char CONTINUE_PROMPT[16] = {0};
int prompt_size = 6; int prompt_size = 6;
TAOS_RES *result = NULL; TAOS_RES *result = NULL;
History history; History history;
...@@ -38,6 +40,14 @@ History history; ...@@ -38,6 +40,14 @@ History history;
* FUNCTION: Initialize the shell. * FUNCTION: Initialize the shell.
*/ */
TAOS *shellInit(struct arguments *args) { TAOS *shellInit(struct arguments *args) {
sprintf(PROMPT_HEADER, "%s> ", DB_CLIENT_NAME);
int len = strlen(PROMPT_HEADER);
for (int i = 0; i < len - 3; ++i) {
CONTINUE_PROMPT[i] = ' ';
}
strcpy(CONTINUE_PROMPT + len - 3, "-> ");
prompt_size = strlen(DB_CLIENT_NAME) + 2;
printf("\n"); printf("\n");
printf(CLIENT_VERSION, osName, taos_get_client_info()); printf(CLIENT_VERSION, osName, taos_get_client_info());
fflush(stdout); fflush(stdout);
......
...@@ -29,14 +29,14 @@ struct termios oldtio; ...@@ -29,14 +29,14 @@ struct termios oldtio;
extern int wcwidth(wchar_t c); extern int wcwidth(wchar_t c);
void insertChar(Command *cmd, char *c, int size); void insertChar(Command *cmd, char *c, int size);
const char *argp_program_version = version; const char *argp_program_version = version;
const char *argp_program_bug_address = "<support@taosdata.com>"; const char *argp_program_bug_address = "<support@"DB_COMPANY".com>";
static char doc[] = ""; static char doc[] = "";
static char args_doc[] = ""; static char args_doc[] = "";
static struct argp_option options[] = { static struct argp_option options[] = {
{"host", 'h', "HOST", 0, "TDEngine server IP address to connect. The default host is localhost."}, {"host", 'h', "HOST", 0, DB_FULL_NAME" server IP address to connect. The default host is localhost."},
{"password", 'p', "PASSWORD", OPTION_ARG_OPTIONAL, "The password to use when connecting to the server."}, {"password", 'p', "PASSWORD", OPTION_ARG_OPTIONAL, "The password to use when connecting to the server."},
{"port", 'P', "PORT", 0, "The TCP/IP port number to use for the connection."}, {"port", 'P', "PORT", 0, "The TCP/IP port number to use for the connection."},
{"user", 'u', "USER", 0, "The TDEngine user name to use when connecting to the server."}, {"user", 'u', "USER", 0, "The "DB_FULL_NAME" user name to use when connecting to the server."},
{"config-dir", 'c', "CONFIG_DIR", 0, "Configuration directory."}, {"config-dir", 'c', "CONFIG_DIR", 0, "Configuration directory."},
{"commands", 's', "COMMANDS", 0, "Commands to run without enter the shell."}, {"commands", 's', "COMMANDS", 0, "Commands to run without enter the shell."},
{"raw-time", 'r', 0, 0, "Output time as uint64_t."}, {"raw-time", 'r', 0, 0, "Output time as uint64_t."},
......
...@@ -17,16 +17,16 @@ ...@@ -17,16 +17,16 @@
void printHelp() { void printHelp() {
char indent[10] = " "; char indent[10] = " ";
printf("taos shell is used to test the TDEngine database\n"); printf("%s shell is used to test the %s database\n", DB_CLIENT_NAME, DB_FULL_NAME);
printf("%s%s\n", indent, "-h"); printf("%s%s\n", indent, "-h");
printf("%s%s%s\n", indent, indent, "TDEngine server IP address to connect. The default host is localhost."); printf("%s%s%s\n", indent, indent, DB_FULL_NAME" server IP address to connect. The default host is localhost.");
printf("%s%s\n", indent, "-p"); printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server.");
printf("%s%s\n", indent, "-P"); printf("%s%s\n", indent, "-P");
printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection"); printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection");
printf("%s%s\n", indent, "-u"); printf("%s%s\n", indent, "-u");
printf("%s%s%s\n", indent, indent, "The TDEngine user name to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The "DB_FULL_NAME" user name to use when connecting to the server.");
printf("%s%s\n", indent, "-c"); printf("%s%s\n", indent, "-c");
printf("%s%s%s\n", indent, indent, "Configuration directory."); printf("%s%s%s\n", indent, indent, "Configuration directory.");
printf("%s%s\n", indent, "-s"); printf("%s%s\n", indent, "-s");
......
...@@ -46,10 +46,10 @@ extern char configDir[]; ...@@ -46,10 +46,10 @@ extern char configDir[];
/* The options we understand. */ /* The options we understand. */
static struct argp_option options[] = { static struct argp_option options[] = {
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0}, {0, 'h', "host", 0, "The host to connect to "DB_CLIENT_NAME". Default is localhost.", 0},
{0, 'p', "port", 0, "The TCP/IP port number to use for the connection. Default is 0.", 1}, {0, 'p', "port", 0, "The TCP/IP port number to use for the connection. Default is 0.", 1},
{0, 'u', "user", 0, "The TDEngine user name to use when connecting to the server. Default is 'root'.", 2}, {0, 'u', "user", 0, "The "DB_FULL_NAME" user name to use when connecting to the server. Default is 'root'.", 2},
{0, 'a', "password", 0, "The password to use when connecting to the server. Default is 'taosdata'.", 3}, {0, 'a', "password", 0, "The password to use when connecting to the server. Default is '"DB_COMPANY"'.", 3},
{0, 'd', "database", 0, "Destination database. Default is 'test'.", 3}, {0, 'd', "database", 0, "Destination database. Default is 'test'.", 3},
{0, 'm', "table_prefix", 0, "Table prefix name. Default is 't'.", 3}, {0, 'm', "table_prefix", 0, "Table prefix name. Default is 't'.", 3},
{0, 'M', 0, 0, "Use metric flag.", 13}, {0, 'M', 0, 0, "Use metric flag.", 13},
...@@ -272,7 +272,7 @@ int main(int argc, char *argv[]) { ...@@ -272,7 +272,7 @@ int main(int argc, char *argv[]) {
struct arguments arguments = {NULL, // host struct arguments arguments = {NULL, // host
0, // port 0, // port
"root", // user "root", // user
"taosdata", // password DB_COMPANY, // password
"test", // database "test", // database
"t", // tb_prefix "t", // tb_prefix
false, // use_metric false, // use_metric
...@@ -383,7 +383,7 @@ int main(int argc, char *argv[]) { ...@@ -383,7 +383,7 @@ int main(int argc, char *argv[]) {
taos_init(); taos_init();
TAOS *taos = taos_connect(ip_addr, user, pass, NULL, port); TAOS *taos = taos_connect(ip_addr, user, pass, NULL, port);
if (taos == NULL) { if (taos == NULL) {
fprintf(stderr, "Failed to connect to TDengine, reason:%s\n", taos_errstr(taos)); fprintf(stderr, "Failed to connect to database, reason:%s\n", taos_errstr(taos));
taos_close(taos); taos_close(taos);
return 1; return 1;
} }
......
...@@ -138,7 +138,7 @@ static int64_t totalDumpOutRows = 0; ...@@ -138,7 +138,7 @@ static int64_t totalDumpOutRows = 0;
SDbInfo **dbInfos = NULL; SDbInfo **dbInfos = NULL;
const char *argp_program_version = version; const char *argp_program_version = version;
const char *argp_program_bug_address = "<support@taosdata.com>"; const char *argp_program_bug_address = "<support@"DB_COMPANY".com>";
/* Program documentation. */ /* Program documentation. */
static char doc[] = ""; static char doc[] = "";
...@@ -159,13 +159,13 @@ static struct argp_option options[] = { ...@@ -159,13 +159,13 @@ static struct argp_option options[] = {
// connection option // connection option
{"host", 'h', "HOST", 0, "Server host dumping data from. Default is localhost.", 0}, {"host", 'h', "HOST", 0, "Server host dumping data from. Default is localhost.", 0},
{"user", 'u', "USER", 0, "User name used to connect to server. Default is root.", 0}, {"user", 'u', "USER", 0, "User name used to connect to server. Default is root.", 0},
{"password", 'p', "PASSWORD", 0, "User password to connect to server. Default is taosdata.", 0}, {"password", 'p', "PASSWORD", 0, "User password to connect to server. Default is "DB_COMPANY".", 0},
{"port", 'P', "PORT", 0, "Port to connect", 0}, {"port", 'P', "PORT", 0, "Port to connect", 0},
{"cversion", 'v', "CVERION", 0, "client version", 0}, {"cversion", 'v', "CVERION", 0, "client version", 0},
// input/output file // input/output file
{"outpath", 'o', "OUTPATH", 0, "Output file path.", 1}, {"outpath", 'o', "OUTPATH", 0, "Output file path.", 1},
{"inpath", 'i', "INPATH", 0, "Input file path.", 1}, {"inpath", 'i', "INPATH", 0, "Input file path.", 1},
{"config", 'c', "CONFIG_DIR", 0, "Configure directory. Default is /etc/taos/taos.cfg.", 1}, {"config", 'c', "CONFIG_DIR", 0, "Configure directory. Default is /etc/"DB_CLIENT_NAME"/"DB_CLIENT_NAME".cfg.", 1},
{"encode", 'e', "ENCODE", 0, "Input file encoding.", 1}, {"encode", 'e', "ENCODE", 0, "Input file encoding.", 1},
// dump unit options // dump unit options
{"all-databases", 'A', 0, 0, "Dump all databases.", 2}, {"all-databases", 'A', 0, 0, "Dump all databases.", 2},
...@@ -337,7 +337,7 @@ struct arguments tsArguments = { ...@@ -337,7 +337,7 @@ struct arguments tsArguments = {
// connection option // connection option
NULL, NULL,
"root", "root",
"taosdata", DB_COMPANY,
0, 0,
"", "",
// outpath and inpath // outpath and inpath
...@@ -644,7 +644,7 @@ int taosDumpOut(struct arguments *arguments) { ...@@ -644,7 +644,7 @@ int taosDumpOut(struct arguments *arguments) {
/* Connect to server */ /* Connect to server */
taos = taos_connect(arguments->host, arguments->user, arguments->password, NULL, arguments->port); taos = taos_connect(arguments->host, arguments->user, arguments->password, NULL, arguments->port);
if (taos == NULL) { if (taos == NULL) {
fprintf(stderr, "failed to connect to TDengine server\n"); fprintf(stderr, "failed to connect to database server\n");
goto _exit_failure; goto _exit_failure;
} }
...@@ -1457,7 +1457,7 @@ int taosCheckParam(struct arguments *arguments) { ...@@ -1457,7 +1457,7 @@ int taosCheckParam(struct arguments *arguments) {
if (arguments->arg_list_len == 0) { if (arguments->arg_list_len == 0) {
if ((!arguments->all_databases) && (!arguments->isDumpIn)) { if ((!arguments->all_databases) && (!arguments->isDumpIn)) {
fprintf(stderr, "taosdump requires parameters\n"); fprintf(stderr, DB_CLIENT_NAME"dump requires parameters\n");
return -1; return -1;
} }
} }
...@@ -2059,7 +2059,7 @@ int taosDumpIn(struct arguments *arguments) { ...@@ -2059,7 +2059,7 @@ int taosDumpIn(struct arguments *arguments) {
taos = taos_connect(arguments->host, arguments->user, arguments->password, NULL, arguments->port); taos = taos_connect(arguments->host, arguments->user, arguments->password, NULL, arguments->port);
if (taos == NULL) { if (taos == NULL) {
fprintf(stderr, "failed to connect to TDengine server\n"); fprintf(stderr, "failed to connect to database server\n");
return -1; return -1;
} }
......
...@@ -113,7 +113,7 @@ bool httpGenTaosdAuthToken(HttpContext *pContext, char *token, int maxLen) { ...@@ -113,7 +113,7 @@ bool httpGenTaosdAuthToken(HttpContext *pContext, char *token, int maxLen) {
free(encrypt); free(encrypt);
free(base64); free(base64);
httpTrace("context:%p, fd:%d, ip:%s, gen taosd token:%s", pContext, pContext->fd, pContext->ipstr, token); httpTrace("context:%p, fd:%d, ip:%s, gen %s token:%s", pContext, pContext->fd, pContext->ipstr, DB_SERVICE_NAME, token);
return true; return true;
} }
...@@ -358,7 +358,7 @@ void httpProcessRequestCb(void *param, TAOS_RES *result, int code) { ...@@ -358,7 +358,7 @@ void httpProcessRequestCb(void *param, TAOS_RES *result, int code) {
return; return;
} }
httpTrace("context:%p, fd:%d, ip:%s, user:%s, connect tdengine success, taos:%p", pContext, pContext->fd, httpTrace("context:%p, fd:%d, ip:%s, user:%s, connect database success, taos:%p", pContext, pContext->fd,
pContext->ipstr, pContext->user, pContext->taos); pContext->ipstr, pContext->user, pContext->taos);
if (pContext->taos == NULL) { if (pContext->taos == NULL) {
httpError("context:%p, fd:%d, ip:%s, user:%s, login error, taos is empty", pContext, pContext->fd, pContext->ipstr, httpError("context:%p, fd:%d, ip:%s, user:%s, login error, taos is empty", pContext, pContext->fd, pContext->ipstr,
...@@ -384,7 +384,7 @@ void httpProcessRequest(HttpContext *pContext) { ...@@ -384,7 +384,7 @@ void httpProcessRequest(HttpContext *pContext) {
pContext->reqType == HTTP_REQTYPE_LOGIN) { pContext->reqType == HTTP_REQTYPE_LOGIN) {
taos_connect_a(NULL, pContext->user, pContext->pass, "", 0, httpProcessRequestCb, (void *)pContext, taos_connect_a(NULL, pContext->user, pContext->pass, "", 0, httpProcessRequestCb, (void *)pContext,
&(pContext->taos)); &(pContext->taos));
httpTrace("context:%p, fd:%d, ip:%s, user:%s, try connect tdengine, taos:%p", pContext, pContext->fd, httpTrace("context:%p, fd:%d, ip:%s, user:%s, try connect database, taos:%p", pContext, pContext->fd,
pContext->ipstr, pContext->user, pContext->taos); pContext->ipstr, pContext->user, pContext->taos);
} else { } else {
httpAccessSession(pContext); httpAccessSession(pContext);
......
...@@ -154,8 +154,8 @@ void dnodeBuildMonitorSql(char *sql, int cmd) { ...@@ -154,8 +154,8 @@ void dnodeBuildMonitorSql(char *sql, int cmd) {
} else if (cmd == MONITOR_CMD_CREATE_MT_DN) { } else if (cmd == MONITOR_CMD_CREATE_MT_DN) {
snprintf(sql, SQL_LENGTH, snprintf(sql, SQL_LENGTH,
"create table if not exists %s.dn(ts timestamp" "create table if not exists %s.dn(ts timestamp"
", cpu_taosd float, cpu_system float, cpu_cores int" ", cpu_"DB_SERVICE_NAME" float, cpu_system float, cpu_cores int"
", mem_taosd float, mem_system float, mem_total int" ", mem_"DB_SERVICE_NAME" float, mem_system float, mem_total int"
", disk_used float, disk_total int" ", disk_used float, disk_total int"
", band_speed float" ", band_speed float"
", io_read float, io_write float" ", io_read float, io_write float"
......
...@@ -283,7 +283,7 @@ void taosGetSystemLocale() { ...@@ -283,7 +283,7 @@ void taosGetSystemLocale() {
void tsPrintOsInfo() {} void tsPrintOsInfo() {}
void taosKillSystem() { void taosKillSystem() {
tError("function taosKillSystem, exit!"); tError("function %sKillSystem, exit!", DB_CLIENT_NAME);
exit(0); exit(0);
} }
......
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
#include "tutil.h" #include "tutil.h"
#include "ttimer.h" #include "ttimer.h"
char configDir[TSDB_FILENAME_LEN] = "/etc/taos"; char configDir[TSDB_FILENAME_LEN] = "/etc/"DB_CLIENT_NAME;
char tsDirectory[TSDB_FILENAME_LEN] = "/var/lib/taos"; char tsDirectory[TSDB_FILENAME_LEN] = "/var/lib/"DB_CLIENT_NAME;
char dataDir[TSDB_FILENAME_LEN] = "/var/lib/taos"; char dataDir[TSDB_FILENAME_LEN] = "/var/lib/"DB_CLIENT_NAME;
char logDir[TSDB_FILENAME_LEN] = "/var/log/taos"; char logDir[TSDB_FILENAME_LEN] = "/var/log/"DB_CLIENT_NAME;
char scriptDir[TSDB_FILENAME_LEN] = "/etc/taos"; char scriptDir[TSDB_FILENAME_LEN] = "/etc/"DB_CLIENT_NAME;
char osName[] = "Linux"; char osName[] = "Linux";
int64_t str2int64(char *str) { int64_t str2int64(char *str) {
......
...@@ -589,7 +589,7 @@ void tsPrintOsInfo() { ...@@ -589,7 +589,7 @@ void tsPrintOsInfo() {
void taosKillSystem() { void taosKillSystem() {
// SIGINT // SIGINT
pPrint("taosd will shut down soon"); pPrint("%s will shut down soon", DB_SERVICE_NAME);
kill(tsProcId, 2); kill(tsProcId, 2);
} }
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
#include <winbase.h> #include <winbase.h>
#include <Winsock2.h> #include <Winsock2.h>
char configDir[TSDB_FILENAME_LEN] = "C:/TDengine/cfg"; char configDir[TSDB_FILENAME_LEN] = "C:/"DB_FULL_NAME"/cfg";
char tsDirectory[TSDB_FILENAME_LEN] = "C:/TDengine/data"; char tsDirectory[TSDB_FILENAME_LEN] = "C:/"DB_FULL_NAME"/data";
char logDir[TSDB_FILENAME_LEN] = "C:/TDengine/log"; char logDir[TSDB_FILENAME_LEN] = "C:/"DB_FULL_NAME"/log";
char dataDir[TSDB_FILENAME_LEN] = "C:/TDengine/data"; char dataDir[TSDB_FILENAME_LEN] = "C:/"DB_FULL_NAME"/data";
char scriptDir[TSDB_FILENAME_LEN] = "C:/TDengine/script"; char scriptDir[TSDB_FILENAME_LEN] = "C:/"DB_FULL_NAME"/script";
char osName[] = "Windows"; char osName[] = "Windows";
bool taosCheckPthreadValid(pthread_t thread) { bool taosCheckPthreadValid(pthread_t thread) {
......
...@@ -37,9 +37,9 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ...@@ -37,9 +37,9 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/cfg/ COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/cfg/
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/log/ COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/log/
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/data/ COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/data/
COMMAND ${CMAKE_COMMAND} -E echo dataDir ${TD_TESTS_OUTPUT_DIR}/data > ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg COMMAND ${CMAKE_COMMAND} -E echo dataDir ${TD_TESTS_OUTPUT_DIR}/data > ${TD_TESTS_OUTPUT_DIR}/cfg/${DB_CLIENT_NAME}.cfg
COMMAND ${CMAKE_COMMAND} -E echo logDir ${TD_TESTS_OUTPUT_DIR}/log >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg COMMAND ${CMAKE_COMMAND} -E echo logDir ${TD_TESTS_OUTPUT_DIR}/log >> ${TD_TESTS_OUTPUT_DIR}/cfg/${DB_CLIENT_NAME}.cfg
COMMAND ${CMAKE_COMMAND} -E echo charset UTF-8 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg COMMAND ${CMAKE_COMMAND} -E echo charset UTF-8 >> ${TD_TESTS_OUTPUT_DIR}/cfg/${DB_CLIENT_NAME}.cfg
COMMENT "prepare ${DB_SERVICE_NAME} environment") COMMENT "prepare ${DB_SERVICE_NAME} environment")
ADD_CUSTOM_TARGET(${PREPARE_ENV_TARGET} ALL WORKING_DIRECTORY ${TD_EXECUTABLE_OUTPUT_PATH} DEPENDS ${PREPARE_ENV_CMD}) ADD_CUSTOM_TARGET(${PREPARE_ENV_TARGET} ALL WORKING_DIRECTORY ${TD_EXECUTABLE_OUTPUT_PATH} DEPENDS ${PREPARE_ENV_CMD})
......
...@@ -33,13 +33,13 @@ void signal_handler(int signum, siginfo_t *sigInfo, void *context) { ...@@ -33,13 +33,13 @@ void signal_handler(int signum, siginfo_t *sigInfo, void *context) {
return; return;
} }
syslog(LOG_INFO, "Shut down signal is %d", signum); syslog(LOG_INFO, "Shut down signal is %d", signum);
syslog(LOG_INFO, "Shutting down TDengine service..."); syslog(LOG_INFO, "Shutting down "DB_FULL_NAME" service...");
// clean the system. // clean the system.
dPrint("shut down signal is %d, sender PID:%d", signum, sigInfo->si_pid); dPrint("shut down signal is %d, sender PID:%d", signum, sigInfo->si_pid);
dnodeCleanUpSystem(); dnodeCleanUpSystem();
// close the syslog // close the syslog
syslog(LOG_INFO, "Shut down TDengine service successfully"); syslog(LOG_INFO, "Shut down "DB_FULL_NAME" service successfully");
dPrint("TDengine is shut down!"); dPrint("%s is shut down!", DB_FULL_NAME);
closelog(); closelog();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
...@@ -92,19 +92,19 @@ int main(int argc, char *argv[]) { ...@@ -92,19 +92,19 @@ int main(int argc, char *argv[]) {
// sigaction(SIGABRT, &act, NULL); // sigaction(SIGABRT, &act, NULL);
// Open /var/log/syslog file to record information. // Open /var/log/syslog file to record information.
openlog("TDengine:", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1); openlog(DB_FULL_NAME":", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1);
syslog(LOG_INFO, "Starting TDengine service..."); syslog(LOG_INFO, "Starting "DB_FULL_NAME" service...");
// Initialize the system // Initialize the system
if (dnodeInitSystem() < 0) { if (dnodeInitSystem() < 0) {
syslog(LOG_ERR, "Error initialize TDengine system"); syslog(LOG_ERR, "Error initialize "DB_FULL_NAME" system");
closelog(); closelog();
dnodeCleanUpSystem(); dnodeCleanUpSystem();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
syslog(LOG_INFO, "Started TDengine service successfully."); syslog(LOG_INFO, "Started "DB_FULL_NAME" service successfully.");
while (1) { while (1) {
sleep(1000); sleep(1000);
......
...@@ -119,17 +119,17 @@ int dnodeInitSystem() { ...@@ -119,17 +119,17 @@ int dnodeInitSystem() {
if (stat(logDir, &dirstat) < 0) mkdir(logDir, 0755); if (stat(logDir, &dirstat) < 0) mkdir(logDir, 0755);
sprintf(temp, "%s/taosdlog", logDir); sprintf(temp, "%s/%slog", logDir, DB_SERVICE_NAME);
if (taosInitLog(temp, tsNumOfLogLines, 1) < 0) printf("failed to init log file\n"); if (taosInitLog(temp, tsNumOfLogLines, 1) < 0) printf("failed to init log file\n");
if (!tsReadGlobalConfig()) { // TODO : Change this function if (!tsReadGlobalConfig()) { // TODO : Change this function
tsPrintGlobalConfig(); tsPrintGlobalConfig();
dError("TDengine read global config failed"); dError("%s read global config failed", DB_FULL_NAME);
return -1; return -1;
} }
if (taosCreateTierDirectory() != 0) { if (taosCreateTierDirectory() != 0) {
dError("TDengine init tier directory failed"); dError("%s init tier directory failed", DB_FULL_NAME);
return -1; return -1;
} }
...@@ -145,7 +145,7 @@ int dnodeInitSystem() { ...@@ -145,7 +145,7 @@ int dnodeInitSystem() {
dnodeInitModules(); dnodeInitModules();
pthread_mutex_init(&dmutex, NULL); pthread_mutex_init(&dmutex, NULL);
dPrint("starting to initialize TDengine ..."); dPrint("starting to initialize %s ...", DB_FULL_NAME);
vnodeInitQHandle(); vnodeInitQHandle();
if (dnodeInitSystemSpec() < 0) { if (dnodeInitSystemSpec() < 0) {
...@@ -155,14 +155,14 @@ int dnodeInitSystem() { ...@@ -155,14 +155,14 @@ int dnodeInitSystem() {
for (int mod = 0; mod < TSDB_MOD_MAX; ++mod) { for (int mod = 0; mod < TSDB_MOD_MAX; ++mod) {
if (tsModule[mod].num != 0 && tsModule[mod].initFp) { if (tsModule[mod].num != 0 && tsModule[mod].initFp) {
if ((*tsModule[mod].initFp)() != 0) { if ((*tsModule[mod].initFp)() != 0) {
dError("TDengine initialization failed"); dError("%s initialization failed", DB_FULL_NAME);
return -1; return -1;
} }
} }
} }
if (vnodeInitSystem() != 0) { if (vnodeInitSystem() != 0) {
dError("TDengine vnodes initialization failed"); dError("%s vnodes initialization failed", DB_FULL_NAME);
return -1; return -1;
} }
...@@ -170,7 +170,7 @@ int dnodeInitSystem() { ...@@ -170,7 +170,7 @@ int dnodeInitSystem() {
dnodeStartModuleSpec(); dnodeStartModuleSpec();
dPrint("TDengine is initialized successfully"); dPrint("%s is initialized successfully", DB_FULL_NAME);
return 0; return 0;
} }
......
...@@ -68,7 +68,7 @@ void mgmtCleanUpSystem() { ...@@ -68,7 +68,7 @@ void mgmtCleanUpSystem() {
} }
int mgmtStartSystem() { int mgmtStartSystem() {
mPrint("starting to initialize TDengine mgmt ..."); mPrint("starting to initialize database mgmt ...");
struct stat dirstat; struct stat dirstat;
if (stat(mgmtDirectory, &dirstat) < 0) { if (stat(mgmtDirectory, &dirstat) < 0) {
...@@ -147,7 +147,7 @@ int mgmtStartSystem() { ...@@ -147,7 +147,7 @@ int mgmtStartSystem() {
mgmtStartMgmtTimer(); mgmtStartMgmtTimer();
mPrint("TDengine mgmt is initialized successfully"); mPrint("database mgmt is initialized successfully");
return 0; return 0;
} }
...@@ -59,7 +59,7 @@ void mgmtCheckAcct() { ...@@ -59,7 +59,7 @@ void mgmtCheckAcct() {
pAcct->acctId = 0; pAcct->acctId = 0;
strcpy(pAcct->user, "root"); strcpy(pAcct->user, "root");
mgmtCreateUser(pAcct, "root", "taosdata"); mgmtCreateUser(pAcct, "root", DB_COMPANY);
mgmtCreateUser(pAcct, "monitor", tsInternalPass); mgmtCreateUser(pAcct, "monitor", tsInternalPass);
mgmtCreateUser(pAcct, "_root", tsInternalPass); mgmtCreateUser(pAcct, "_root", tsInternalPass);
} }
......
...@@ -119,7 +119,7 @@ char tsMgmtZone[16] = "rzone"; ...@@ -119,7 +119,7 @@ char tsMgmtZone[16] = "rzone";
char tsLocalIp[TSDB_IPv4ADDR_LEN] = {0}; char tsLocalIp[TSDB_IPv4ADDR_LEN] = {0};
char tsDefaultDB[TSDB_DB_NAME_LEN] = {0}; char tsDefaultDB[TSDB_DB_NAME_LEN] = {0};
char tsDefaultUser[64] = "root"; char tsDefaultUser[64] = "root";
char tsDefaultPass[64] = "taosdata"; char tsDefaultPass[64] = DB_COMPANY;
int tsMaxMeterConnections = 10000; int tsMaxMeterConnections = 10000;
int tsMaxMgmtConnections = 2000; int tsMaxMgmtConnections = 2000;
int tsMaxVnodeConnections = 10000; int tsMaxVnodeConnections = 10000;
...@@ -863,13 +863,13 @@ void tsReadGlobalLogConfig() { ...@@ -863,13 +863,13 @@ void tsReadGlobalLogConfig() {
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) { if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
strcpy(configDir, full_path.we_wordv[0]); strcpy(configDir, full_path.we_wordv[0]);
} else { } else {
printf("configDir:%s not there, use default value: /etc/taos", configDir); printf("configDir:%s not there, use default value: /etc/%s", configDir, DB_CLIENT_NAME);
strcpy(configDir, "/etc/taos"); sprintf(configDir, "/etc/%s", DB_CLIENT_NAME);
} }
wordfree(&full_path); wordfree(&full_path);
tsReadLogOption("logDir", logDir); tsReadLogOption("logDir", logDir);
sprintf(fileName, "%s/taos.cfg", configDir); sprintf(fileName, "%s/%s.cfg", configDir, DB_CLIENT_NAME);
fp = fopen(fileName, "r"); fp = fopen(fileName, "r");
if (fp == NULL) { if (fp == NULL) {
printf("\noption file:%s not found, all options are set to system default\n", fileName); printf("\noption file:%s not found, all options are set to system default\n", fileName);
...@@ -909,7 +909,7 @@ bool tsReadGlobalConfig() { ...@@ -909,7 +909,7 @@ bool tsReadGlobalConfig() {
int olen, vlen, vlen1; int olen, vlen, vlen1;
char fileName[128]; char fileName[128];
sprintf(fileName, "%s/taos.cfg", configDir); sprintf(fileName, "%s/%s.cfg", configDir, DB_CLIENT_NAME);
fp = fopen(fileName, "r"); fp = fopen(fileName, "r");
if (fp == NULL) { if (fp == NULL) {
} else { } else {
...@@ -1061,7 +1061,7 @@ int tsCfgDynamicOptions(char *msg) { ...@@ -1061,7 +1061,7 @@ int tsCfgDynamicOptions(char *msg) {
} }
void tsPrintGlobalConfig() { void tsPrintGlobalConfig() {
pPrint(" taos config & system info:"); pPrint(" %s config & system info:", DB_CLIENT_NAME);
pPrint("=================================="); pPrint("==================================");
for (int i = 0; i < tsGlobalConfigNum; ++i) { for (int i = 0; i < tsGlobalConfigNum; ++i) {
......
char version[64] = "1.6.6.1"; char version[64] = "1.6.6.1";
char compatible_version[64] = "1.6.0.0"; char compatible_version[64] = "1.6.0.0";
char gitinfo[128] = "0b5b412ef0ae2449ece538601a29b899b2b727b9"; char gitinfo[128] = "feea817446e25ff1ef77cefaeeda08f45564d6bc";
char gitinfoOfInternal[128] = "8ae0d83a3610b9b4726373dd3073e4a8f444fb26"; char gitinfoOfInternal[128] = "5c736133836e7a9f757216539986ddf746439a11";
char buildinfo[512] = "Built by root at 2020-03-11 09:08"; char buildinfo[512] = "Built by root at 2020-03-13 16:27";
void libtaos_1_6_6_1_Linux_x64_beta() {}; void libtaos_1_6_6_1_Linux_x64() {};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册