1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00
This commit is contained in:
David Hill
2018-09-21 14:44:12 -05:00
parent 81e35e35eb
commit 72f514ca54
10 changed files with 138 additions and 74 deletions

View File

@ -35,6 +35,10 @@ using namespace oam;
#include "helpers.h"
using namespace installer;
#include "installdir.h"
extern string mysqlpw;
string pwprompt = " ";
@ -45,6 +49,7 @@ string prompt;
const char* pcommand = 0;
extern string installDir;
extern bool noPrompting;
namespace installer
@ -247,12 +252,15 @@ void mysqlSetup()
{
Oam oam;
string cmd;
cmd = installDir + "/bin/post-mysqld-install --installdir=" + installDir + " > /tmp/post-mysqld-install.log 2>&1";
string tmpDir = startup::StartUp::tmpDir();
cmd = installDir + "/bin/post-mysqld-install --installdir=" + installDir + " > " + tmpDir + "/post-mysqld-install.log 2>&1";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
{
cout << "Error running post-mysqld-install, check /tmp/post-mysqld-install.log" << endl;
cout << "Error running post-mysqld-install, check " << tmpDir << "/post-mysqld-install.log" << endl;
cout << "Exiting..." << endl;
exit (1);
}
@ -276,7 +284,7 @@ void mysqlSetup()
HOME = p;
}
cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " > /tmp/post-mysql-install.log";;
cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " --tmpdir=" + tmpDir + " > " + tmpDir + "/post-mysql-install.log";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) == 2)
@ -287,7 +295,7 @@ void mysqlSetup()
}
else if (WEXITSTATUS(rtnCode) == 1)
{
cout << "Error running post-mysql-install, /tmp/post-mysql-install.log" << endl;
cout << "Error running post-mysql-install, " + tmpDir + "/post-mysql-install.log" << endl;
cout << "Exiting..." << endl;
exit (1);
}
@ -375,7 +383,9 @@ int sendUpgradeRequest(int IserverTypeInstall, bool pmwithum)
if ( returnStatus != API_SUCCESS)
{
cout << "ERROR: Error return in running the MariDB Columnstore Upgrade, check /tmp/upgrade*.logs on " << (*pt).DeviceName << endl;
string tmpDir = startup::StartUp::tmpDir();
cout << "ERROR: Error return in running the MariDB Columnstore Upgrade, check " + tmpDir + "/upgrade*.logs on " << (*pt).DeviceName << endl;
return returnStatus;
}
}
@ -404,6 +414,8 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm
SystemModuleTypeConfig systemmoduletypeconfig;
string tmpDir = startup::StartUp::tmpDir();
try
{
oam.getSystemConfig(systemmoduletypeconfig);
@ -478,7 +490,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm
if ( returnStatus != API_SUCCESS)
{
cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master DB Distribute, check /tmp/master-dist*.logs on " << masterModule << endl;
cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master DB Distribute, check " + tmpDir + "/master-dist*.logs on " << masterModule << endl;
return returnStatus;
}
@ -491,7 +503,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm
if ( returnStatus != API_SUCCESS)
{
cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master replication, check /tmp/master-rep*.logs on " << masterModule << endl;
cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master replication, check " + tmpDir + "master-rep*.logs on " << masterModule << endl;
return returnStatus;
}
@ -526,7 +538,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm
if ( returnStatus != API_SUCCESS)
{
cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Slave replication, check /tmp/slave-rep*.logs on " << (*pt).DeviceName << endl;
cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Slave replication, check " + tmpDir + "/slave-rep*.logs on " << (*pt).DeviceName << endl;
return returnStatus;
}
@ -728,12 +740,14 @@ void checkMysqlPort( std::string& mysqlPort, Config* sysConfig )
{
Oam oam;
string tmpDir = startup::StartUp::tmpDir();
while (true)
{
string cmd = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > /tmp/mysqlport";
string cmd = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > " + tmpDir + "/mysqlport";
system(cmd.c_str());
string fileName = "/tmp/mysqlport";
string fileName = tmpDir + "/mysqlport";
ifstream oldFile (fileName.c_str());
if (oldFile)
@ -813,9 +827,11 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string
bool inUse = false;
string tmpDir = startup::StartUp::tmpDir();
while (true)
{
string localnetstat = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > /tmp/mysqlport";
string localnetstat = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > " + tmpDir + "/mysqlport";
string remotenetstat = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN";
//first check local mysql, if needed
@ -823,7 +839,7 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string
( ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM ) && pmwithum ) )
{
system(localnetstat.c_str());
string fileName = "/tmp/mysqlport";
string fileName = tmpDir + "/mysqlport";
ifstream oldFile (fileName.c_str());
if (oldFile)

View File

@ -80,6 +80,7 @@ using namespace config;
#include "helpers.h"
using namespace installer;
#include "installdir.h"
typedef struct DBRoot_Module_struct
{
@ -195,6 +196,7 @@ bool amazon_quick_install = false;
string DataFileEnvFile;
string installDir;
string tmpDir;
string HOME = "/root";
extern string pwprompt;
@ -287,7 +289,8 @@ int main(int argc, char* argv[])
if (p && *p)
HOME = p;
}
tmpDir = startup::StartUp::tmpDir();
for ( int i = 1; i < argc; i++ )
{
@ -568,18 +571,20 @@ int main(int argc, char* argv[])
EEPackageType = "binary";
else
{
int rtnCode = system("rpm -qi mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1");
string cmd = "rpm -qi mariadb-columnstore-platform > " + tmpDir + "/columnstore.txt 2>&1";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) == 0)
EEPackageType = "rpm";
else {
string cmd = "dpkg -s mariadb-columnstore-platform > " + tmpDir + "/columnstore.txt 2>&1";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) == 0)
EEPackageType = "rpm";
else {
rtnCode = system("dpkg -s mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1");
if (WEXITSTATUS(rtnCode) == 0)
EEPackageType = "deb";
else
EEPackageType = "binary";
}
EEPackageType = "deb";
else
EEPackageType = "binary";
}
}
try {
@ -701,11 +706,11 @@ int main(int argc, char* argv[])
// run my.cnf upgrade script
if ( reuseConfig == "y" )
{
cmd = installDir + "/bin/mycnfUpgrade > /tmp/mycnfUpgrade.log 2>&1";
cmd = installDir + "/bin/mycnfUpgrade > " + tmpDir + "/mycnfUpgrade.log 2>&1";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
cout << "Error: Problem upgrade my.cnf, check /tmp/mycnfUpgrade.log" << endl;
cout << "Error: Problem upgrade my.cnf, check " << tmpDir << "/mycnfUpgrade.log" << endl;
else
cout << "NOTE: my.cnf file was upgraded based on my.cnf.rpmsave" << endl;
}
@ -1336,19 +1341,21 @@ int main(int argc, char* argv[])
if (!multi_server_quick_install)
{
system("aws --version > /tmp/amazon.log 2>&1");
string amazonLog = tmpDir + "/amazon.log";
string cmd = "aws --version > " + amazonLog + " 2>&1";
int rtnCode = system(cmd.c_str());
ifstream in("/tmp/amazon.log");
ifstream in(amazonLog);
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not found"))
if ( size == 0 || oam.checkLogStatus(amazonLog, "not found"))
{
// not running on amazon with ec2-api-tools
if (amazon_quick_install)
{
cout << "ERROR: Amazon Quick Installer was specified, bu the AMazon CLI API packages isnt installed, exiting" << endl;
cout << "ERROR: Amazon Quick Installer was specified, bu the Amazon CLI API packages isnt installed, exiting" << endl;
exit(1);
}
@ -1356,7 +1363,7 @@ int main(int argc, char* argv[])
}
else
{
if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not installed"))
if ( size == 0 || oam.checkLogStatus(amazonLog, "not installed"))
{
// not running on amazon with ec2-api-tools
if (amazon_quick_install)
@ -3614,7 +3621,7 @@ int main(int argc, char* argv[])
if ( remote_installer_debug == "1" )
{
logfile = "/tmp/";
logfile = tmpDir;
logfile += remoteModuleName + "_" + EEPackageType + "_install.log";
debug_logfile = " > " + logfile;
}
@ -3921,13 +3928,15 @@ int main(int argc, char* argv[])
if (hdfs && !nonDistribute )
{
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' > /tmp/postConfigure.pdsh 2>&1";
string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > " + postConfigurePsdhLog + " 2>&1";
system(cmd.c_str());
if (oam.checkLogStatus("/tmp/postConfigure.pdsh", "exit") )
if (oam.checkLogStatus(postConfigurePsdhLog, "exit") )
{
cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check /tmp/postConfigure.pdsh. exit..." << endl;
cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check " + postConfigurePsdhLog + ". exit..." << endl;
exit (1);
}
}
@ -4012,27 +4021,28 @@ int main(int argc, char* argv[])
}
}
}
string dbbuilderLog = tmpDir + "dbbuilder.log";
if (hdfs)
cmd = "bash -c '. " + installDir + "/bin/" + DataFileEnvFile + ";" + installDir + "/bin/dbbuilder 7 > /tmp/dbbuilder.log'";
cmd = "bash -c '. " + installDir + "/bin/" + DataFileEnvFile + ";" + installDir + "/bin/dbbuilder 7 > " + dbbuilderLog;
else
cmd = installDir + "/bin/dbbuilder 7 > /tmp/dbbuilder.log";
cmd = installDir + "/bin/dbbuilder 7 > " + dbbuilderLog;
system(cmd.c_str());
if (oam.checkLogStatus("/tmp/dbbuilder.log", "System Catalog created") )
if (oam.checkLogStatus(dbbuilderLog, "System Catalog created") )
cout << endl << "System Catalog Successfully Created" << endl;
else
{
if ( oam.checkLogStatus("/tmp/dbbuilder.log", "System catalog appears to exist") )
if ( oam.checkLogStatus(dbbuilderLog, "System catalog appears to exist") )
{
cout.flush();
}
else
{
cout << endl << "System Catalog Create Failure" << endl;
cout << "Check latest log file in /tmp/dbbuilder.log.*" << endl;
cout << "Check latest log file in " << dbbuilderLog << endl;
cout << " IMPORTANT: Once issue has been resolved, rerun postConfigure" << endl << endl;
exit (1);
@ -4622,7 +4632,7 @@ bool createDbrootDirs(string DBRootStorageType)
// mount data1 and create directories if configured with storage
if ( DBRootStorageType == "external" )
{
string cmd = "mount " + installDir + "/data1 > /tmp/mount.txt 2>&1";
string cmd = "mount " + installDir + "/data1 > " + tmpDir + "/mount.txt 2>&1";
system(cmd.c_str());
if ( !rootUser)
@ -4655,11 +4665,12 @@ bool pkgCheck(string columnstorePackage)
{
while (true)
{
string cmd = "ls " + columnstorePackage + " > /tmp/calpontpkgs";
string fileName = tmpDir + "/calpontpkgs";
string cmd = "ls " + columnstorePackage + " > " + fileName;
system(cmd.c_str());
string pkg = columnstorePackage;
string fileName = "/tmp/calpontpkgs";
ifstream oldFile (fileName.c_str());
if (oldFile)
@ -4770,7 +4781,7 @@ bool storageSetup(bool amazonInstall)
cout.flush();
string logdir("/var/log/mariadb/columnstore");
if (access(logdir.c_str(), W_OK) != 0) logdir = "/tmp";
if (access(logdir.c_str(), W_OK) != 0) logdir = tmpDir;
string hdfslog = logdir + "/hdfsCheck.log1";
@ -5087,7 +5098,8 @@ bool storageSetup(bool amazonInstall)
//check if gluster is installed
int rtnCode = 1;
rtnCode = system("gluster --version > /tmp/gluster.log 2>&1");
string cmd = "gluster --version > " + tmpDir + "/gluster.log 2>&1";
rtnCode = system(cmd.c_str());
if (rtnCode == 0)
{
@ -5099,14 +5111,17 @@ bool storageSetup(bool amazonInstall)
}
//check if hadoop is installed
system("which hadoop > /tmp/hadoop.log 2>&1");
string hadoopLog = tmpDir + "/hadoop.log";
cmd = "which hadoop > " + hadoopLog + " 2>&1";
system(cmd.c_str());
ifstream in("/tmp/hadoop.log");
ifstream in(hadoopLog);
in.seekg(0, std::ios::end);
int size = in.tellg();
if ( size == 0 || oam.checkLogStatus("/tmp/hadoop.log", "no hadoop"))
if ( size == 0 || oam.checkLogStatus(hadoopLog, "no hadoop"))
// no hadoop
size = 0;
else
@ -5577,7 +5592,7 @@ bool storageSetup(bool amazonInstall)
cout.flush();
string logdir("/var/log/mariadb/columnstore");
if (access(logdir.c_str(), W_OK) != 0) logdir = "/tmp";
if (access(logdir.c_str(), W_OK) != 0) logdir = tmpDir;
string hdfslog = logdir + "/hdfsCheck.log1";
@ -6116,14 +6131,14 @@ void remoteInstallThread(void* arg)
{
//failure
pthread_mutex_lock(&THREAD_LOCK);
cout << endl << "Failure with a remote module install, check install log files in /tmp" << endl;
cout << endl << "Failure with a remote module install, check install log files in " << tmpDir << endl;
exit(1);
}
}
}
pthread_mutex_lock(&THREAD_LOCK);
cout << endl << "Failure with a remote module install, check install log files in /tmp" << endl;
cout << endl << "Failure with a remote module install, check install log files in " << tmpDir << endl;
exit(1);
}
@ -6680,8 +6695,10 @@ bool glusterSetup(string password)
}
sleep(5);
string glusterCommandsLog = tmpDir + "/glusterCommands.log";
command = "gluster peer status >> /tmp/glusterCommands.txt 2>&1";
command = "gluster peer status " + glusterCommandsLog + "2>&1";
status = system(command.c_str());
@ -6717,13 +6734,13 @@ bool glusterSetup(string password)
pmnextbrick[pm]++;
}
command += "force >> /tmp/glusterCommands.txt 2>&1";
command += "force >> " + glusterCommandsLog + " 2>&1";
cout << "Gluster create and start volume dbroot" << oam.itoa(dbrootID) << "...";
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
{
if (oam.checkLogStatus("/tmp/glusterCommands.txt", "dbroot" + oam.itoa(dbrootID) + " already exists" ))
if (oam.checkLogStatus(glusterCommandsLog, "dbroot" + oam.itoa(dbrootID) + " already exists" ))
{
string errmsg1;
string errmsg2;
@ -6752,7 +6769,7 @@ bool glusterSetup(string password)
if (rootUser)
{
command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> " + glusterCommandsLog + " 2>&1";
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
@ -6765,7 +6782,7 @@ bool glusterSetup(string password)
{
int user = getuid();
int group = getgid();
command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-uid " + oam.itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-uid " + oam.itoa(user) + " >> " + glusterCommandsLog + " 2>&1";
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
@ -6774,7 +6791,7 @@ bool glusterSetup(string password)
exit(1);
}
command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-gid " + oam.itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-gid " + oam.itoa(group) + " >> " + glusterCommandsLog + " 2>&1";
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )
@ -6783,7 +6800,7 @@ bool glusterSetup(string password)
exit(1);
}
command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> " + glusterCommandsLog + " 2>&1";
status = system(command.c_str());
if (WEXITSTATUS(status) != 0 )