在OpenStack云平台上手动迁移云主机操作步骤

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 在OpenStack云平台上手动迁移云主机操作步骤

OpenStack云平台上手动迁移云主机

[root@controller ~]# source /etc/keystone/admin-openrc.sh 
[root@controller ~]# nova list
+--------------------------------------+-----------+--------+------------+-------------+------------------------+
| ID                                   | Name      | Status | Task State | Power State | Networks               |
+--------------------------------------+-----------+--------+------------+-------------+------------------------+
| c2b5ed8f-0a7c-4bd4-adab-78b096cb0857 | master    | ACTIVE | -          | Running     | ext-net=192.168.200.6  |
| a372558d-884c-421f-9b32-2dce2e99118e | node      | ACTIVE | -          | Running     | ext-net=192.168.200.7  |
| 5136c8ff-76ea-466d-b0c1-ae4be6f693e2 | rabbitmq1 | ACTIVE | -          | Running     | ext-net=192.168.200.21 |
| 6901f6ae-31de-4dbf-b37b-673d9526e135 | rabbitmq2 | ACTIVE | -          | Running     | ext-net=192.168.200.5  |
| 0fe821f7-7184-4378-90d2-0e62a0f03600 | rabbitmq3 | ACTIVE | -          | Running     | ext-net=192.168.200.3  |
+--------------------------------------+-----------+--------+------------+-------------+------------------------+
[root@controller ~]# nova show rabbitmq1
+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | AUTO                                                     |
| OS-EXT-AZ:availability_zone          | nova                                                     |
| OS-EXT-SRV-ATTR:host                 | controller                                               |
| OS-EXT-SRV-ATTR:hostname             | rabbitmq1                                                |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | controller                                               |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000019                                        |
| OS-EXT-SRV-ATTR:kernel_id            |                                                          |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                        |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                          |
| OS-EXT-SRV-ATTR:reservation_id       | r-9q8w190y                                               |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                 |
| OS-EXT-SRV-ATTR:user_data            | -                                                        |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2020-11-19T00:47:28.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2020-11-19T00:47:19Z                                     |
| description                          | -                                                        |
| ext-net network                      | 192.168.200.21                                           |
| flavor:disk                          | 20                                                       |
| flavor:ephemeral                     | 0                                                        |
| flavor:extra_specs                   | {}                                                       |
| flavor:original_name                 | mysql                                                    |
| flavor:ram                           | 2048                                                     |
| flavor:swap                          | 0                                                        |
| flavor:vcpus                         | 1                                                        |
| hostId                               | c679b0b05edfbd4e0072f93d8408ff78bff3a4cbde7b02e93690c7b5 |
| host_status                          | UP                                                       |
| id                                   | 5136c8ff-76ea-466d-b0c1-ae4be6f693e2                     |
| image                                | centos7.5 (8b03410b-4f3d-49fa-9acf-c0a1aa20160c)         |
| key_name                             | -                                                        |
| locked                               | False                                                    |
| metadata                             | {}                                                       |
| name                                 | rabbitmq1                                                |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| status                               | ACTIVE                                                   |
| tags                                 | []                                                       |
| tenant_id                            | 03a2483a6b364606b7e0bc3ccc6064b2                         |
| updated                              | 2020-11-19T00:47:28Z                                     |
| user_id                              | f54f627a05984048984fd117c894925e                         |
+--------------------------------------+----------------------------------------------------------+
[root@controller ~]# nova stop rabbitmq1
Request to stop server rabbitmq1 has been accepted.
[root@controller ~]# cd /var/lib/nova/instances/
[root@controller instances]# ll
total 4
drwxr-xr-x. 2 nova nova  54 Nov 19 08:47 5136c8ff-76ea-466d-b0c1-ae4be6f693e2
drwxr-xr-x. 2 nova nova  54 Nov 19 08:53 6901f6ae-31de-4dbf-b37b-673d9526e135
drwxr-xr-x. 2 nova nova 102 Nov 18 14:15 _base
-rw-r--r--. 1 nova nova  33 Nov 19 08:22 compute_nodes
drwxr-xr-x. 2 nova nova 146 Nov 18 14:13 locks
[root@controller instances]# cd 5136c8ff-76ea-466d-b0c1-ae4be6f693e2/
[root@controller 5136c8ff-76ea-466d-b0c1-ae4be6f693e2]# ll
total 118992
-rw-------. 1 root root     52436 Nov 19 09:29 console.log
-rw-r--r--. 1 root root 121831424 Nov 19 09:29 disk
-rw-r--r--. 1 nova nova        79 Nov 19 08:47 disk.info
[root@controller 5136c8ff-76ea-466d-b0c1-ae4be6f693e2]# cd ..
[root@controller instances]# scp -r 5136c8ff-76ea-466d-b0c1-ae4be6f693e2 root@compute:/var/lib/nova/instances/
root@compute's password: 
disk.info                                                                            100%   79     7.2KB/s   00:00    
disk                                                                                 100%  116MB   6.5MB/s   00:18    
console.log                                                                          100%   51KB   3.8MB/s   00:00    
[root@controller instances]# rm -rf 5136c8ff-76ea-466d-b0c1-ae4be6f693e2/
# 【compute】
[root@compute ~]# cd /var/lib/nova/instances/
[root@compute instances]# ll
total 4
drwxr-xr-x. 2 nova nova 54 Nov 19 08:55 0fe821f7-7184-4378-90d2-0e62a0f03600
drwxr-xr-x. 2 root root 54 Nov 19 09:30 5136c8ff-76ea-466d-b0c1-ae4be6f693e2
drwxr-xr-x. 2 nova nova 54 Nov 14 17:02 a372558d-884c-421f-9b32-2dce2e99118e
drwxr-xr-x. 2 nova nova 54 Nov 13 11:55 _base
drwxr-xr-x. 2 nova nova 54 Nov 14 17:00 c2b5ed8f-0a7c-4bd4-adab-78b096cb0857
-rw-r--r--. 1 nova nova 30 Nov 19 09:00 compute_nodes
drwxr-xr-x. 2 nova nova 93 Nov 13 12:29 locks
[root@compute instances]# chown nova:nova 5136c8ff-76ea-466d-b0c1-ae4be6f693e2/
【controller】
[root@controller instances]# mysql -uroot -p000000
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13553
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| cinder             |
| glance             |
| heat               |
| information_schema |
| keystone           |
| mysql              |
| neutron            |
| nova               |
| nova_api           |
| nova_cell0         |
| performance_schema |
| zun                |
+--------------------+
12 rows in set (0.01 sec)
MariaDB [(none)]> use nova
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
MariaDB [nova]> update instances set host='compute',node='compute' where uuid='5136c8ff-76ea-466d-b0c1-ae4be6f693e2';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
MariaDB [nova]> flush privileges;
Query OK, 0 rows affected (0.08 sec)
MariaDB [nova]> Ctrl-C -- exit!
Aborted
【compute】
MainPID=25265 Id=openstack-nova-compute.service ActiveState=active
[root@compute instances]# systemctl restart openstack-nova-compute.service
[root@compute instances]# nova start 5136c8ff-76ea-466d-b0c1-ae4be6f693e2
Request to start server 5136c8ff-76ea-466d-b0c1-ae4be6f693e2 has been accepted.
[root@compute instances]# nova list
+--------------------------------------+-----------+---------+-------------+-------------+------------------------+
| ID                                   | Name      | Status  | Task State  | Power State | Networks               |
+--------------------------------------+-----------+---------+-------------+-------------+------------------------+
| c2b5ed8f-0a7c-4bd4-adab-78b096cb0857 | master    | ACTIVE  | -           | Running     | ext-net=192.168.200.6  |
| a372558d-884c-421f-9b32-2dce2e99118e | node      | ACTIVE  | -           | Running     | ext-net=192.168.200.7  |
| 5136c8ff-76ea-466d-b0c1-ae4be6f693e2 | rabbitmq1 | SHUTOFF | powering-on | Shutdown    | ext-net=192.168.200.21 |
| 6901f6ae-31de-4dbf-b37b-673d9526e135 | rabbitmq2 | ACTIVE  | -           | Running     | ext-net=192.168.200.5  |
| 0fe821f7-7184-4378-90d2-0e62a0f03600 | rabbitmq3 | ACTIVE  | -           | Running     | ext-net=192.168.200.3  |
+--------------------------------------+-----------+---------+-------------+-------------+------------------------+
[root@compute instances]# nova list
+--------------------------------------+-----------+--------+------------+-------------+------------------------+
| ID                                   | Name      | Status | Task State | Power State | Networks               |
+--------------------------------------+-----------+--------+------------+-------------+------------------------+
| c2b5ed8f-0a7c-4bd4-adab-78b096cb0857 | master    | ACTIVE | -          | Running     | ext-net=192.168.200.6  |
| a372558d-884c-421f-9b32-2dce2e99118e | node      | ACTIVE | -          | Running     | ext-net=192.168.200.7  |
| 5136c8ff-76ea-466d-b0c1-ae4be6f693e2 | rabbitmq1 | ACTIVE | -          | Running     | ext-net=192.168.200.21 |
| 6901f6ae-31de-4dbf-b37b-673d9526e135 | rabbitmq2 | ACTIVE | -          | Running     | ext-net=192.168.200.5  |
| 0fe821f7-7184-4378-90d2-0e62a0f03600 | rabbitmq3 | ACTIVE | -          | Running     | ext-net=192.168.200.3  |
+--------------------------------------+-----------+--------+------------+-------------+------------------------+
[root@compute instances]# nova show rabbitmq1
+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | AUTO                                                     |
| OS-EXT-AZ:availability_zone          | nova                                                     |
| OS-EXT-SRV-ATTR:host                 | compute                                                  |
| OS-EXT-SRV-ATTR:hostname             | rabbitmq1                                                |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | compute                                                  |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000019                                        |
| OS-EXT-SRV-ATTR:kernel_id            |                                                          |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                        |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                          |
| OS-EXT-SRV-ATTR:reservation_id       | r-9q8w190y                                               |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                 |
| OS-EXT-SRV-ATTR:user_data            | -                                                        |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2020-11-19T00:47:28.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2020-11-19T00:47:19Z                                     |
| description                          | -                                                        |
| ext-net network                      | 192.168.200.21                                           |
| flavor:disk                          | 20                                                       |
| flavor:ephemeral                     | 0                                                        |
| flavor:extra_specs                   | {}                                                       |
| flavor:original_name                 | mysql                                                    |
| flavor:ram                           | 2048                                                     |
| flavor:swap                          | 0                                                        |
| flavor:vcpus                         | 1                                                        |
| hostId                               | 542871f997cea71ff625ae4999c7455f3d96b937926f092633d6e153 |
| host_status                          | UP                                                       |
| id                                   | 5136c8ff-76ea-466d-b0c1-ae4be6f693e2                     |
| image                                | centos7.5 (8b03410b-4f3d-49fa-9acf-c0a1aa20160c)         |
| key_name                             | -                                                        |
| locked                               | False                                                    |
| metadata                             | {}                                                       |
| name                                 | rabbitmq1                                                |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| status                               | ACTIVE                                                   |
| tags                                 | []                                                       |
| tenant_id                            | 03a2483a6b364606b7e0bc3ccc6064b2                         |
| updated                              | 2020-11-19T01:38:36Z                                     |
| user_id                              | f54f627a05984048984fd117c894925e                         |
+--------------------------------------+----------------------------------------------------------+

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
网络协议 Linux 网络安全
openstack 云平台一体化部署(超详细)
openstack 云平台一体化部署(超详细)
1278 0
openstack 云平台一体化部署(超详细)
|
6月前
|
网络安全
openstack 使用ssh远程管理云主机
在阿里云平台上,为云主机分配和配置浮动IP涉及以下步骤:首先,在“网络”部分分配一个公共IP,并将其关联到已创建的云主机。接着,在“浮动IP”页面确认绑定成功。然后,进入安全组,为默认安全组添加允许ping和SSH的新规则。通过控制台ping浮动IP以测试连通性。最后,从宿主机修改云主机的hostname并使用SSH登录。至此,SSH登录设置完成。
176 2
openstack 使用ssh远程管理云主机
|
6月前
|
Linux 数据安全/隐私保护
openstack 上创建云主机
该内容是关于使用OpenStack创建云实例的步骤指南。首先,提供了CentOS 7的镜像源,并建议用户自行封装qcow2格式镜像。接着,展示了通过`cat keystonerc_admin`获取OpenStack的管理员用户名和密码。然后,详细描述了在OpenStack界面中创建网络、子网和路由的过程,以连接到外部网络。最后,指导用户上传qcow2镜像,创建并配置实例,包括选择镜像、实例类型和网络,最终等待实例创建完成。
353 1
openstack 上创建云主机
|
存储
openstack之云主机备份还原
openstack之云主机备份还原
102 0
|
消息中间件 机器学习/深度学习 安全
搭建OpenStack多节点的企业私有云平台——基础基础环境搭建
搭建OpenStack多节点的企业私有云平台——基础基础环境搭建
1031 0
在openstack云平台中,使用命令行创建云主机操作步骤
在openstack云平台中,使用命令行创建云主机操作步骤
572 0
在openstack云平台中,使用命令行创建云主机操作步骤
|
网络安全 对象存储
Openstack迁移DDH
将OpenStack上的虚拟机迁移到专有宿主机DDH,大幅降低成本。
Openstack迁移DDH
|
存储 API 调度
openstack云平台简介
OpenStack是一个由NASA(美国国家航空航天局)和Rackspace合作研发并发起的,以Apache许可证授权的自由软件和开放源代码项目。 OpenStack 是一个开源的云计算管理平台项目,由几个主要的组件组合起来完成具体工作。
2981 0
下一篇
无影云桌面