diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 5a61a9074..8ec75a9ba 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -8,10 +8,6 @@ prefix=/usr/local installdir=$prefix/mariadb/columnstore rpmmode=install user=`whoami 2>/dev/null` -SUDO=" " -if [ $user != "root" ]; then - SUDO="sudo " -fi quiet=0 @@ -93,53 +89,53 @@ if [ -f libstdc++.so.6.0.14 ]; then fi # softlink for libperl.sp, used by cplogger -$SUDO ln -s /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so >/dev/null 2>&1 - -#setup profile files -profileFileAlias=/etc/profile.d/columnstoreAlias.sh -profileFileEnv=/etc/profile.d/columnstoreEnv.sh +ln -s /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so >/dev/null 2>&1 if [ $installdir != "/usr/local/mariadb/columnstore" ]; then sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstoreAlias fi if [ $user != "root" ]; then - sudo rm -f $profileFileEnv - sudo rm -f $profileFileAlias - - sudo touch $profileFileEnv - sudo chmod 666 $profileFileEnv - egrep -qs 'MariaDB Columnstore Non-Root' ${profileFileEnv} + profileFile=$prefix/.bash_profile + + if [ ! -f ${profileFile}_backup ]; then + cp $profileFile ${profileFile}_backup + fi + + egrep -qs 'MariaDB Columnstore Non-Root Environment Variables' ${profileFile} rc1=$? if [ $rc1 -ne 0 ]; then - sudo echo " " >> ${profileFileEnv} - sudo echo "# MariaDB Columnstore Non-Root Environment Variables" >> ${profileFileEnv} - sudo echo "export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR" >> ${profileFileEnv} - sudo echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib" >> ${profileFileEnv} - . ${profileFileEnv} + echo " " >> ${profileFile} + echo "# MariaDB Columnstore Non-Root Environment Variables" >> ${profileFile} + echo "export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR" >> ${profileFile} + echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib" >> ${profileFile} fi - sudo /bin/cp -f $installdir/bin/columnstoreAlias $profileFileAlias - sudo chmod 666 $profileFileAlias + egrep -qs 'MariaDB Columnstore Non-Root Alias Variables' ${profileFile} + rc1=$? + if [ $rc1 -ne 0 ]; then + echo " " >> ${profileFile} + echo "# MariaDB Columnstore Non-Root Alias Variables" >> ${profileFile} + cat $installdir/bin/columnstoreAlias >> ${profileFile} + fi + + #source the file + . ${profileFile} else - /bin/cp -f $installdir/bin/columnstoreAlias $profileFileAlias - chmod 644 $profileFileAlias + /bin/cp -f $installdir/bin/columnstoreAlias /etc/profile.d/columnstoreAlias.sh + chmod 644 /etc/profile.d/columnstoreAlias.sh >/dev/null 2>&1 fi cd / -test -d /var/log/mariadb || $SUDO mkdir /var/log/mariadb >/dev/null 2>&1 -test -d /var/log/mariadb/columnstore || $SUDO mkdir /var/log/mariadb/columnstore >/dev/null 2>&1 - -if [ $user != "root" ]; then - $SUDO chmod -R 777 /var/log/mariadb >/dev/null 2>&1 - $SUDO chown -R $user:$user /var/log/mariadb >/dev/null 2>&1 -fi - +test -d /var/log/mariadb || mkdir /var/log/mariadb >/dev/null 2>&1 +test -d /var/log/mariadb/columnstore || mkdir /var/log/mariadb/columnstore >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1 test -h /var/log/mariadb/columnstore/data && rm -f /var/log/mariadb/columnstore/data +chmod 755 /var/log/mariadb/columnstore/corefiles > /dev/null 2>&1 + # make sure trace dir is world-writable and sticky test -d $installdir/data || mkdir $installdir/data test -d $installdir/data1 || mkdir $installdir/data1 @@ -162,13 +158,8 @@ rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1 #create columnstore temp file directory mkdir -p /tmp/columnstore_tmp_files >/dev/null 2>&1 -#setup core file directory and link -mkdir /var/log/mariadb/columnstore/corefiles > /dev/null 2>&1 -chmod 777 /var/log/mariadb/columnstore/corefiles > /dev/null 2>&1 - #create mount directories mkdir /mnt/tmp > /dev/null 2>&1 -mkdir /var/log/mariadb/columnstore/data/archive > /dev/null 2>&1 # remove mysql archive log test -d $installdir/mysql/db || mkdir -p $installdir/mysql/db @@ -177,7 +168,6 @@ rm -rf $installdir/mysql/db/columnstore_log_archive > /dev/null 2>&1 # delete Columnstore shared memory segments $installdir/bin/clearShm > /dev/null 2>&1 -systemctl=`which systemctl 2>/dev/null` #check and create rc.local file if missing if [ -f /etc/rc.d ]; then @@ -190,22 +180,16 @@ if [ $user = "root" ]; then touch $RCFILE chmod +x $RCFILE else - $SUDO touch $RCFILE - $SUDO chmod 777 $RCFILE - $SUDO printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILE > /dev/null 2>&1 - - if [ -n "$systemctl" ]; then - $SUDO systemctl start rc-local >/dev/null 2>&1 - $SUDO systemctl enable rc-local >/dev/null 2>&1 - fi + printf '%s\n' '#!/bin/bash' "#" | tee -a $RCFILE > /dev/null 2>&1 fi - -#setup the columnstore service script -rm -f /etc/init.d/columnstore >/dev/null 2>&1 -rm -f /etc/init.d/mysql-Columnstore >/dev/null 2>&1 - if [ $user = "root" ]; then + #setup the columnstore service script + rm -f /etc/init.d/columnstore >/dev/null 2>&1 + rm -f /etc/init.d/mysql-Columnstore >/dev/null 2>&1 + rm -f /etc/default/columnstore + + systemctl=`which systemctl 2>/dev/null` if [ -n "$systemctl" ]; then chmod 644 $installdir/bin/columnstore.service @@ -235,30 +219,46 @@ fi if [ $user = "root" ]; then $installdir/bin/syslogSetup.sh install > /tmp/syslog_install.log 2>&1 - rm -f /etc/default/columnstore + + #check if MariaDB Columnstore system logging was setup + cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1 + if [ $? -eq 0 ]; then + cat /tmp/syslog_install.log + fi else sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstore.def sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstoreLogRotate - $SUDO cp $installdir/bin/columnstore.def /etc/default/columnstore + cp $installdir/bin/columnstore.def /etc/default/columnstore sed -i -e s@prefix=/home/guest@prefix=$prefix@g $installdir/bin/* - $SUDO chmod 777 /tmp - $installdir/bin/syslogSetup.sh --installdir=$installdir install > /tmp/syslog_install.log 2>&1 - $SUDO chown $user:$user $installdir/etc/Columnstore.xml - $SUDO mkdir /var/lock/subsys > /dev/null 2>&1 - $SUDO chmod 777 /var/lock/subsys > /dev/null 2>&1 - $SUDO rm -f /var/lock/subsys/mysql-Columnstore - $SUDO chmod 666 /etc/fstab + 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 "" fi -#check if MariaDB Columnstore system logging was setup -cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1 -if [ $? -eq 0 ]; then - cat /tmp/syslog_install.log +#determine lock file directory + +# Lock directory for root user +lockdir='/var/lock/subsys' +if [ $user != "root" ];then + # Lock directory for non-root user + lockdir=$prefix/.lock fi +$installdir/bin/setConfig -d Installation LockFileDirectory $lockdir + +mkdir $lockdir >/dev/null 2>&1 + +rm -f $lockdir/mysql-Columnstore +rm -f $lockdir/columnstore + #backup copy of Alarm Config File /bin/cp -f $installdir/etc/AlarmConfig.xml $installdir/etc/AlarmConfig.xml.installSave > /dev/null 2>&1 @@ -275,6 +275,7 @@ if [ $user = "root" ]; then else LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****" fi + #setup hadoop hadoop=`which hadoop 2>/dev/null` if [ -z "$hadoop" ]; then diff --git a/oamapps/alarmmanager/alarmmanager.cpp b/oamapps/alarmmanager/alarmmanager.cpp index 37acc7c1e..8579fcba6 100644 --- a/oamapps/alarmmanager/alarmmanager.cpp +++ b/oamapps/alarmmanager/alarmmanager.cpp @@ -505,39 +505,8 @@ void ALARMManager::sendAlarmReport (const char* componentID, int alarmID, int st // shutdown connection procmgr.shutdown(); } - catch (std::runtime_error& e) - { - LoggingID lid(11); - MessageLog ml(lid); - Message msg; - Message::Args args; - args.add("sendAlarmReport error:"); - args.add(e.what()); - msg.format(args); - ml.logDebugMessage(msg); - } - catch (std::exception& e) - { - LoggingID lid(11); - MessageLog ml(lid); - Message msg; - Message::Args args; - args.add("sendAlarmReport error:"); - args.add(e.what()); - msg.format(args); - ml.logDebugMessage(msg); - } catch (...) - { - LoggingID lid(11); - MessageLog ml(lid); - Message msg; - Message::Args args; - args.add("sendAlarmReport error:"); - args.add("general failure"); - msg.format(args); - ml.logDebugMessage(msg); - } + {} return; #endif //SKIP_ALARM diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 2a737861c..16e6956fb 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -836,6 +836,178 @@ int main(int argc, char* argv[]) if (pcommand) { + if (strlen(pcommand) > 0) + temp = pcommand; + else + temp = singleServerInstall; + + callFree(pcommand); + + if (temp == "1") + { + singleServerInstall = temp; + cout << endl << "Performing the Single Server Install." << endl; + + if ( reuseConfig == "n" ) + { + //setup to Columnstore.xml file for single server + + try + { + sysConfig->setConfig("ExeMgr1", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("ExeMgr1", "Module", "pm1"); + sysConfig->setConfig("ProcMgr", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("ProcMgr_Alarm", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("ProcStatusControl", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("pm1_ProcessMonitor", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("pm1_ServerMonitor", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("pm1_WriteEngineServer", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("DDLProc", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("DMLProc", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS1", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS2", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS3", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS4", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS5", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS6", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS7", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS8", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS9", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS10", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS11", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS12", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS13", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS14", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS15", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS16", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS17", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS18", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS19", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS20", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS21", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS22", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS23", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS24", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS25", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS26", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS27", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS28", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS29", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS30", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS31", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("PMS32", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("SystemModuleConfig", "ModuleCount2", "0"); + sysConfig->setConfig("SystemModuleConfig", "ModuleIPAddr1-1-3", "127.0.0.1"); + sysConfig->setConfig("SystemModuleConfig", "ModuleHostName1-1-3", "localhost"); + sysConfig->setConfig("DBRM_Controller", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("DBRM_Worker1", "IPAddr", "127.0.0.1"); + sysConfig->setConfig("DBRM_Worker1", "Module", "pm1"); + sysConfig->setConfig("DBBC", "NumBlocksPct", "50"); + sysConfig->setConfig("Installation", "InitialInstallFlag", "y"); + sysConfig->setConfig("Installation", "SingleServerInstall", "y"); + sysConfig->setConfig("HashJoin", "TotalUmMemory", "25%"); + } + + catch (...) + { + cout << "ERROR: Problem setting for Single Server in the MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + } + + setSystemName(); + cout << endl; + + system(cmd.c_str()); + + // setup storage + if (!storageSetup(false)) + { + cout << "ERROR: Problem setting up storage" << endl; + exit(1); + } + + if (hdfs || !rootUser) + if ( !updateBash() ) + cout << "updateBash error" << endl; + + // setup storage + if (!singleServerDBrootSetup()) + { + cout << "ERROR: Problem setting up DBRoot IDs" << endl; + exit(1); + } + + //set system DBRoot count and check 'files per parition' with number of dbroots + try + { + sysConfig->setConfig(SystemSection, "DBRootCount", oam.itoa(DBRootCount)); + } + catch (...) + { + cout << "ERROR: Problem setting DBRoot Count in the MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + + //check if dbrm data resides in older directory path and inform user if it does + dbrmDirCheck(); + + if (startOfflinePrompt) + offLineAppCheck(); + + checkMysqlPort(mysqlPort, sysConfig); + + if ( !writeConfig(sysConfig) ) + { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + + cout << endl << "===== Performing Configuration Setup and MariaDB ColumnStore Startup =====" << endl; + + cmd = installDir + "/bin/installer dummy.rpm dummy.rpm dummy.rpm dummy.rpm dummy.rpm initial dummy " + reuseConfig + " --nodeps ' ' 1 " + installDir; + system(cmd.c_str()); + exit(0); + } + else + { + if (temp == "2") + { + singleServerInstall = temp; + break; + } + } + + cout << "Invalid Entry, please re-enter" << endl; + + if ( noPrompting ) + exit(1); + + continue; + } + + break; + } + + try + { + sysConfig->setConfig(InstallSection, "SingleServerInstall", "n"); + } + catch (...) + { + cout << "ERROR: Problem setting SingleServerInstall from the MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + + if ( !writeConfig(sysConfig) ) + { + cout << "ERROR: Failed trying to update MariaDB ColumnStore System Configuration file" << endl; + exit(1); + } + + // + // Multi-server install + // if (strlen(pcommand) > 0) temp = pcommand; else @@ -1444,8 +1616,7 @@ int main(int argc, char* argv[]) // setup to start on reboot, for non-root amazon installs if ( !rootUser ) { - system("sudo sed -i -e 's/#sudo runuser/sudo runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1"); - system("sudo chmod 666 /etc/fstab >/dev/null 2>&1"); + system("sed -i -e 's/#MCS//g' /etc/rc.d/rc.local >/dev/null 2>&1"); } if ( !writeConfig(sysConfig) ) @@ -3880,17 +4051,7 @@ int main(int argc, char* argv[]) //check if local MariaDB ColumnStore system logging is working cout << endl << "===== Checking MariaDB ColumnStore System Logging Functionality =====" << endl << endl; - if ( rootUser) - cmd = installDir + "/bin/syslogSetup.sh install > /dev/null 2>&1"; - else - cmd = "sudo " + installDir + "/bin/syslogSetup.sh --installdir=" + installDir + " install > /dev/null 2>&1"; - - system(cmd.c_str()); - - if ( rootUser) - cmd = installDir + "/bin/syslogSetup.sh status > /dev/null 2>&1"; - else - cmd = "sudo " + installDir + "/bin/syslogSetup.sh --installdir=" + installDir + " status > /dev/null 2>&1"; + cmd = installDir + "/bin/syslogSetup.sh status > /dev/null 2>&1"; int ret = system(cmd.c_str()); @@ -4209,19 +4370,7 @@ bool checkSaveConfigFile() string cmd; if ( reuseConfig == "y" ) - { - if ( singleServerInstall == "1") - { - cmd = "rm -f " + installDir + "/etc/Columnstore.xml.installSave > /dev/null 2>&1"; - system(cmd.c_str()); - cmd = "mv -f " + installDir + "/etc/Columnstore.xml " + installDir + "/etc/Columnstore.xml.installSave > /dev/null 2>&1"; - system(cmd.c_str()); - cmd = "/bin/cp -f " + installDir + "/etc/Columnstore.xml.singleserver " + installDir + "/etc/Columnstore.xml > /dev/null 2>&1"; - system(cmd.c_str()); - } - break; - } if ( reuseConfig == "n" ) { @@ -4348,22 +4497,13 @@ bool setOSFiles(string parentOAMModuleName, int serverTypeInstall) //make a backup copy before changing string cmd = "rm -f " + fileName + ".columnstoreSave"; - if ( !rootUser ) - cmd = "sudo rm -f " + fileName + ".columnstoreSave"; - system(cmd.c_str()); cmd = "cp " + fileName + " " + fileName + ".columnstoreSave > /dev/null 2>&1"; - if ( !rootUser ) - cmd = "sudo cp " + fileName + " " + fileName + ".columnstoreSave > /dev/null 2>&1"; - system(cmd.c_str()); - if ( rootUser ) - cmd = "cat " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont >> " + fileName; - else - cmd = "sudo bash -c 'sudo cat " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont >> " + fileName + "'"; + cmd = "cat " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont >> " + fileName; int rtnCode = system(cmd.c_str()); @@ -4564,6 +4704,9 @@ bool uncommentCalpontXml( string entry) */ bool makeRClocal(string moduleType, string moduleName, int IserverTypeInstall) { + + return true; + vector lines; string mount1; @@ -4665,7 +4808,7 @@ bool createDbrootDirs(string DBRootStorageType) if ( !rootUser) { - cmd = "sudo chown -R " + USER + ":" + USER + " " + installDir + "/data1 > /dev/null"; + cmd = "chown -R " + USER + ":" + USER + " " + installDir + "/data1 > /dev/null"; system(cmd.c_str()); } @@ -5125,10 +5268,7 @@ bool storageSetup(bool amazonInstall) //check if gluster is installed int rtnCode = 1; - if (rootUser) - rtnCode = system("gluster --version > /tmp/gluster.log 2>&1"); - else - rtnCode = system("sudo gluster --version > /tmp/gluster.log 2>&1"); + rtnCode = system("gluster --version > /tmp/gluster.log 2>&1"); if (rtnCode == 0) { @@ -5820,10 +5960,7 @@ bool updateBash() string cmd = "echo . " + installDir + "/bin/" + DataFileEnvFile + " >> " + fileName; system(cmd.c_str()); - if ( rootUser) - cmd = "su - hdfs -c 'hadoop fs -mkdir -p " + installDir + ";hadoop fs -chown root:root " + installDir + "' >/dev/null 2>&1"; - else - cmd = "sudo su - hdfs -c 'hadoop fs -mkdir -p " + installDir + ";hadoop fs -chown " + USER + ":" + USER + " " + installDir + "' >/dev/null 2>&1"; + cmd = "su - hdfs -c 'hadoop fs -mkdir -p " + installDir + ";hadoop fs -chown root:root " + installDir + "' >/dev/null 2>&1"; system(cmd.c_str()); } @@ -6711,67 +6848,7 @@ bool glusterSetup(string password) cout << "ERROR: failed to make directory(" << DataRedundancyConfigs[pm].pmIpAddr << "): '" << command << "'" << endl; exit(1); } - - /* - if (dataRedundancyStorage == 2) - { - //walk data storage locations and modify fstab to reflect the storage locations entered by user - vector::iterator storageSetupIter=DataRedundancyConfigs[pm].storageLocations.begin(); - for (; storageSetupIter < DataRedundancyConfigs[pm].storageLocations.end(); storageSetupIter++ ) - { - if (rootUser) - { - command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + - " 'echo " + (*storageSetupIter).storageLocation + " " + - installDir + "/gluster/brick" + oam.itoa(brick) + " " + - (*storageSetupIter).storageFilesytemType + " defaults 1 2 >> /etc/fstab'"; - } - else - { - command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + - " 'sudo bash -c `sudo echo " + (*storageSetupIter).storageLocation + " " + - installDir + "/gluster/brick" + oam.itoa(brick) + " " + - (*storageSetupIter).storageFilesytemType + " defaults 1 2 >> /etc/fstab`'"; - } - status = system(command.c_str()); - if (WEXITSTATUS(status) != 0 ) - { - cout << "ERROR: command failed: " << command << endl; - exit(1); - } - if (rootUser) - { - command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + - " 'mount " + installDir + "/gluster/brick" + oam.itoa(brick) + "'"; - } - else - { - command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + - " 'sudo bash -c `sudo mount " + installDir + "/gluster/brick" + oam.itoa(brick) + "`'"; - } - status = system(command.c_str()); - if (WEXITSTATUS(status) != 0 ) - { - cout << "ERROR: command failed: " << command << endl; - exit(1); - } - if (!rootUser) - { - int user; - user = getuid(); - command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password + - "'sudo bash -c `sudo chown -R " + oam.itoa(user) + ":" + oam.itoa(user) + " " + installDir + "/gluster/brick" + oam.itoa(brick) + "`'"; - status = system(command.c_str()); - if (WEXITSTATUS(status) != 0 ) - { - cout << "ERROR(" << status <<"): command failed: " << command << endl; - } - } - - } - } - */ - } + } string errmsg1; string errmsg2; @@ -6785,14 +6862,7 @@ bool glusterSetup(string password) sleep(5); - if (rootUser) - { - command = "gluster peer status >> /tmp/glusterCommands.txt 2>&1"; - } - else - { - command = "sudo gluster peer status >> /tmp/glusterCommands.txt 2>&1"; - } + command = "gluster peer status >> /tmp/glusterCommands.txt 2>&1"; status = system(command.c_str()); @@ -6817,14 +6887,7 @@ bool glusterSetup(string password) { int dbrootID = db + 1; - if (rootUser) - { - command = "gluster volume create dbroot" + oam.itoa(dbrootID) + " transport tcp replica " + oam.itoa(dataRedundancyCopies) + " "; - } - else - { - command = "sudo gluster volume create dbroot" + oam.itoa(dbrootID) + " transport tcp replica " + oam.itoa(dataRedundancyCopies) + " "; - } + command = "gluster volume create dbroot" + oam.itoa(dbrootID) + " transport tcp replica " + oam.itoa(dataRedundancyCopies) + " "; vector::iterator dbrootPmIter = dbrootPms[db].begin(); @@ -6883,7 +6946,7 @@ bool glusterSetup(string password) { int user = getuid(); int group = getgid(); - command = "sudo 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) + " >> /tmp/glusterCommands.txt 2>&1";; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) @@ -6892,7 +6955,7 @@ bool glusterSetup(string password) exit(1); } - command = "sudo 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) + " >> /tmp/glusterCommands.txt 2>&1";; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) @@ -6901,7 +6964,7 @@ bool glusterSetup(string password) exit(1); } - command = "sudo gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1"; + command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1"; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 )