1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-527 - add code for non-root

This commit is contained in:
david hill
2017-01-20 23:15:00 -06:00
committed by David Hall
parent c7bbb78b73
commit 96bf638daf

View File

@ -4835,6 +4835,11 @@ int ProcessMonitor::changeMyCnf(std::string type)
}
}
pos = buf.find("slave-skip-errors=all",0);
if ( pos != string::npos ) {
buf = "# slave-skip-errors=all";
}
//output to temp file
lines.push_back(buf);
}
@ -5266,8 +5271,6 @@ int ProcessMonitor::runMasterDist(std::string& password, std::string& slaveModul
string cmd = startup::StartUp::installDir() + "/bin/rsync.sh " + ipAddr + " " + password + " " + startup::StartUp::installDir() + " 1 > /tmp/master-dist_" + slaveModule + ".log";
system(cmd.c_str());
log.writeLog(__LINE__, "cmd = " + cmd, LOG_TYPE_DEBUG);
string logFile = "/tmp/master-dist_" + slaveModule + ".log";
if (!oam.checkLogStatus(logFile, "FAILED"))
@ -5500,47 +5503,15 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID)
if ( status == "attached" ) {
string cmd;
if ( rootUser)
cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto > /tmp/um_mount.log";
cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /tmp/um_mount.log";
else
cmd = "sudo mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto,user > /tmp/um_mount.log";
cmd = "sudo mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /tmp/um_mount.log";
system(cmd.c_str());
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
if ( rootUser)
cmd = "chown -R mysql:mysql " + startup::StartUp::installDir() + "/mysql/db";
else
cmd = "sudo chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/mysql/db";
cmd = "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db";
system(cmd.c_str());
log.writeLog(__LINE__, "chown cmd: " + cmd, LOG_TYPE_DEBUG);
//check for setup files in mysq/db, if not, create them for a new install
string file = startup::StartUp::installDir() + "/mysql/db/mysql";
ifstream new_file (file.c_str());
if (!new_file) {
string cmd;
cmd = startup::StartUp::installDir() + "/bin/post-mysqld-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysqld-install.log 2>&1";
log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG);
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysqld-install error" , LOG_TYPE_ERROR);
return false;
}
else
log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysqld-install passed" , LOG_TYPE_DEBUG);
cmd = startup::StartUp::installDir() + "/bin/post-mysql-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysql-install.log";;
log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG);
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysql-install error" , LOG_TYPE_ERROR);
return false;
}
else
log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysql-install passed" , LOG_TYPE_DEBUG);
}
log.writeLog(__LINE__, "amazonVolumeCheck function successfully completed, volume attached: " + volumeName, LOG_TYPE_DEBUG);
return true;
@ -5565,49 +5536,12 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID)
{}
if (oam.attachEC2Volume(volumeName, deviceName, instanceName)) {
string cmd;
if ( rootUser)
cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto > /tmp/um_mount.log";
else
cmd = "sudo mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o noatime,nodiratime,noauto,user > /tmp/um_mount.log";
string cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /dev/null";
system(cmd.c_str());
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
if ( rootUser)
cmd = "chown -R mysql:mysql " + startup::StartUp::installDir() + "/mysql/db";
else
cmd = "sudo chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/mysql/db";
cmd = "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db";
system(cmd.c_str());
log.writeLog(__LINE__, "chown cmd: " + cmd, LOG_TYPE_DEBUG);
//check for setup files in mysq/db, if not, create them for a new install
string file = startup::StartUp::installDir() + "/mysql/db/mysql";
ifstream new_file (file.c_str());
if (!new_file) {
string cmd;
cmd = startup::StartUp::installDir() + "/bin/post-mysqld-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysqld-install.log 2>&1";
log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG);
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysqld-install error" , LOG_TYPE_ERROR);
return false;
}
else
log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysqld-install passed" , LOG_TYPE_DEBUG);
cmd = startup::StartUp::installDir() + "/bin/post-mysql-install --installdir=" + startup::StartUp::installDir() + " > /tmp/post-mysql-install.log";;
log.writeLog(__LINE__, "cmd: " + cmd, LOG_TYPE_DEBUG);
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
log.writeLog(__LINE__, "amazonVolumeCheck function failed, post-mysql-install error" , LOG_TYPE_ERROR);
return false;
}
else
log.writeLog(__LINE__, "amazonVolumeCheck function, post-mysql-install passed" , LOG_TYPE_DEBUG);
}
return true;
}