diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index cf11b6018..7b75c15a9 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -94,7 +94,7 @@ throw runtime_error("CALPONT_INTERNAL_ERROR"); \ #if CSC_DEBUG namespace { - string tmpDir = startup::StartUp::installDir() + "csc.log"; + string tmpDir = startup::StartUp::tmpDir() + "/csc.log"; std::ofstream csclog(tmpDir, std::ios::app); } #define DEBUG csclog diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 25452dada..38e21cb8b 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -170,7 +170,7 @@ rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1 #get temp base directory tmpDir="/tmp" if [ $user != "root" ]; then - tmpDir=$HOME"./tmp" + tmpDir=$HOME"/.tmp" mkdir $tmpDir >/dev/null 2>&1 else #get columnstore temp file directory name @@ -264,12 +264,17 @@ else chown $user:$user $installdir/etc/Columnstore.xml - echo "" - echo "NOTE: For non-root install, you will need to run the following command as root user to" - echo " setup the MariaDB ColumnStore System Logging" - echo "" - echo " $installdir/bin/syslogSetup.sh --installdir=$installdir --user=$user install" - echo "" +cat < /dev/null 2>&1 $installdir/myql/columnstore-Mysql stop > /dev/null 2>&1 -export COLUMNSTORE_INSTALL_DIR=$installdir +if [ $user != "root" ]; then + export COLUMNSTORE_INSTALL_DIR=$installdir + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib:$installdir/mysql/lib +fi -cloud=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation Cloud` +cloud=`$installdir/bin/getConfig Installation Cloud` if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then if test -f /etc/fstab ; then sed -i '/Columnstore\/data/d' /etc/fstab > /dev/null 2>&1 @@ -76,13 +79,13 @@ $installdir/bin/clearShm > /dev/null 2>&1 tmpDir=`$installdir/bin/getConfig SystemConfig SystemTempFileDir` # delete tmp files -rm -rf $tmpDir +rm -rf $tmpDir/* rm -f $installdir/local/*.columnstore rm -rf $installdir/local/etc/ rm -f $installdir/data/bulk${tmpDir}job/* >/dev/null 2>&1 rm -f $installdir/local/moveDbrootTransactionLog -lockdir=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation LockFileDirectory` +lockdir=`$installdir/bin/getConfig Installation LockFileDirectory` rm -f $lockdir/columnstore rm -f $lockdir/mysql-Columnstore @@ -138,13 +141,18 @@ if [ $user = "root" ]; then ldconfig else rm -f /etc/default/columnstore - - echo "" - echo "NOTE: For non-root install, you will need to run the following command as root user to" - echo " uninstall the MariaDB ColumnStore System Logging" - echo "" - echo " $installdir/bin/syslogSetup.sh --installdir=$installdir --user=$user uninstall" - echo "" + +cat </dev/null 2>&1 sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1 diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index 5a9b000e4..20ec493a5 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -68,6 +68,7 @@ bool rootUser = true; string HOME = "/root"; string SingleServerInstall; string tmpDir; +string installDir; bool repeatStop; @@ -189,7 +190,10 @@ int main(int argc, char* argv[]) string ccHistoryFile = HOME + "/.cc_history"; - string cf = startup::StartUp::installDir() + "/etc/" + ConsoleCmdsFile; + tmpDir = startup::StartUp::tmpDir(); + installDir = startup::StartUp::installDir(); + + string cf = installDir + "/etc/" + ConsoleCmdsFile; fConfig = Config::makeConfig(cf); // setupSignalHandlers(); @@ -236,8 +240,6 @@ int main(int argc, char* argv[]) if (user != 0) rootUser = false; - tmpDir = startup::StartUp::tmpDir(); - // create/open command log file if not created logFile.open(DEFAULT_LOG_FILE.c_str(), ios::app); @@ -2600,7 +2602,7 @@ int processCommand(string* arguments) { string logFile = tmpDir + "/cc-stop.pdsh"; - cmd = "pdsh -a '/" + startup::StartUp::installDir() + "/bin/columnstore stop' > " + logFile + " 2>&1"; + cmd = "pdsh -a '/" + installDir + "/bin/columnstore stop' > " + logFile + " 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus(logFile, "exit") ) @@ -2610,7 +2612,7 @@ int processCommand(string* arguments) } else { - cmd = startup::StartUp::installDir() + "/bin/columnstore stop > " + tmpDir + "/status.log"; + cmd = installDir + "/bin/columnstore stop > " + tmpDir + "/status.log"; system(cmd.c_str()); } } @@ -2620,7 +2622,7 @@ int processCommand(string* arguments) if ( gracefulTemp == FORCEFUL ) { - cmd = startup::StartUp::installDir() + "/bin/columnstore stop > " + tmpDir + "/status.log"; + cmd = installDir + "/bin/columnstore stop > " + tmpDir + "/status.log"; system(cmd.c_str()); cout << endl << " Successful shutdown of System (stopped local columnstore service) " << endl << endl; } @@ -2628,7 +2630,7 @@ int processCommand(string* arguments) if (Failed.find("Connection refused") != string::npos) { cout << endl << "**** shutdownSystem Error : ProcessManager not Active, stopping columnstore service" << endl; - cmd = startup::StartUp::installDir() + "/bin/columnstore stop > " + tmpDir + "/status.log"; + cmd = installDir + "/bin/columnstore stop > " + tmpDir + "/status.log"; system(cmd.c_str()); cout << endl << " Successful stop of local columnstore service " << endl << endl; } @@ -2650,7 +2652,7 @@ int processCommand(string* arguments) if ( DBRootStorageType == "hdfs") { string logFile = tmpDir + "cc-stop.pdsh"; - cmd = "pdsh -a '" + startup::StartUp::installDir() + "/bin/columnstore stop' > " + logFile + " 2>&1"; + cmd = "pdsh -a '" + installDir + "/bin/columnstore stop' > " + logFile + " 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus(logFile, "exit") ) @@ -2757,7 +2759,7 @@ int processCommand(string* arguments) if ( DBRootStorageType == "hdfs") { string logFile = tmpDir + "/cc-restart.pdsh"; - cmd = "pdsh -a '" + startup::StartUp::installDir() + "/bin/columnstore restart' > " + logFile + " 2>&1"; + cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > " + logFile + " 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus(logFile, "exit") ) @@ -2794,7 +2796,7 @@ int processCommand(string* arguments) if ( modulename == localModule ) { - cmd = startup::StartUp::installDir() + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; + cmd = installDir + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; int rtnCode = system(cmd.c_str()); if (geteuid() == 0 && WEXITSTATUS(rtnCode) != 0) @@ -2812,7 +2814,7 @@ int processCommand(string* arguments) for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++) { //run remote command script - cmd = startup::StartUp::installDir() + "/bin/remote_command.sh " + (*pt1).IPAddr + " " + password + " '" + startup::StartUp::installDir() + "/bin/columnstore restart' 0"; + cmd = installDir + "/bin/remote_command.sh " + (*pt1).IPAddr + " " + password + " '" + installDir + "/bin/columnstore restart' 0"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) < 0) @@ -2821,7 +2823,7 @@ int processCommand(string* arguments) cout << endl << "**** startSystem Failed" << endl; // stop local columnstore service - cmd = startup::StartUp::installDir() + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; + cmd = installDir + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; system(cmd.c_str()); FAILED = true; @@ -2835,7 +2837,7 @@ int processCommand(string* arguments) cout << endl << "**** startSystem Failed" << endl; // stop local columnstore service - cmd = startup::StartUp::installDir() + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; + cmd = installDir + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; system(cmd.c_str()); FAILED = true; @@ -2861,7 +2863,7 @@ int processCommand(string* arguments) //just kick off local server cout << endl << " System being started, please wait..."; cout.flush(); - cmd = startup::StartUp::installDir() + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; + cmd = installDir + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; int rtnCode = system(cmd.c_str()); if (geteuid() == 0 && WEXITSTATUS(rtnCode) != 0) @@ -2999,7 +3001,7 @@ int processCommand(string* arguments) if ( DBRootStorageType == "hdfs") { string logFile = tmpDir + "/cc-restart.pdsh"; - cmd = "pdsh -a '" + startup::StartUp::installDir() + "/bin/columnstore restart' > " + logFile + " 2>&1"; + cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > " + logFile + " 2>&1"; system(cmd.c_str()); if (oam.checkLogStatus(logFile, "exit") ) @@ -3042,7 +3044,7 @@ int processCommand(string* arguments) for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++) { //run remote command script - cmd = startup::StartUp::installDir() + "/bin/remote_command.sh " + (*pt1).IPAddr + " " + password + " '" + startup::StartUp::installDir() + "/bin/columnstore restart' 0"; + cmd = installDir + "/bin/remote_command.sh " + (*pt1).IPAddr + " " + password + " '" + installDir + "/bin/columnstore restart' 0"; int rtnCode = system(cmd.c_str()); @@ -3052,7 +3054,7 @@ int processCommand(string* arguments) cout << endl << "**** restartSystem Failed" << endl; // stop local columnstore service - cmd = startup::StartUp::installDir() + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; + cmd = installDir + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; system(cmd.c_str()); FAILED = true; @@ -3067,7 +3069,7 @@ int processCommand(string* arguments) FAILED = true; // stop local columnstore service - cmd = startup::StartUp::installDir() + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; + cmd = installDir + "/bin/columnstore stop > " + tmpDir + "/stop.log 2>&1"; system(cmd.c_str()); break; @@ -3083,7 +3085,7 @@ int processCommand(string* arguments) break; //RESTART LOCAL HOST - cmd = startup::StartUp::installDir() + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; + cmd = installDir + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; int rtnCode = system(cmd.c_str()); if (geteuid() == 0 && WEXITSTATUS(rtnCode) != 0) @@ -3103,7 +3105,7 @@ int processCommand(string* arguments) //just kick off local server cout << " System being restarted, please wait..."; cout.flush(); - cmd = startup::StartUp::installDir() + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; + cmd = installDir + "/bin/columnstore restart > " + tmpDir + "/start.log 2>&1"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) @@ -4926,10 +4928,10 @@ int processCommand(string* arguments) case 39: // getSystemDirectories { - cout << endl << "System Installation and Temporary Logging Directories" << endl << endl; + cout << endl << "System Installation and Temporary File Directories" << endl << endl; - cout << "System Installation Directory = " << startup::StartUp::installDir() << endl; - cout << "System Temporary Logging Directory = " << tmpDir << endl << endl; + cout << "System Installation Directory = " << installDir << endl; + cout << "System Temporary File Directory = " << tmpDir << endl << endl; } break; @@ -6148,13 +6150,13 @@ int processCommand(string* arguments) ++it) { string deviceName = *it; - string entry = deviceName + " " + startup::StartUp::installDir() + "/gluster/brick" + oam.itoa(brickID) + " " + deviceType + " defaults 1 2"; + string entry = deviceName + " " + installDir + "/gluster/brick" + oam.itoa(brickID) + " " + deviceType + " defaults 1 2"; //send update pm oam.distributeFstabUpdates(entry, moduleName); } } - string command = startup::StartUp::installDir() + "/bin/remote_command.sh " + (*hostConfigIter).IPAddr + " " + password + " 'mkdir -p " + startup::StartUp::installDir() + "/gluster/brick" + oam.itoa(brickID) + "'"; + string command = installDir + "/bin/remote_command.sh " + (*hostConfigIter).IPAddr + " " + password + " 'mkdir -p " + installDir + "/gluster/brick" + oam.itoa(brickID) + "'"; system(command.c_str()); brickID++; } @@ -7866,7 +7868,7 @@ int processCommand(string* arguments) oam.startModule(devicenetworklist, ackTemp); //reload DBRM with new configuration, needs to be done here after startModule - cmd = startup::StartUp::installDir() + "/bin/dbrmctl reload > /dev/null 2>&1"; + cmd = installDir + "/bin/dbrmctl reload > /dev/null 2>&1"; system(cmd.c_str()); sleep(15); @@ -8182,7 +8184,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) //run remote command script HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); - cmd = startup::StartUp::installDir() + "/bin/remote_command.sh " + (*pt1).IPAddr + " " + password + " reboot " ; + cmd = installDir + "/bin/remote_command.sh " + (*pt1).IPAddr + " " + password + " reboot " ; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) @@ -8301,7 +8303,7 @@ int ProcessSupportCommand(int CommandID, std::string arguments[]) HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); string ipAddr = (*pt1).IPAddr; //run remote command script - cmd = startup::StartUp::installDir() + "/bin/remote_command.sh " + ipAddr + " " + password + " reboot " ; + cmd = installDir + "/bin/remote_command.sh " + ipAddr + " " + password + " reboot " ; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) @@ -9427,7 +9429,7 @@ void printModuleDisk(ModuleDisk moduledisk) cout << "Mount Point Total Blocks Used Blocks Usage %" << endl; cout << "----------------------------- ------------ ------------ -------" << endl; - string etcdir = startup::StartUp::installDir() + "/etc"; + string etcdir = installDir + "/etc"; for ( unsigned int i = 0 ; i < moduledisk.diskusage.size(); i++) { @@ -9468,7 +9470,7 @@ void printModuleDisk(ModuleDisk moduledisk) void printModuleResources(TopProcessCpuUsers topprocesscpuusers, ModuleCpu modulecpu, TopProcessMemoryUsers topprocessmemoryusers, ModuleMemory modulememory, ModuleDisk moduledisk) { Oam oam; - string etcdir = startup::StartUp::installDir() + "/etc"; + string etcdir = installDir + "/etc"; cout << endl << "Module '" + topprocesscpuusers.ModuleName + "' Resource Usage" << endl << endl; diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 6ffef9012..bf967d5f9 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -3621,7 +3621,7 @@ int main(int argc, char* argv[]) if ( remote_installer_debug == "1" ) { - logfile = tmpDir; + logfile = tmpDir + "/"; logfile += remoteModuleName + "_" + EEPackageType + "_install.log"; debug_logfile = " > " + logfile; } @@ -3928,7 +3928,7 @@ int main(int argc, char* argv[]) if (hdfs && !nonDistribute ) { - string postConfigurePsdhLog = tmpDir + "postConfigure.pdsh.log"; + string postConfigurePsdhLog = tmpDir + "/postConfigure.pdsh.log"; cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl; string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > " + postConfigurePsdhLog + " 2>&1"; @@ -4022,7 +4022,7 @@ int main(int argc, char* argv[]) } } - string dbbuilderLog = tmpDir + "dbbuilder.log"; + string dbbuilderLog = tmpDir + "/dbbuilder.log"; if (hdfs) cmd = "bash -c '. " + installDir + "/bin/" + DataFileEnvFile + ";" + installDir + "/bin/dbbuilder 7 > " + dbbuilderLog; diff --git a/utils/startup/installdir.cpp b/utils/startup/installdir.cpp index 1229f6e58..f17740ca2 100644 --- a/utils/startup/installdir.cpp +++ b/utils/startup/installdir.cpp @@ -124,7 +124,9 @@ const string StartUp::tmpDir() else { // non-root user - *fTmpDirp = homedir + "/.tmp"; + fTmpDirp = new string(homedir); + + *fTmpDirp = *fTmpDirp + "/.tmp"; } #endif