长枪不倒 发表于 2015-10-13 13:15:33

一键重置cloudstack 环境

  步骤一:登录cloudstack服务
  步骤二:新建cloudclean.sh 并添加如下内容,注意红色部分要根据你自己的部署环境做修改
  #stop server
service cloudstack-management stop
service cloudstack-agent stop
#clean database
mysql -uroot -ppassword -e "drop database cloud;drop database cloud_usage;drop database cloudbridge;"
cloudstack-setup-databases cloud:password@localhost --deploy-as=root:passowrd
#clean storage
mkdir /mnt/primary -p
mount -t nfs localhost:/storage/primary /mnt/primary
rm -rf /mnt/primary/*
umount /mnt/primary
mkdir /mnt/secondary -p
mount -t nfs localhost:/storage/secondary /mnt/secondary
rm -rf /mnt/secondary/*
umount /mnt/secondary
#set template
mount -t nfs localhost:/storage/secondary /mnt/secondary
/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary-f /root/systemvmtemplate-2013-07-12-master-xen.vhd.bz2-h xenserver
umount /mnt/secondary
#start service
service cloudstack-management start
service cloudstack-agent start
#clean log
rm -f /var/log/cloudstack/management/*2014-*
echo '--------done-----------'


  步骤三:为文件赋权   chmod +x cloudclean.sh
  步骤四: 执行./cloudclean.sh
  往后每次要重置cloudstack 执行cloudclean.sh文件就可以了
         版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: 一键重置cloudstack 环境