概述
第一、环境
1、软件版本
CloudStack 3.0.5+XenServer 6.0.2
2、硬件设备
管理节点:DELL R420 10.30.18.2
计算节点:DELL R720 10.30.18.9
存储节点:DELL IBM520 10.30.18.4
3、网络环境
网段:10.30.18.0/24
网关:10.30.18.1
DNS:202.194.104.35
4、CloudStack规划
物理服务器网段: 10.30.18.2--10.30.18.15
管理网段: 10.30.18.16--10.30.18.24
来宾网段: 10.30.18.25--10.30.18.40
DNS: 8.8.8.8/8.8.4.4
存储类型: NFS
主存储: /export/primary1
辅助存储: /export/secondary
http服务器: 10.30.18.2
www目录: /var/www/html
5、故障原因及现象
1、硬件故障:计算节点R720内存问题导致非正常死机,并且不能正常启动
2、平台故障:排出了计算节点R720的硬件问题后,计算节点的状态是“error”
第二、处理流程
步骤一、首先备份cloud数据库
1.1登录管理节点10.30.18.2
[root@master ~]# hostname
master
[root@master ~]#
1.2查看当前的数据库列表
[root@master ~]# mysql -u root -p
Enter password:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cloud |
| cloud_usage |
| cloudbridge |
| glance |
| mysql |
| nova |
+--------------------+
7 rows in set (0.11 sec)
1.3备份cloud数据库
[root@master ~]# mysqldump -u root -p -A --event > ./db_all.20140426.sql
Enter password:
备注:-A 表示备份MySql中所有的数据库,恢复是需要先在MySql中新建数据库名。
步骤二、其次备份存储
2.1ssh登录存储:
[root@store ~]# hostname
store
[root@store ~]#
2.2备份主存储
[root@store ~]# cp -rpv /export/primary1/ /export/primary2
2.3备份服务存储
[root@store ~]# cp -rpv /export/secondary1/ /export/secondary2
步骤三、重建CloudStack环境
3.1先停止并删除在host下运行的实例VM
3.2禁用区域,并删除系统虚拟机(v,s,r)
3.4启用主存储的维护模式然后删除主存储 、二级存储
3.5启用主机host的维护模式然后删除host
3.6删除群集
3.7删除pod
3.8网络|来宾网络|删除
3.9区域|物理网络|删除
3.10删除区域
3.11清空NFS共享存储目录
#rm -rf /export/primary1/*
备注:原有的primary1目录数据已经备份到了primary2目录中
#rm -rf /export/secondary1/*
备注:原有的secondary1目录数据已经备份到了secondary2目录中
3.12停止CloudStack服务
3.13重新安装计算节点xenserver
3.14、删除CloudStack数据库
#drop database cloud; drop database cloud_usage;
3.15重新部署CS数据库
#cloud-setup-databases cloud:cloud@localhost --deploy-as=root:password
#cloud-setup-management
3.16安装系统模版(不同的hypervisor请安装不同的系统模版)
[root@management CloudStack-3.0.5-1-rhel6.2]# mount -t nfs 192.168.1.250:/storage/secondary /opt
[root@management CloudStack-3.0.5-1-rhel6.2]# /usr/lib64/cloud/agent/scripts/storage/secondary/cloud-install-sys-tmplt -m /opt -f /root/acton-systemvm-02062012.vhd.bz2 -h xenserver -F
[root@management ~]# umount /opt
3.17、启动cloud服务
#service cloud-management start
3.18、设置全局变量
Secstorage.allowed.internal.sites :设置辅助存储的允许范围
Expunge.delay :设置删除的延时
Expunge.interval :设置删除的时间间隔
Cpu.overprovisioning.factor :设置CPU超分
Mem.overprovisioning.factor :设置内存超分(3.0.5版本无效)
重启cloud-management服务:
#service cloud-management restart
步骤四、创建基本资源域环境
备注:此处不是重点,故此略过
步骤五、原有的数据结构
5.1进入msyql数据库
[root@master ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 128
Server version: 5.1.61-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>
5.2切换到cloud数据库
mysql> use cloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
5.3查看cloud数据库的表
mysql> show tables ;
+--------------------------------------+
| Tables_in_cloud |
+--------------------------------------+
| account |
| account_details |
| account_network_ref |
| account_vlan_map |
| alert |
| async_job |
| autoscale_policies |
| autoscale_policy_condition_map |
| autoscale_vmgroup_policy_map |
| autoscale_vmgroups |
| autoscale_vmprofiles |
| cluster |
| cluster_details |
| cluster_vsm_map |
| cmd_exec_log |
| conditions |
| configuration |
| console_proxy |
| counter |
| data_center |
| data_center_details |
| dc_storage_network_ip_range |
| disk_offering |
| domain |
| domain_network_ref |
| domain_router |
| elastic_lb_vm_map |
| event |
| external_firewall_devices |
| external_load_balancer_devices |
| firewall_rules |
| firewall_rules_cidrs |
| guest_os |
| guest_os_category |
| guest_os_hypervisor |
| host |
| host_details |
| host_pod_ref |
| host_tags |
| hypervisor_capabilities |
| inline_load_balancer_nic_map |
| instance_group |
| instance_group_vm_map |
| keystore |
| launch_permission |
| load_balancer_stickiness_policies |
| load_balancer_vm_map |
| load_balancing_rules |
| mshost |
| mshost_peer |
| netapp_lun |
| netapp_pool |
| netapp_volume |
| network_external_firewall_device_map |
| network_external_lb_device_map |
| network_offerings |
| network_rule_config |
| networks |
| nics |
| ntwk_offering_service_map |
| ntwk_service_map |
| op_dc_ip_address_alloc |
| op_dc_link_local_ip_address_alloc |
| op_dc_storage_network_ip_address |
| op_dc_vnet_alloc |
| op_ha_work |
| op_host |
| op_host_capacity |
| op_host_transfer |
| op_host_upgrade |
| op_it_work |
| op_lock |
| op_networks |
| op_nwgrp_work |
| op_pod_vlan_alloc |
| op_user_stats_log |
| op_vm_ruleset_log |
| ovs_tunnel_interface |
| ovs_tunnel_network |
| physical_network |
| physical_network_isolation_methods |
| physical_network_service_providers |
| physical_network_tags |
| physical_network_traffic_types |
| pod_vlan_map |
| port_forwarding_rules |
| port_profile |
| private_ip_address |
| project_account |
| project_invitations |
| projects |
| remote_access_vpn |
| resource_count |
| resource_limit |
| resource_tags |
| router_network_ref |
| s2s_customer_gateway |
| s2s_vpn_connection |
| s2s_vpn_gateway |
| secondary_storage_vm |
| security_group |
| security_group_rule |
| security_group_vm_map |
| sequence |
| service_offering |
| snapshot_policy |
| snapshot_schedule |
| snapshots |
| ssh_keypairs |
| stack_maid |
| static_routes |
| storage_pool |
| storage_pool_details |
| storage_pool_host_ref |
| storage_pool_work |
| swift |
| sync_queue |
| sync_queue_item |
| template_host_ref |
| template_spool_ref |
| template_swift_ref |
| template_zone_ref |
| upload |
| usage_event |
| user |
| user_ip_address |
| user_statistics |
| user_vm |
| user_vm_details |
| version |
| virtual_router_providers |
| virtual_supervisor_module |
| vlan |
| vm_instance |
| vm_template |
| vm_template_details |
| volume_host_ref |
| volumes |
| vpc |
| vpc_gateways |
| vpc_offering_service_map |
| vpc_offerings |
| vpn_users |
+--------------------------------------+
143 rows in set (0.01 sec)
mysql>
备注:
Snapshots表:用于存储快照信息
Volumes表:用于存储磁盘卷的信息
vm_template表:用于存储模板的信息
vm_instance表:用于存储vm实例的状态信息
5.4模板信息查询
mysql> select * from vm_template G;
*************************** 1. row ***************************
id: 1
unique_name: routing-1
name: SystemVM Template (XenServer)
uuid: 09ae938b-d62a-4dcc-90b2-139e0d662c2c
public: 0
featured: 0
type: SYSTEM
hvm: 0
bits: 64
url: http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2
format: VHD
created: 2014-04-25 12:52:26
removed: NULL
account_id: 1
checksum: f613f38c96bf039f2e5cbf92fa8ad4f8
display_text: SystemVM Template (XenServer)
enable_password: 0
enable_sshkey: 0
guest_os_id: 133
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 0
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 2. row ***************************
id: 2
unique_name: centos53-x86_64
name: CentOS 5.3(64-bit) no GUI (XenServer)
uuid: 8d99680f-0603-4788-850d-ba2ca3b359b3
public: 1
featured: 1
type: BUILTIN
hvm: 0
bits: 64
url: http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2
format: VHD
created: 2014-04-25 12:52:26
removed: 2014-04-25 12:52:26
account_id: 1
checksum: b63d854a9560c013142567bbae8d98cf
display_text: CentOS 5.3(64-bit) no GUI (XenServer)
enable_password: 0
enable_sshkey: 0
guest_os_id: 12
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 3. row ***************************
id: 3
unique_name: routing-3
name: SystemVM Template (KVM)
uuid: ed5bb518-40e3-42d2-9205-e09748a58fec
public: 0
featured: 0
type: SYSTEM
hvm: 0
bits: 64
url: http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2
format: QCOW2
created: 2014-04-25 12:52:26
removed: NULL
account_id: 1
checksum: 2755de1f9ef2ce4d6f2bee2efbb4da92
display_text: SystemVM Template (KVM)
enable_password: 0
enable_sshkey: 0
guest_os_id: 15
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 0
hypervisor_type: KVM
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 4. row ***************************
id: 4
unique_name: centos55-x86_64
name: CentOS 5.5(64-bit) no GUI (KVM)
uuid: 2ba11164-9e8a-4a18-8ba7-e99d7798c6b8
public: 1
featured: 1
type: BUILTIN
hvm: 0
bits: 64
url: http://download.cloud.com/releases/2.2.0/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2
format: QCOW2
created: 2014-04-25 12:52:26
removed: NULL
account_id: 1
checksum: ed0e788280ff2912ea40f7f91ca7a249
display_text: CentOS 5.5(64-bit) no GUI (KVM)
enable_password: 0
enable_sshkey: 0
guest_os_id: 112
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: KVM
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 5. row ***************************
id: 5
unique_name: centos56-x86_64-xen
name: CentOS 5.6(64-bit) no GUI (XenServer)
uuid: c5e28cd3-e1ee-49f5-a088-4a98412e013a
public: 1
featured: 1
type: BUILTIN
hvm: 0
bits: 64
url: http://download.cloud.com/templates/builtin/centos56-x86_64.vhd.bz2
format: VHD
created: 2014-04-25 12:52:26
removed: NULL
account_id: 1
checksum: 905cec879afd9c9d22ecc8036131a180
display_text: CentOS 5.6(64-bit) no GUI (XenServer)
enable_password: 0
enable_sshkey: 0
guest_os_id: 12
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 6. row ***************************
id: 7
unique_name: centos53-x64
name: CentOS 5.3(64-bit) no GUI (vSphere)
uuid: d543c5d1-ad5d-4d5b-a053-4217c29b5dc6
public: 1
featured: 1
type: BUILTIN
hvm: 0
bits: 64
url: http://download.cloud.com/releases/2.2.0/CentOS5.3-x86_64.ova
format: OVA
created: 2014-04-25 12:52:26
removed: NULL
account_id: 1
checksum: f6f881b7f2292948d8494db837fe0f47
display_text: CentOS 5.3(64-bit) no GUI (vSphere)
enable_password: 0
enable_sshkey: 0
guest_os_id: 12
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: VMware
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 7. row ***************************
id: 8
unique_name: routing-8
name: SystemVM Template (vSphere)
uuid: 3d5b1e59-f2b5-40cd-b48a-a740113f64ee
public: 0
featured: 0
type: SYSTEM
hvm: 0
bits: 32
url: http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova
format: OVA
created: 2014-04-25 12:52:26
removed: NULL
account_id: 1
checksum: 7137e453f950079ea2ba6feaafd939e8
display_text: SystemVM Template (vSphere)
enable_password: 0
enable_sshkey: 0
guest_os_id: 15
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 0
hypervisor_type: VMware
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 8. row ***************************
id: 9
unique_name: routing-9
name: SystemVM Template (HyperV)
uuid: a857a9ae-f84b-4623-917d-2c0b4cf51ad6
public: 0
featured: 0
type: SYSTEM
hvm: 0
bits: 32
url: http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2
format: VHD
created: 2014-04-25 12:52:27
removed: NULL
account_id: 1
checksum: f613f38c96bf039f2e5cbf92fa8ad4f8
display_text: SystemVM Template (HyperV)
enable_password: 0
enable_sshkey: 0
guest_os_id: 15
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 0
hypervisor_type: Hyperv
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 9. row ***************************
id: 200
unique_name: xs-tools.iso
name: xs-tools.iso
uuid: c37b4496-e717-4a90-8709-f68b40685451
public: 1
featured: 1
type: PERHOST
hvm: 1
bits: 64
url: NULL
format: ISO
created: 2014-04-25 04:58:50
removed: NULL
account_id: 1
checksum: NULL
display_text: xen-pv-drv-iso
enable_password: 0
enable_sshkey: 0
guest_os_id: 1
bootable: 0
prepopulate: 0
cross_zones: 0
extractable: 1
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 10. row ***************************
id: 201
unique_name: vmware-tools.iso
name: vmware-tools.iso
uuid: 2d8a85df-797a-4e89-a5e0-20cf59879908
public: 1
featured: 1
type: PERHOST
hvm: 1
bits: 64
url: NULL
format: ISO
created: 2014-04-25 04:58:50
removed: NULL
account_id: 1
checksum: NULL
display_text: VMware Tools Installer ISO
enable_password: 0
enable_sshkey: 0
guest_os_id: 1
bootable: 0
prepopulate: 0
cross_zones: 0
extractable: 1
hypervisor_type: VMware
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 11. row ***************************
id: 202
unique_name: 202-2-c12d92c2-f887-338c-92d5-f94b763cdd33
name: XP-SP2
uuid: 7fe10c23-bcc3-4dbf-b8a3-0cc127572fdf
public: 1
featured: 1
type: USER
hvm: 1
bits: 64
url: http://10.30.18.2/xp-sp2.vhd
format: VHD
created: 2014-04-25 05:21:15
removed: NULL
account_id: 2
checksum: ad809b9d150d250a26ca71e789f84c84
display_text: XP-SP2
enable_password: 0
enable_sshkey: 0
guest_os_id: 57
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 12. row ***************************
id: 203
unique_name: 203-2-668b7c7a-7774-300a-a9ca-a5249be5b4b1
name: From-Xen-29
uuid: 7ff9e9f1-77f8-4e40-b215-4afc338280fa
public: 1
featured: 1
type: USER
hvm: 1
bits: 64
url: http://10.30.18.253/1.vhd
format: VHD
created: 2014-04-25 10:38:23
removed: NULL
account_id: 2
checksum: 3af44c7e8da0fb52d40b307b0f11da46
display_text: From-Xen-29
enable_password: 0
enable_sshkey: 0
guest_os_id: 57
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 13. row ***************************
id: 204
unique_name: 204-2-f15c830f-47b8-37ec-98e2-a2be08fd85f3
name: From-Xen-32
uuid: 27a73131-f4bc-4677-ab5f-f9827842f0c1
public: 1
featured: 1
type: USER
hvm: 1
bits: 64
url: http://10.30.18.253/2.vhd
format: VHD
created: 2014-04-25 10:57:48
removed: NULL
account_id: 2
checksum: e07dd873eb4709f971cac9d19f8eaf2d
display_text: From-Xen-32
enable_password: 0
enable_sshkey: 0
guest_os_id: 57
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
*************************** 14. row ***************************
id: 205
unique_name: 205-2-1cd88b93-7b85-3ac1-bdb0-60ba36dfe858
name: From-Xen-30
uuid: e9462983-7757-446d-9b79-197f345ccc42
public: 1
featured: 1
type: USER
hvm: 1
bits: 64
url: http://10.30.18.253/From-Xen-30.vhd
format: VHD
created: 2014-04-25 11:15:39
removed: NULL
account_id: 2
checksum: 1d5b5dbacb59bbf0a5ca596b17d4997e
display_text: From-Xen-30
enable_password: 0
enable_sshkey: 0
guest_os_id: 57
bootable: 1
prepopulate: 0
cross_zones: 1
extractable: 1
hypervisor_type: XenServer
source_template_id: NULL
template_tag: NULL
sort_key: 0
14 rows in set (0.00 sec)
ERROR:
No query specified
mysql>
5.5查看卷信息:
备注:我们在此处指查看有效的卷的信息
mysql> select * from volumes where state="ready" G ;
*************************** 1. row ***************************
id: 1
account_id: 1
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 1
device_id: 0
name: ROOT-1
uuid: 0b0af6f9-e5e8-45d1-81a2-8fe0d47a5ddf
size: 2147483648
folder: /export/primary1
path: be954476-935f-4d7a-a8a1-021d8882a39d
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: ROOT
pool_type: NetworkFilesystem
disk_offering_id: 7
template_id: 1
first_snapshot_backup_uuid: NULL
recreatable: 1
created: 2014-04-25 05:16:39
attached: NULL
updated: 2014-04-25 05:17:05
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 2. row ***************************
id: 2
account_id: 1
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 2
device_id: 0
name: ROOT-2
uuid: 02fcdc20-7821-482e-868b-16b794d3152a
size: 2147483648
folder: /export/primary1
path: 29fa2289-e368-4507-a94e-0ceec3f64a55
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: ROOT
pool_type: NetworkFilesystem
disk_offering_id: 8
template_id: 1
first_snapshot_backup_uuid: NULL
recreatable: 1
created: 2014-04-25 05:16:39
attached: NULL
updated: 2014-04-25 05:17:03
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 3. row ***************************
id: 4
account_id: 2
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 25
device_id: 1
name: From-Xen-32-E
uuid: d95b871b-bafd-4977-969f-a35df98564b9
size: 0
folder: /export/primary1
path: 97946a32-c7ac-4462-830b-8118625d426b
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: DATADISK
pool_type: NULL
disk_offering_id: 6
template_id: NULL
first_snapshot_backup_uuid: NULL
recreatable: 0
created: 2014-04-25 05:34:27
attached: 2014-04-26 02:05:12
updated: 2014-04-26 02:05:12
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 4. row ***************************
id: 5
account_id: 2
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 24
device_id: 1
name: From-Xen-30-E
uuid: 2634287f-13ce-4d7a-89ac-eaf57e4827d6
size: 0
folder: /export/primary1
path: 61aab5bc-0194-494b-a2b6-bbbc6fc80abc
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: DATADISK
pool_type: NULL
disk_offering_id: 6
template_id: NULL
first_snapshot_backup_uuid: NULL
recreatable: 0
created: 2014-04-25 05:46:41
attached: 2014-04-26 01:59:36
updated: 2014-04-26 01:59:36
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 5. row ***************************
id: 6
account_id: 2
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 21
device_id: 1
name: From-Xen-29-E.vhd
uuid: c8931ae2-555b-487d-8995-71359dab3dea
size: 0
folder: /export/primary1
path: d8a44de4-caf2-48b0-93c6-83737af4ba61
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: DATADISK
pool_type: NULL
disk_offering_id: 6
template_id: NULL
first_snapshot_backup_uuid: NULL
recreatable: 0
created: 2014-04-25 05:57:18
attached: 2014-04-26 02:02:18
updated: 2014-04-26 02:02:18
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 6. row ***************************
id: 8
account_id: 1
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 4
device_id: 0
name: ROOT-4
uuid: d34eb543-3c3f-4490-a3b0-a8848bca7868
size: 2147483648
folder: /export/primary1
path: 02ee677a-4cc8-4da8-be7c-9e45a2ff5e0d
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: ROOT
pool_type: NetworkFilesystem
disk_offering_id: 10
template_id: 1
first_snapshot_backup_uuid: NULL
recreatable: 1
created: 2014-04-25 10:43:00
attached: NULL
updated: 2014-04-25 10:43:02
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 7. row ***************************
id: 25
account_id: 2
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 21
device_id: 0
name: ROOT-21
uuid: 1696e7d1-bb73-41a5-8e2d-8045571b08a5
size: 21474836480
folder: /export/primary1
path: d62bd6ab-9485-47a6-8c30-413567b01ff3
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: ROOT
pool_type: NetworkFilesystem
disk_offering_id: 2
template_id: 203
first_snapshot_backup_uuid: NULL
recreatable: 0
created: 2014-04-26 01:23:15
attached: NULL
updated: 2014-04-26 01:23:35
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 8. row ***************************
id: 28
account_id: 2
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 24
device_id: 0
name: ROOT-24
uuid: bda0efb8-7383-4db1-a70d-44232264b97c
size: 26843545600
folder: /export/primary1
path: 25e7160e-4fb3-4bab-9d81-d45789aa4cbc
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: ROOT
pool_type: NetworkFilesystem
disk_offering_id: 1
template_id: 205
first_snapshot_backup_uuid: NULL
recreatable: 0
created: 2014-04-26 01:42:57
attached: NULL
updated: 2014-04-26 01:43:16
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
*************************** 9. row ***************************
id: 29
account_id: 2
domain_id: 1
pool_id: 200
last_pool_id: NULL
instance_id: 25
device_id: 0
name: ROOT-25
uuid: 8b20c9e4-d119-45d7-9d21-dd334430da22
size: 21474836480
folder: /export/primary1
path: f6886c71-da8f-461a-8576-88ce54752f01
pod_id: 1
data_center_id: 1
iscsi_name: NULL
host_ip: NULL
volume_type: ROOT
pool_type: NetworkFilesystem
disk_offering_id: 2
template_id: 204
first_snapshot_backup_uuid: NULL
recreatable: 0
created: 2014-04-26 01:48:51
attached: NULL
updated: 2014-04-26 01:49:10
removed: NULL
state: Ready
chain_info: NULL
update_count: 3
9 rows in set (0.00 sec)
ERROR:
No query specified
mysql>
5.6查看快照信息:
mysql> select * from snapshots G;
*************************** 1. row ***************************
id: 1
data_center_id: 1
account_id: 2
domain_id: 1
volume_id: 29
disk_offering_id: 2
status: BackedUp
path: 04625f12-5a13-47cf-a923-f664ad900f83
name: Feom-Xen-32_ROOT-25_20140426072726
uuid: e2c74b43-f335-4c35-95a0-1a49f3a7edda
snapshot_type: 0
type_description: MANUAL
size: 21474836480
created: 2014-04-26 07:27:26
removed: NULL
backup_snap_id: b84fcc71-e731-4a33-9c81-8c8a82b8f5a4
swift_id: NULL
sechost_id: 2
prev_snap_id: 0
hypervisor_type: XenServer
version: 2.2
*************************** 2. row ***************************
id: 2
data_center_id: 1
account_id: 2
domain_id: 1
volume_id: 28
disk_offering_id: 1
status: BackedUp
path: 452df58e-c096-4faa-b047-3e72bf1f835c
name: From-Xen-30_ROOT-24_20140426073350
uuid: 0ab1b21f-0b5b-4bce-aaff-e048a741cf67
snapshot_type: 0
type_description: MANUAL
size: 26843545600
created: 2014-04-26 07:33:50
removed: NULL
backup_snap_id: 70f0ed98-4416-481f-8c85-df2cfaef4e33
swift_id: NULL
sechost_id: 2
prev_snap_id: 0
hypervisor_type: XenServer
version: 2.2
*************************** 3. row ***************************
id: 3
data_center_id: 1
account_id: 2
domain_id: 1
volume_id: 25
disk_offering_id: 2
status: BackedUp
path: e36f792d-baaf-4c85-89a5-2e7993fcf9ed
name: From-Xen-29_ROOT-21_20140426074236
uuid: 30f67775-5041-425e-bd74-c6b42e004a2f
snapshot_type: 0
type_description: MANUAL
size: 21474836480
created: 2014-04-26 07:42:36
removed: NULL
backup_snap_id: 0ae4c760-04ad-4e98-9434-3f6194b734e6
swift_id: NULL
sechost_id: 2
prev_snap_id: 0
hypervisor_type: XenServer
version: 2.2
*************************** 4. row ***************************
id: 4
data_center_id: 1
account_id: 2
domain_id: 1
volume_id: 6
disk_offering_id: 6
status: BackedUp
path: 2da8f237-73ef-49db-9407-58bc3e3c356c
name: From-Xen-29_From-Xen-29-E.vhd_20140426074703
uuid: 5529d2b2-63a7-45d9-8acb-9e69d1dceddf
snapshot_type: 0
type_description: MANUAL
size: 0
created: 2014-04-26 07:47:03
removed: NULL
backup_snap_id: 5ce7cdf7-ac9e-40f0-8312-67b63af68b55
swift_id: NULL
sechost_id: 2
prev_snap_id: 0
hypervisor_type: XenServer
version: 2.2
*************************** 5. row ***************************
id: 5
data_center_id: 1
account_id: 2
domain_id: 1
volume_id: 5
disk_offering_id: 6
status: BackedUp
path: 44592b6b-0841-451f-836f-27a51b2305ea
name: From-Xen-30_From-Xen-30-E_20140426075223
uuid: c9925754-4281-41f0-9cf4-cc054c4b1457
snapshot_type: 0
type_description: MANUAL
size: 0
created: 2014-04-26 07:52:23
removed: NULL
backup_snap_id: 3db95d31-1698-4477-b12a-0c15d147fff2
swift_id: NULL
sechost_id: 2
prev_snap_id: 0
hypervisor_type: XenServer
version: 2.2
*************************** 6. row ***************************
id: 6
data_center_id: 1
account_id: 2
domain_id: 1
volume_id: 4
disk_offering_id: 6
status: BackedUp
path: 5c01d9b1-2cff-4e0a-a3d2-8f910c97a7da
name: Feom-Xen-32_From-Xen-32-E_20140426075617
uuid: 7c68cc22-0fdf-4ee5-b115-47a3321bec64
snapshot_type: 0
type_description: MANUAL
size: 0
created: 2014-04-26 07:56:17
removed: NULL
backup_snap_id: ffa76d2d-09d7-4370-9468-e4530502a9ca
swift_id: NULL
sechost_id: 2
prev_snap_id: 0
hypervisor_type: XenServer
version: 2.2
6 rows in set (0.00 sec)
ERROR:
No query specified
mysql>
5.7主存储目录结构
[root@store export]# tree /export/primary2/
/export/primary2/
├── 02ee677a-4cc8-4da8-be7c-9e45a2ff5e0d.vhd
├── 04625f12-5a13-47cf-a923-f664ad900f83.vhd
├── 0d8f2f3a-beb7-4143-a957-271f0db624c2.vhd
├── 0f8b87bf-b940-4e80-be49-84ec169e6b4d.vhd
├── 240248db-4349-4c40-852f-64d6026941de.vhd
├── 25e7160e-4fb3-4bab-9d81-d45789aa4cbc.vhd
├── 27ff71bd-7cf9-4b63-896c-a00218a11142.vhd
├── 29fa2289-e368-4507-a94e-0ceec3f64a55.vhd
├── 2da8f237-73ef-49db-9407-58bc3e3c356c.vhd
├── 3b1816bb-3a7c-44ec-a4f7-84a8856137d9.vhd
├── 406c648c-1e92-4d38-8df5-a0ee0ae5bae4.vhd
├── 44592b6b-0841-451f-836f-27a51b2305ea.vhd
├── 452df58e-c096-4faa-b047-3e72bf1f835c.vhd
├── 452fdffa-e3a9-4d24-b711-c7815a8334fa.vhd
├── 4aa0c2d7-0a5d-49ca-b70b-aca784809bee.vhd
├── 5956d4e5-c017-44be-a76d-834582531a69.vhd
├── 5c01d9b1-2cff-4e0a-a3d2-8f910c97a7da.vhd
├── 61aab5bc-0194-494b-a2b6-bbbc6fc80abc.vhd
├── 73b6f520-7eb7-452d-a7d6-539e51e1420d.vhd
├── 7df29dcb-6b61-4c3e-9154-0cdb7a43f6a5.vhd
├── 8740f9dd-4b42-40b1-9599-991a9f41cc35.vhd
├── 97946a32-c7ac-4462-830b-8118625d426b.vhd
├── b66df6b8-0fcc-4396-a45c-8f8293b69667.vhd
├── b99d9dd4-ac2a-487c-aa23-f6f49d240138.vhd
├── be954476-935f-4d7a-a8a1-021d8882a39d.vhd
├── d62bd6ab-9485-47a6-8c30-413567b01ff3.vhd
├── d8a44de4-caf2-48b0-93c6-83737af4ba61.vhd
├── e36f792d-baaf-4c85-89a5-2e7993fcf9ed.vhd
├── f6886c71-da8f-461a-8576-88ce54752f01.vhd
├── f6b78a5b-a74d-4304-8c24-3eec8a7b7456.vhd
├── f740dd0f-1b98-4dd7-bff1-e49ea9dfbd1b.vhd
├── filelog.txt
└── hb-e4d87710-e512-412b-a7e9-5d232ee997cd
0 directories, 33 files
5.8辅助存储目录结构
[root@store export]# tree /export/secondary2/
/export/secondary2/
├── snapshots
│ └── 2
│ ├── 25
│ │ └── 0ae4c760-04ad-4e98-9434-3f6194b734e6.vhd
│ ├── 28
│ │ └── 70f0ed98-4416-481f-8c85-df2cfaef4e33.vhd
│ ├── 29
│ │ └── b84fcc71-e731-4a33-9c81-8c8a82b8f5a4.vhd
│ ├── 4
│ │ └── ffa76d2d-09d7-4370-9468-e4530502a9ca.vhd
│ ├── 5
│ │ └── 3db95d31-1698-4477-b12a-0c15d147fff2.vhd
│ └── 6
│ └── 5ce7cdf7-ac9e-40f0-8312-67b63af68b55.vhd
├── template
│ └── tmpl
│ ├── 1
│ │ ├── 1
│ │ │ ├── 33fba9d6-8e9b-490f-b181-9a7fd2e317af.vhd
│ │ │ └── template.properties
│ │ └── 5
│ │ ├── d5110832-1f02-3a25-a367-100e39014764.vhd
│ │ └── template.properties
│ └── 2
│ ├── 202
│ │ ├── 066508b8-b6a7-3e20-b91f-9e8ab46c7b43.vhd
│ │ └── template.properties
│ ├── 203
│ │ ├── e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd
│ │ └── template.properties
│ ├── 204
│ │ ├── 4bb608b4-e7dd-3a91-9c6f-43a9d18a0c0c.vhd
│ │ └── template.properties
│ └── 205
│ ├── ee292850-77c3-3708-a5e6-68ce68e8e823.vhd
│ └── template.properties
└── volumes
19 directories, 18 files
步骤六、导出模板
备注1:导出的vhd模板文件可以在CloudStack环境中通过“上传模板”进行导入
备注2:以From-Xen-29模板导出为例,其它模板的导出同样操作
6.1进入mysql数据库
[root@master ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 135
Server version: 5.1.61-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> use cloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
6.2查看"From-Xen-29"模板的存放路径
mysql> select id from vm_template where name="From-Xen-29"; #得到id=202
+-----+
| id |
+-----+
| 203 |
+-----+
备注:此处的203就是模板“From-Xen-29”模板在二级存储目录中的路径“.../template/tmpl/203”
mysql> select install_path from template_host_ref where template_id="203" and destroyed="0"; #得到vhd文件
+----------------------------------------------------------------+
| install_path |
+----------------------------------------------------------------+
| template/tmpl//2/203//e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd |
+----------------------------------------------------------------+
1 row in set (0.00 sec)
6.3查看二级存储中模板(template)目录结构
备注:数据库得到的id=203和目录结构中的203目录是对应的。
[root@store export]# tree /export/secondary2/template/tmpl/
/export/secondary2/template/tmpl/
├── 1
│ ├── 1
│ │ ├── 33fba9d6-8e9b-490f-b181-9a7fd2e317af.vhd
│ │ └── template.properties
│ └── 5
│ ├── d5110832-1f02-3a25-a367-100e39014764.vhd
│ └── template.properties
└── 2
├── 202
│ ├── 066508b8-b6a7-3e20-b91f-9e8ab46c7b43.vhd
│ └── template.properties
├── 203
│ ├── e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd
│ └── template.properties
├── 204
│ ├── 4bb608b4-e7dd-3a91-9c6f-43a9d18a0c0c.vhd
│ └── template.properties
└── 205
├── ee292850-77c3-3708-a5e6-68ce68e8e823.vhd
└── template.properties
8 directories, 12 files
6.4查看vhd模板文件的大小
[root@store export]# du -h /export/secondary2/template/tmpl/2/203/e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd
3.1G /export/secondary2/template/tmpl/2/203/e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd
6.5查看vhd模板文件的说明概述文件
[root@store export]# cat /export/secondary2/template/tmpl/2/203/template.properties
#
#Fri Apr 25 10:41:25 UTC 2014
filename=e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd
vhd=true
id=203
vhd.filename=e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd
public=true
uniquename=203-2-668b7c7a-7774-300a-a9ca-a5249be5b4b1
vhd.virtualsize=21474836480
virtualsize=21474836480
checksum=3af44c7e8da0fb52d40b307b0f11da46
hvm=true
description=
vhd.size=3263279616
size=3263279616
6.6复制模板vhd文件
/export/secondary2/template/tmpl/2/203/e872d515-2858-33a8-802a-a4bd89c4b7fb.vhd
步骤七、导出数据卷(未成功)
说明:此处我们导出的数据卷的容量大小明显和我们需要导出的vhd卷文件不匹配,可能原因是由于数据磁盘附加到了vm虚拟机上,CloudStack会不断的更新数据磁盘
备注1:以From-Xen-30-E数据卷的导出为例
特别注意:此处我们主要的是导出数据卷,而不是ROOT根卷,因为发生故障时ROOT卷一般都不正常,即使导出了也不能用
而ROOT卷的数据,我们通过之前的模板导出来恢复
7.1进入mysql数据库
[root@master ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 135
Server version: 5.1.61-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> use cloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
7.2查看”volumes”表中 name="From-Xen-30-E"并且state="ready"的记录中path和folder
mysql> select path,folder from volumes where state="ready" and name="From-Xen-30-E" G;
*************************** 1. row ***************************
path: 61aab5bc-0194-494b-a2b6-bbbc6fc80abc
folder: /export/primary1
1 row in set (0.00 sec)
备注:根据folder的值可以知道卷文件的保存位置在主存储中,根据path确定vhd文件的名称
7.3查看主存储的结构
[root@store export]# tree /export/primary2/
/export/primary2/
├── 02ee677a-4cc8-4da8-be7c-9e45a2ff5e0d.vhd
├── 04625f12-5a13-47cf-a923-f664ad900f83.vhd
├── 0d8f2f3a-beb7-4143-a957-271f0db624c2.vhd
├── 0f8b87bf-b940-4e80-be49-84ec169e6b4d.vhd
├── 240248db-4349-4c40-852f-64d6026941de.vhd
├── 25e7160e-4fb3-4bab-9d81-d45789aa4cbc.vhd
├── 27ff71bd-7cf9-4b63-896c-a00218a11142.vhd
├── 29fa2289-e368-4507-a94e-0ceec3f64a55.vhd
├── 2da8f237-73ef-49db-9407-58bc3e3c356c.vhd
├── 3b1816bb-3a7c-44ec-a4f7-84a8856137d9.vhd
├── 406c648c-1e92-4d38-8df5-a0ee0ae5bae4.vhd
├── 44592b6b-0841-451f-836f-27a51b2305ea.vhd
├── 452df58e-c096-4faa-b047-3e72bf1f835c.vhd
├── 452fdffa-e3a9-4d24-b711-c7815a8334fa.vhd
├── 4aa0c2d7-0a5d-49ca-b70b-aca784809bee.vhd
├── 5956d4e5-c017-44be-a76d-834582531a69.vhd
├── 5c01d9b1-2cff-4e0a-a3d2-8f910c97a7da.vhd
├── 61aab5bc-0194-494b-a2b6-bbbc6fc80abc.vhd
├── 73b6f520-7eb7-452d-a7d6-539e51e1420d.vhd
├── 7df29dcb-6b61-4c3e-9154-0cdb7a43f6a5.vhd
├── 8740f9dd-4b42-40b1-9599-991a9f41cc35.vhd
├── 97946a32-c7ac-4462-830b-8118625d426b.vhd
├── b66df6b8-0fcc-4396-a45c-8f8293b69667.vhd
├── b99d9dd4-ac2a-487c-aa23-f6f49d240138.vhd
├── be954476-935f-4d7a-a8a1-021d8882a39d.vhd
├── d62bd6ab-9485-47a6-8c30-413567b01ff3.vhd
├── d8a44de4-caf2-48b0-93c6-83737af4ba61.vhd
├── e36f792d-baaf-4c85-89a5-2e7993fcf9ed.vhd
├── f6886c71-da8f-461a-8576-88ce54752f01.vhd
├── f6b78a5b-a74d-4304-8c24-3eec8a7b7456.vhd
├── f740dd0f-1b98-4dd7-bff1-e49ea9dfbd1b.vhd
├── filelog.txt
└── hb-e4d87710-e512-412b-a7e9-5d232ee997cd
0 directories, 33 files
[root@store export]# du -h /export/primary2/61aab5bc-0194-494b-a2b6-bbbc6fc80abc.vhd
4.4M /export/primary2/61aab5bc-0194-494b-a2b6-bbbc6fc80abc.vhd
备注:CloudStack正常时尝试,vhd的大小不正常。这个可能是由于数据磁盘已经附加在了vm虚拟机上
步骤八、导出快照
备注1:导出的vhd快照文件可以在CloudStack环境中进行导入,类型不同导入方法不同:
DATA快照:通过“上载卷”导入
ROOT快照:通过“上传模板”导入
备注2:以导出”From-Xen-29”的根ROOT卷的快照为例
8.1进入mysql数据库
[root@master ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 135
Server version: 5.1.61-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> use cloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
8.2查看有效的快照信息
备注:backup_snap_id表示快照的vhd文件名称
备注:该环境中我们只为每个卷做个一个快照
mysql> select name,backup_snap_id from snapshots where status="backedup" G;
*************************** 1. row ***************************
name: Feom-Xen-32_ROOT-25_20140426072726
backup_snap_id: b84fcc71-e731-4a33-9c81-8c8a82b8f5a4
*************************** 2. row ***************************
name: From-Xen-30_ROOT-24_20140426073350
backup_snap_id: 70f0ed98-4416-481f-8c85-df2cfaef4e33
*************************** 3. row ***************************
name: From-Xen-29_ROOT-21_20140426074236
backup_snap_id: 0ae4c760-04ad-4e98-9434-3f6194b734e6
*************************** 4. row ***************************
name: From-Xen-29_From-Xen-29-E.vhd_20140426074703
backup_snap_id: 5ce7cdf7-ac9e-40f0-8312-67b63af68b55
*************************** 5. row ***************************
name: From-Xen-30_From-Xen-30-E_20140426075223
backup_snap_id: 3db95d31-1698-4477-b12a-0c15d147fff2
*************************** 6. row ***************************
name: Feom-Xen-32_From-Xen-32-E_20140426075617
backup_snap_id: ffa76d2d-09d7-4370-9468-e4530502a9ca
6 rows in set (0.00 sec)
8.3查看辅助存储快照snapshots目录结构
[root@store export]# tree /export/secondary2/snapshots/
/export/secondary2/snapshots/
└── 2
├── 25
│ └── 0ae4c760-04ad-4e98-9434-3f6194b734e6.vhd
├── 28
│ └── 70f0ed98-4416-481f-8c85-df2cfaef4e33.vhd
├── 29
│ └── b84fcc71-e731-4a33-9c81-8c8a82b8f5a4.vhd
├── 4
│ └── ffa76d2d-09d7-4370-9468-e4530502a9ca.vhd
├── 5
│ └── 3db95d31-1698-4477-b12a-0c15d147fff2.vhd
└── 6
└── 5ce7cdf7-ac9e-40f0-8312-67b63af68b55.vhd
备注:”.../snapshots/2/25/0ae4c760-04ad-4e98-9434-3f6194b734e6.vhd”是我们要导出的vhd文件。
8.4查看”From-Xen-29”的ROOT卷快照的大小
[root@store export]# du -h /export/secondary2/snapshots/2/25/0ae4c760-04ad-4e98-9434-3f6194b734e6.vhd
3.6G /export/secondary2/snapshots/2/25/0ae4c760-04ad-4e98-9434-3f6194b734e6.vhd
8.5复制vhd快照文件
/export/secondary2/snapshots/2/25/0ae4c760-04ad-4e98-9434-3f6194b734e6.vhd
特别说明:
CloudStack导出打vhd文件,并不能通过XenCenter导入到XenServer中。具体原因未知
最后
以上就是多情路人为你收集整理的CloudStack环境重建之数据导出的全部内容,希望文章能够帮你解决CloudStack环境重建之数据导出所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复