1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-09-02 12:41:17 +03:00
This commit is contained in:
david hill
2017-10-20 16:40:00 -05:00
parent 5c34be958b
commit 9d0bb3174b
9 changed files with 155 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
COLUMNSTORE_VERSION_MAJOR=1 COLUMNSTORE_VERSION_MAJOR=1
COLUMNSTORE_VERSION_MINOR=0 COLUMNSTORE_VERSION_MINOR=0
COLUMNSTORE_VERSION_PATCH=11 COLUMNSTORE_VERSION_PATCH=12
COLUMNSTORE_VERSION_RELEASE=2 COLUMNSTORE_VERSION_RELEASE=1

View File

@@ -47,7 +47,7 @@ password="Calpont1"
# #
echo "Create Replication User $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log echo "Create Replication User $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log
cat >/tmp/idb_master-rep.sql <<EOD cat >/tmp/idb_master-rep.sql <<EOD
CREATE USER IF NOT EXIST '$repUser'@'$hostipaddr' IDENTIFIED BY '$password'; CREATE USER IF NOT EXISTS '$repUser'@'$hostipaddr' IDENTIFIED BY '$password';
GRANT REPLICATION SLAVE ON *.* TO '$repUser'@'$hostipaddr'; GRANT REPLICATION SLAVE ON *.* TO '$repUser'@'$hostipaddr';
EOD EOD

View File

