Atom feed of this document
  

 迁移实例

此章讨论了如何将实例从一台OpenStack计算节点迁移到另外的OpenStack计算节点。

在开始迁移之前,请重新阅读配置迁移一节的内容。

[注意]注意

尽管命令nova调用了live-migration,默认的计算服务配置属性,仍然会在迁移之前将实例休眠。更多信息,请参阅OpenStack 配置参考 配置迁移一节。

 

迁移实例

  1. 检查要迁移的实例ID:

    $ nova list
    +--------------------------------------+------+--------+-----------------+
    |                  ID                  | Name | Status |Networks         |
    +--------------------------------------+------+--------+-----------------+
    | d1df1b5a-70c4-4fed-98b7-423362f2c47c | vm1  | ACTIVE | private=a.b.c.d |
    | d693db9e-a7cf-45ef-a7c9-b3ecb5f22645 | vm2  | ACTIVE | private=e.f.g.h |
    +--------------------------------------+------+--------+-----------------+
  2. 检查实例所关联的信息,在此例中,vm1 运行在HostB上:

    $ nova show d1df1b5a-70c4-4fed-98b7-423362f2c47c
    +-------------------------------------+----------------------------------------------------------+
    |               Property              |                          Value                           |
    +-------------------------------------+----------------------------------------------------------+
    ...
    | OS-EXT-SRV-ATTR:host                | HostB                                                    |
    ...
    | flavor                              | m1.tiny                                                  |
    | id                                  | d1df1b5a-70c4-4fed-98b7-423362f2c47c                     |
    | name                                | vm1                                                      |
    | private network                     | a.b.c.d                                                  |
    | status                              | ACTIVE                                                   |
    ...
    +-------------------------------------+----------------------------------------------------------+
  3. 为实例选择所要迁移到的计算节点。在此例中,我们将会将实例迁移到HostC,因为HostC运行了nova-compute

    # nova service-list
    +------------------+------------+----------+---------+-------+----------------------------+-----------------+
    | Binary           | Host       | Zone     | Status  | State | Updated_at                 | Disabled Reason |
    +------------------+------------+----------+---------+-------+----------------------------+-----------------+
    | nova-consoleauth | HostA      | internal | enabled | up    | 2014-03-25T10:33:25.000000 | -               |
    | nova-scheduler   | HostA      | internal | enabled | up    | 2014-03-25T10:33:25.000000 | -               |
    | nova-conductor   | HostA      | internal | enabled | up    | 2014-03-25T10:33:27.000000 | -               |
    | nova-compute     | HostB      | nova     | enabled | up    | 2014-03-25T10:33:31.000000 | -               |
    | nova-compute     | HostC      | nova     | enabled | up    | 2014-03-25T10:33:31.000000 | -               |
    | nova-cert        | HostA      | internal | enabled | up    | 2014-03-25T10:33:31.000000 | -               |
    +------------------+------------+----------+---------+-------+----------------------------+-----------------+
  4. 检查 HostC 拥有足够的资源来进行迁移:

    # nova host-describe HostC
    +-----------+------------+-----+-----------+---------+
    | HOST      | PROJECT    | cpu | memory_mb | disk_gb |
    +-----------+------------+-----+-----------+---------+
    | HostC     | (total)    | 16   | 32232    | 878     |
    | HostC     | (used_now) | 13   | 21284    | 442     |
    | HostC     | (used_max) | 13   | 21284    | 442     |
    | HostC     | p1         | 13   | 21284    | 442     |
    | HostC     | p2         | 13   | 21284    | 442     |
    +-----------+------------+-----+-----------+---------+
    • cpu: CPU 数量

    • memory_mb: 内存总量,按 MB 算

    • disk_gb: NOVA-INST-DIR/instances 空间的总量,以GB计算

    在此表中,第一行展现的是物理服务器资源的总量。第二行展示的是当前已经使用的资源。第三行显示了最大可以使用的资源。第四行以及下面所显示的是每个项目可用的资源。

  5. 迁移实例使用命令 nova live-migration

    $ nova live-migration SERVER HOST_NAME

    在此例中, SERVER 可以是实例的ID,也可以是实例的名称。另外一个例子:

    $ nova live-migration d1df1b5a-70c4-4fed-98b7-423362f2c47c HostC
    Migration of d1df1b5a-70c4-4fed-98b7-423362f2c47c initiated.
    [警告]警告

    当在Icehouse和Juno的计算节点之间进行在线迁移来平衡负载的话,可能会引发数据丢失,因为libvirt在版本3.32之前对于基于共享块存储的在线迁移是有问题的(丢过数据)。此问题将RPC API更新到4.0后解决了。

  6. 使用nova list来检查实例已经成功的迁移了。如果实例仍然运行在HostB上,检查源主机和目标主机的nova-computenova-scheduler) 日志文件来查找原因。

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page


loading table of contents...