第一步:CloudStack数据库的重新初始化
1)、停止CloudStack服务。service cloud-management stop.
2)、到mysql里查询select uuid from storage_pool; 删除存储的SR。
[root@aa ~]# mysql -u root -ptcloud
mysql> use cloud;
Database changed
mysql> select uuid from storage_pool;
+————————————–+
| uuid |
+————————————–+
| 6550eb15-daed-363e-be38-7e76bcd973ec |
| 7abfabe4-7081-3b1e-8ab3-4dcbc9633636 |
| db8002d3-1c41-383c-bab3-a561b9583547 |
+————————————–+
3 rows in set (0.00 sec)
3)、删除CloudStack数据库,drop database cloud; drop database cloud_usage;
[root@aa ~]# mysql -u root -ptcloud
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11958
Server version: 5.0.77 Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> drop database cloud; drop database cloud_usage;
4)、重新部署CloudStack数据库 cloudstack-setup-databases cloud:password@localhost –deploy-as=root:password
[root@aa ~]# cloud-setup-databases cloud:password@localhost –deploy-as=root:password
Testing specified deployment credentials on server localhost:3306
Setting up user credentials in:
-> /etc/cloud/management/db.properties … done.
Applying file /usr/share/cloud/setup/create-database.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-schema.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-database-premium.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-schema-premium.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/server-setup.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/templates.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-index-fk.sql to the database on server localhost:3306
5)、cloud-setup-management
[root@aa ~]# cloud-setup-management
Starting to configure ElasterStack Management Server:
Configure sudoers … [OK]
Configure Firewall … [OK]
Configure CloudStack Management Server …[OK]
ElasterStack Management Server setup is Done!
第二步:初始化主存储和二级存储
1)、删除主存储和二级存储中的所有文件
第三步:准备二级存储
1)、在管理节点上挂载二级储存NFS目录:/export/secondary。
# mkdir -p /mnt/secondary
# mount -t nfs 172.16.204.111:/export/secondary /mnt/secondary/
2)、下载SystemVm文件
3)、解压SystemVm文件
#/usr/lib64/cloud/agent/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -f systemvm.vhd.bz2 -h xenserver -F
4)、完成以后,卸载二级储存
#umount /mnt/secondary/
第四步:重新安装主机上的Hypervistor。
1)、停止CloudStack服务。service cloud-management stop.
2)、到mysql里查询select uuid from storage_pool; 删除存储的SR。
[root@aa ~]# mysql -u root -ptcloud
mysql> use cloud;
Database changed
mysql> select uuid from storage_pool;
+————————————–+
| uuid |
+————————————–+
| 6550eb15-daed-363e-be38-7e76bcd973ec |
| 7abfabe4-7081-3b1e-8ab3-4dcbc9633636 |
| db8002d3-1c41-383c-bab3-a561b9583547 |
+————————————–+
3 rows in set (0.00 sec)
3)、删除CloudStack数据库,drop database cloud; drop database cloud_usage;
[root@aa ~]# mysql -u root -ptcloud
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11958
Server version: 5.0.77 Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> drop database cloud; drop database cloud_usage;
4)、重新部署CloudStack数据库 cloudstack-setup-databases cloud:password@localhost –deploy-as=root:password
[root@aa ~]# cloud-setup-databases cloud:password@localhost –deploy-as=root:password
Testing specified deployment credentials on server localhost:3306
Setting up user credentials in:
-> /etc/cloud/management/db.properties … done.
Applying file /usr/share/cloud/setup/create-database.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-schema.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-database-premium.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-schema-premium.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/server-setup.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/templates.sql to the database on server localhost:3306
Applying file /usr/share/cloud/setup/create-index-fk.sql to the database on server localhost:3306
5)、cloud-setup-management
[root@aa ~]# cloud-setup-management
Starting to configure ElasterStack Management Server:
Configure sudoers … [OK]
Configure Firewall … [OK]
Configure CloudStack Management Server …[OK]
ElasterStack Management Server setup is Done!
第二步:初始化主存储和二级存储
1)、删除主存储和二级存储中的所有文件
第三步:准备二级存储
1)、在管理节点上挂载二级储存NFS目录:/export/secondary。
# mkdir -p /mnt/secondary
# mount -t nfs 172.16.204.111:/export/secondary /mnt/secondary/
2)、下载SystemVm文件
3)、解压SystemVm文件
#/usr/lib64/cloud/agent/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -f systemvm.vhd.bz2 -h xenserver -F
4)、完成以后,卸载二级储存
#umount /mnt/secondary/
第四步:重新安装主机上的Hypervistor。
如果要是不想重新安装主机上的Hypervistor,参考第一步的第2项,删除存储的Sr。
=====================================================================================================
在进行环境清理,然后重建环境需要注意的步骤
1. 管理节点
(1) 通过mysql客户端登陆mysql服务器,删除cloud,cloud_usage,cloudbridge库
(2) 重新通过命令初始化如上库
必要的时候(希望完全清理的时候),挂载二级存储,一级存储,删除所有文件,然后重新挂载二级存储,导入系统VM模板
2. 代理节点
(1) 针对KVM主机, virsh pool-destroy 原有的存储池 (一级存储以及二级存储)
(2) 针对VCenter,卸载原有挂载的存储(一级存储以及二级存储),需事先删除所有的主机跟模板文件。
然后再重新通过按照上面的安装步骤进行环境的重新搭建,基本不会出现由于旧环境的残留数据引起的奇怪问题。