solusvm 主控端迁移

难点在于solusvm被控端已经开了小鸡的情况。

备份数据库:

#!/bin/sh

## Vars
CONF=/usr/local/solusvm/includes/solusvm.conf
FILENAME=solusvm_database_dump.gz

## Get the database details
DN=`grep -m1 $1: ${CONF} | cut -d ':' -f 1`;
DU=`grep -m1 $1: ${CONF} | cut -d ':' -f 2`;
DP=`grep -m1 $1: ${CONF} | cut -d ':' -f 3`;

## Do the dump
echo "Dumping database..."
mysqldump --opt -h localhost --user=${DU} --password=${DP} ${DN} > ~/${FILENAME};
echo "Complete."

新主动端恢复数据库:

#!/bin/sh

## Vars
CONF=/usr/local/solusvm/includes/solusvm.conf
FILENAME=solusvm_database_dump.gz

## Get the database details
DN=`grep -m1 $1: ${CONF} | cut -d ':' -f 1`;
DU=`grep -m1 $1: ${CONF} | cut -d ':' -f 2`;
DP=`grep -m1 $1: ${CONF} | cut -d ':' -f 3`;

## Do the dump
echo "Restoring database..."
mysql --user=${DU} --password=${DP} ${DN} < ~/${FILENAME};
echo "Complete."

注意恢复数据库后,重新到界面对node,更新其key password。

 

顺便改进下,做个快键键登录连接数据库:

!/bin/sh

## Vars
CONF=/usr/local/solusvm/includes/solusvm.conf

## Get the database details
DN=`grep -m1 $1: ${CONF} | cut -d ':' -f 1`;
DU=`grep -m1 $1: ${CONF} | cut -d ':' -f 2`;
DP=`grep -m1 $1: ${CONF} | cut -d ':' -f 3`;

mysql --user=${DU} --password=${DP} ${DN};

 

转载于:https://www.cnblogs.com/zhenfei/p/10422353.html

你可能感兴趣的:(solusvm 主控端迁移)