站点图标 Linux-技术共享

SolusVM Master 迁移

1、新节点上安装SolusVM Master

yum install wget -y && wget https://git.dwhd.org/lookback/CentOS_INIT/raw/master/SolusVM/solusvm.sh && bash solusvm.sh

2、备份原Master节点上的数据库

CONF=/usr/local/solusvm/includes/solusvm.conf
DBUser=$(awk -F':' '{print $2}' ${CONF})
DBPass=$(awk -F':' '{print $3}' ${CONF})
DBHost=$(awk -F':' '{print $4}' ${CONF})
DBName=$(awk -F':' '{print $1}' ${CONF})
mysqldump --opt -u$DBUser -p$DBPass -h$DBHost $DBName > \
mysql_backup_$(date '+%Y%m%d_%H%M%S')_solusvm_database_dump.sql

3、MySQL备份传到新的Master节点上

scp mysql_backup_20210708_105313_solusvm_database_dump.sql root@NewMasterNodeIP:~/

4、恢复数据库

CONF=/usr/local/solusvm/includes/solusvm.conf
DBUser=$(awk -F':' '{print $2}' ${CONF})
DBPass=$(awk -F':' '{print $3}' ${CONF})
DBHost=$(awk -F':' '{print $4}' ${CONF})
DBName=$(awk -F':' '{print $1}' ${CONF})
mysql -u$DBUser -p$DBPass -h$DBHost $DBName < \
mysql_backup_20210708_105313_solusvm_database_dump.sql

5、如果新Master节点的IP不是原Master节点的IP,需要先更改Master节点的IP
修改Master节点IP https://NewMasterDomain:5656/admincp/nodes.php?action=edit&id=1
修改localhost node 节点的IP 【SolusVM > Nodes > Edit Node】 next to localhost

6、删除所有Slave节点上的/usr/local/solusvm/data/allow.dat 和 /usr/local/solusvm/data/ftp.dat

rm -rf /usr/local/solusvm/data/{allow,ftp}.dat

7、更新所有Slave节点的KEY信息,Slave节点的Key信息获取方法

cat /usr/local/solusvm/data/solusvm.conf

8、将模板从旧服务器移至新服务器。模板位置如下

/home/solusvm/kvm/templates - for KVM templates
/home/solusvm/xen/templates - for Xen templates
/vz/template/cache - for OpenVZ templates
退出移动版