@@ -142,28 +142,21 @@ if [ -n "$plugin" ]; then
echo ". $COLUMNSTORE_INSTALL_DIR/bin/$setenv" >> ${bashFile} echo ". $COLUMNSTORE_INSTALL_DIR/bin/$setenv" >> ${bashFile}
fi fi
# if um, run mysql install scripts # if mysqlrep is on and module has a my.cnf file, upgrade it
if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $ServerTypeInstall = "2" ]; then
echo "Run post-mysqld-install" MySQLRep=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation MySQLRep`
$COLUMNSTORE_INSTALL_DIR/bin/post-mysqld-install --installdir=$COLUMNSTORE_INSTALL_DIR > /tmp/post-mysqld-install.log 2>&1 if [ $MySQLRep = "y" ]; then
if [ $? -ne 0 ]; then if test -f $COLUMNSTORE_INSTALL_DIR/mysql/my.cnf ; then
echo "ERROR: post-mysqld-install failed: check /tmp/post-mysqld-install.log" echo "Run Upgrade on my.cnf on Module"
exit 1 $COLUMNSTORE_INSTALL_DIR/bin/mycnfUpgrade > /tmp/mycnfUpgrade.log 2>&1
fi
echo "Run post-mysql-install"
password=`$COLUMNSTORE_INSTALL_DIR/bin/getMySQLpw`
if [ $password = "unassigned" ]; then
password=""
fi
$COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR --password=$password > /tmp/post-mysql-install.log 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: post-mysql-install failed: check /tmp/post-mysql-install.log"
exit 1
fi fi
fi fi
if test -f $COLUMNSTORE_INSTALL_DIR/mysql/my.cnf ; then
echo "Run Mysql Port update on my.cnf on Module"
$COLUMNSTORE_INSTALL_DIR/bin/mycnfUpgrade $mysqlPort > /tmp/mycnfUpgrade_port.log 2>&1
fi
# if um, run mysql install scripts # if um, run mysql install scripts
if [ $module = "um" ]; then if [ $module = "um" ]; then
echo "Run post-mysqld-install" echo "Run post-mysqld-install"

View File

@@ -46,13 +46,36 @@ expect {
-re "passphrase" { send "$PASSWORD\n" } -re "passphrase" { send "$PASSWORD\n" }
-re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 } -re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 }
-re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 } -re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 }
-re "total size" { exit 0 } -re "total size" {} abort
} }
expect { expect {
-re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 } -re "failed" { send_user " FAILED: Failure, check tmp log\n" ; exit 1 }
-re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 } -re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 }
-re "total size" { exit 0 } -re "total size" {} abort
} }
set HOME "$env(HOME)"
set COMMAND "rsync -vopgr -e ssh $HOME/.my.cnf $USERNAME@$SERVER:$HOME/"
#
# run command
#
set timeout 20
send "$COMMAND\n"
expect {
-re "word: " { send "$PASSWORD\n" }
-re "passphrase" { send "$PASSWORD\n" }
-re "total size" {} abort
-re "failed" { exit 0 }
timeout { exit 0 }
}
expect {
-re "total size" {} abort
-re "failed" { exit 0 }
timeout { exit 0 }
}
exit 0 exit 0

View File

@@ -4918,6 +4918,12 @@ int processCommand(string* arguments)
case 46: // enableReplication case 46: // enableReplication
{ {
if ( SingleServerInstall == "y" ) {
// exit out since not on single-server install
cout << endl << "**** enableReplication Failed : not supported on a Single-Server type installs " << endl;
break;
}
string MySQLRep; string MySQLRep;
try { try {
oam.getSystemConfig("MySQLRep", MySQLRep); oam.getSystemConfig("MySQLRep", MySQLRep);
@@ -5888,6 +5894,12 @@ int processCommand(string* arguments)
case 51: // disableReplication case 51: // disableReplication
{ {
if ( SingleServerInstall == "y" ) {
// exit out since not on single-server install
cout << endl << "**** disableReplication Failed : not supported on a Single-Server type installs " << endl;
break;
}
string MySQLRep; string MySQLRep;
try { try {
oam.getSystemConfig("MySQLRep", MySQLRep); oam.getSystemConfig("MySQLRep", MySQLRep);

View File

@@ -874,6 +874,29 @@ bool writeConfig( Config* sysConfig )
return false; return false;
} }
std::string getmysqlpw(std::string logFile)
{
ifstream oldFile (logFile.c_str());
if (oldFile) {
char line[200];
string buf;
while (oldFile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("mysqlpw=",0);
if (pos != string::npos)
{
string mysqlpw = buf.substr(pos+8, 80);
// unlink(logFile);
return mysqlpw;
}
}
}
return oam::UnassignedName;
}
} }

View File

@@ -46,6 +46,7 @@ extern bool writeConfig(Config* sysConfig);
extern void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string USER, std::string password, ChildModuleList childmodulelist, int IserverTypeInstall, bool pmwithum); extern void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string USER, std::string password, ChildModuleList childmodulelist, int IserverTypeInstall, bool pmwithum);
extern const char* callReadline(string prompt); extern const char* callReadline(string prompt);
extern void callFree(const char* ); extern void callFree(const char* );
extern std::string getmysqlpw(std::string logFile);
} }

View File

@@ -187,7 +187,7 @@ string installDir;
string HOME = "/root"; string HOME = "/root";
extern string pwprompt; extern string pwprompt;
string mysqlpw = oam::UnassignedName; string mysqlpw = " ";
extern const char* pcommand; extern const char* pcommand;
extern string prompt; extern string prompt;
@@ -2883,6 +2883,83 @@ int main(int argc, char *argv[])
cout << endl << "Error returned from user_installer.sh" << endl; cout << endl << "Error returned from user_installer.sh" << endl;
exit(1); exit(1);
} }
//check for mysql password on remote UM
if ( pwprompt == " " ) {
//start mysqld
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore start'";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from mysql-Columnstore start" << endl;
exit(1);
}
//try to login
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from remote_command.sh" << endl;
exit(1);
}
if (oam.checkLogStatus("/tmp/idbmysql.log", "ERROR .my.cnf") ) {
// password needed check and get password from remote UM
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "bin/getMySQLpw > /tmp/mysqlpw.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "MariaDB ColumnStore login failure, MySQL Root password is set." << endl;
cout << "Need MariaDB ColumnStore password configuration file " + HOME + "/.my.cnf on " << remoteModuleName << endl;
exit(1);
}
//get password from local tmp file
mysqlpw = getmysqlpw("/tmp/mysqlpw.log");
if ( mysqlpw != oam::UnassignedName )
{
mysqlpw = "'" + mysqlpw + "'";
pwprompt = "--password=" + mysqlpw;
}
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root " + pwprompt + " -e status' 1 > /tmp/idbmysql.log 2>&1";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "MariaDB ColumnStore login failure, password mismatch in " + HOME + ".my.cnf on " << remoteModuleName << endl;
exit(1);
}
}
else
{
if (!oam.checkLogStatus("/tmp/idbmysql.log", "Columnstore") ) {
cout << endl << "ERROR: MariaDB ColumnStore runtime error, exit..." << endl << endl;
system("cat /tmp/idbmysql.log");
exit (1);
}
else
{
cout << endl << "Additional MariaDB ColumnStore Installation steps Successfully Completed on '" + remoteModuleName + "'" << endl << endl;
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/mysql/mysql-Columnstore stop'";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from mysql-Columnstore stop" << endl;
exit(1);
}
unlink("/tmp/idbmysql.log");
break;
}
}
//re-run post-mysql-install with password
cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " '" + installDir + "/bin/post-mysql-install " + pwprompt + "' < /tmp/post-mysql-install.log";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0) {
cout << endl << "Error returned from post-mysql-install, check /tmp/post-mysql-install.log" << endl;
exit(1);
}
else
cout << endl << "post-mysql-install Successfully Completed" << endl;
}
} }
} }
else else

View File

@@ -2569,7 +2569,7 @@ void processMSG(messageqcpp::IOSocket* cfIos)
// target = root password // target = root password
oam::DeviceNetworkList devicenetworklist; oam::DeviceNetworkList devicenetworklist;
status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, true, target, false); status = processManager.setMySQLReplication(devicenetworklist, oam::UnassignedName, false, false, target, false);
log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) ); log.writeLog(__LINE__, "Disable MySQL Replication status: " + oam.itoa(status) );