Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

自托管引擎指南

Red Hat Virtualization 4.0

安装和维护 Red Hat Virtualization 自托管引擎

摘要

自托管引擎的综合指南。

第 1 章 简介

自托管引擎是 Red Hat Virtualization Manager 或引擎的虚拟化环境,在该管理器管理的主机上的虚拟机上运行。虚拟机作为主机配置的一部分创建,管理器则并行安装和配置到主机配置过程。自托管引擎的主要优点是,部署 Red Hat Virtualization 实例所需的硬件更少,因为 Manager 作为虚拟机运行,而不是在物理硬件上运行。另外,Manager 被配置为高可用性。如果运行 Manager 虚拟机的主机进入维护模式,或者意外失败,则虚拟机会自动迁移到环境中的另一台主机上。可以运行管理器虚拟机的主机被称为自托管引擎节点。至少需要两个自托管引擎节点来支持高可用性功能。
对于 Manager 虚拟机安装,提供了 RHV-M 虚拟设备。不支持手动安装 Manager 虚拟机。若要自定义 Manager 虚拟机,您可以使用带有设备的自定义 cloud-init 脚本。创建自定义 cloud-init 脚本目前超出了本文档的范围。部署期间可以生成默认 cloud-init 脚本。

表 1.1. 支持的操作系统版本来部署自托管引擎

系统类型
支持的版本
Red Hat Enterprise Linux 主机
7.2 或更高版本
Red Hat Virtualization Host
7.2 或更高版本
HostedEngine-VM (Manager)
7
重要
务必要同步环境中的主机、管理器和其他服务器的系统时钟,以避免潜在的时间或身份验证问题。为此,请在每个系统上配置网络时间协议(NTP),使其与同一 NTP 服务器同步。
下图演示了自托管引擎部署工作流:

第 2 章 部署自托管引擎

2.1. 在 Red Hat Enterprise Linux 主机上部署自托管引擎

2.1.1. 安装自托管引擎软件包

确保主机已注册并订阅了所需的权利。如需更多信息,请参阅安装指南中的订阅所需权利

过程 2.1. 安装自托管引擎

  1. 安装自托管引擎软件包:
    # yum install ovirt-hosted-engine-setup
  2. 为 Manager 虚拟机安装安装 RHV-M 虚拟设备软件包:
    # yum install rhevm-appliance
继续下一部分,以在 Red Hat Enterprise Linux 主机上部署和配置自托管引擎。

2.1.2. 配置基于 RHEL 的自托管引擎

提供了 hosted-engine 脚本,以帮助配置主机和管理器虚拟机。该脚本要求您包含一系列问题,并根据您的答案配置您的环境。
注意
如果使用脚本,请使用 hosted-engine --check-deployed 命令检查自托管引擎是否已部署。只有没有部署自托管引擎时,才会显示错误。如果已经部署了自托管引擎,后续的部署将失败。如果您需要对现有部署进行故障排除,或清理失败的部署,请参阅 第 3 章 对自托管引擎部署进行故障排除 来重新部署自托管引擎。
确保您已完成以下先决条件:

前提条件

  • 您必须有一个新安装的 Red Hat Enterprise Linux 7 系统,已安装了 ovirt-hosted-engine-setup 软件包。
  • 您必须已为自托管引擎环境准备存储。至少需要两个存储域:
    • 专用于 Manager 虚拟机的共享存储域。此域是在自托管引擎部署期间创建的,且必须至少 60 GB。
    • 常规虚拟机数据的数据存储域。此域必须在完成部署后添加到自托管引擎环境中。
      警告
      红帽强烈建议您在与自托管引擎环境相同的数据中心中提供额外的活跃数据存储域。
      如果您在只有一个活动数据存储域的数据中心部署自托管引擎,如果数据存储域损坏,您将无法添加新的数据存储域或删除损坏的数据存储域。您必须重新部署自托管引擎。
      如果您使用 ISO 存储域,红帽建议 ISO 域不在托管引擎虚拟机中。
    有关为您的部署准备存储的更多信息,请参阅管理指南中的存储章节https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/administration-guide/#chap-Storage
    重要
    如果您使用的是 iSCSI 存储,请不要将同样的 iSCSI 目标用于共享存储域和数据存储域。
  • 您必须有针对 Manager 和主机的完全限定域名。正向和反向查找记录必须在 DNS 中设置。
  • 您必须具有用于管理器安装的 RHV-M 虚拟设备。如果您还没有手动安装 rhevm-appliance 软件包,它将被自动下载和安装。
  • 要将 RHV-M 虚拟设备用于管理器安装,一个目录必须至少 5 GB。hosted-engine 脚本首先检查 /var/tmp 是否有足够空间来提取设备文件。如果没有,您可以指定不同的目录或挂载外部存储。VDSM 用户和组必须具有目录的读取、写入和执行权限。

过程 2.2. 配置基于 RHEL 的自托管引擎

  1. 启动托管引擎部署

    运行 hosted-engine 脚本。要随时退出脚本,请使用 CTRL+D 键盘组合来中止部署。建议您使用 screen 窗口管理器运行脚本,以避免在网络或终端中断时丢失会话。如果尚未安装,请安装 screen 软件包,该软件包可在标准 Red Hat Enterprise Linux 存储库中获得。
    # yum install screen
    # screen
    # hosted-engine --deploy
    注意
    如果出现会话超时或连接中断,请运行 screen -d -r 来恢复 hosted-engine 部署会话。
  2. 配置存储

    选择要使用的存储类型。
    During customization use CTRL-D to abort.
    Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs3, nfs4)[nfs3]:
    • 对于 NFS 存储类型,请使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/nfs
    • 对于 iSCSI,指定 iSCSI 门户 IP 地址、端口、用户名和密码,然后从自动检测的列表中选择目标名称。在部署过程中只能选择一个 iSCSI 目标。
      Please specify the iSCSI portal IP address:
      Please specify the iSCSI portal port [3260]:
      Please specify the iSCSI portal user:
      Please specify the iSCSI portal password:
      Please specify the target name (auto-detected values) [default]:
    • 对于 Gluster 存储,使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      重要
      仅支持副本 3 Gluster 存储。确保已进行以下配置:
      • 在所有三个 Gluster 服务器上的 /etc/glusterfs/glusterd.vol 文件中,将 rpc-auth-allow-insecure 设置为 上的
        option rpc-auth-allow-insecure on
      • 配置卷,如下所示:
        gluster volume set volume cluster.quorum-type auto
        gluster volume set volume network.ping-timeout 10
        gluster volume set volume auth.allow \*
        gluster volume set volume group virt
        gluster volume set volume storage.owner-uid 36
        gluster volume set volume storage.owner-gid 36
        gluster volume set volume server.allow-insecure on
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/gluster_volume
    • 对于光纤通道,必须配置并连接主机总线适配器,hosted-engine 脚本将自动探测可用的 LUN。LUN 不得包含任何现有数据。
      The following luns have been found on the requested target:
      [1]     3514f0c5447600351       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
      
      [2]     3514f0c5447600352       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
      
      Please select the destination LUN (1, 2) [1]:
  3. 配置网络

    该脚本检测可能的网络接口控制器(NIC),以用作环境的管理网桥。然后,它会检查您的防火墙配置,并提供以进行修改以实现控制台(SPICE 或 VNC)访问。
    Please indicate a nic to set rhvm bridge on: (eth1, eth0) [eth1]:
    iptables was detected on your computer, do you wish setup to configure it? (Yes, No)[Yes]: Yes
    Please indicate a pingable gateway IP address [X.X.X.X]:
  4. 配置虚拟机

    为引导设备类型选择 磁盘,该脚本将自动检测可用的 RHV-M 虚拟设备。指定内存大小。
             Please specify the device to boot the VM from (choose disk for the oVirt engine appliance)
             (cdrom, disk, pxe) [disk]:
             Please specify the console type you would like to use to connect to the VM (vnc, spice) [vnc]: vnc
    [ INFO ] Detecting available oVirt engine appliances
             The following appliance have been found on your system:
                   [1] - The oVirt Engine Appliance image (OVA)
                   [2] - Directly select an OVA file
             Please select an appliance (1, 2) [1]:
    [ INFO ] Checking OVF archive content (could take a few minutes depending on archive size)
    如果您希望 cloud-init 处理 Manager 虚拟机的初始配置,请指定 Yes。指定 Generate for cloud-init 以处理诸如设置 root 密码、配置网络、配置主机名、注入 engine-setup 要使用的回答文件,以及在引导时运行 engine-setup 等任务。(可选)如果您有一个现有的 cloud-init 脚本可以处理 cloud-init 的更复杂的功能,请选择 Existing。指定 Manager 虚拟机的 FQDN。指定 HostedEngine-VM 的 MAC 地址或接受随机生成的地址。在虚拟机上安装操作系统之前,可以使用 MAC 地址来更新 DHCP 和 DNS 服务器。
    注意
    有关 cloud-init 的更多信息,请参阅 https://cloudinit.readthedocs.org/en/latest/
    Would you like to use cloud-init to customize the appliance on the first boot (Yes, No)[Yes]? Yes
    Would you like to generate on-fly a cloud-init ISO image (of no-cloud type)
    or do you have an existing one (Generate, Existing)[Generate]? Generate
    Please provide the FQDN you would like to use for the engine appliance.
    Note: This will be the FQDN of the engine VM you are now going to launch.
    It should not point to the base host or to any other existing machine.
    Engine VM FQDN: (leave it empty to skip): manager.example.com
    Automatically execute engine-setup on the engine appliance on first boot (Yes, No)[Yes]? Yes
    Automatically restart the engine VM as a monitored service after engine-setup (Yes, No)[Yes]? Yes
    Enter root password that will be used for the engine appliance (leave it empty to skip): p@ssw0rd
    Confirm appliance root password: p@ssw0rd
    The following CPU types are supported by this host:
        - model_Penryn: Intel Penryn Family
        - model_Conroe: Intel Conroe Family
    Please specify the CPU type to be used by the VM [model_Penryn]:
    Please specify the number of virtual CPUs for the VM [Defaults to appliance OVF value: 4]:
    You may specify a MAC address for the VM or accept a randomly generated default [00:16:3e:77:b2:a4]:
    How should the engine VM network be configured (DHCP, Static)[DHCP]? Static
    Please enter the IP address to be used for the engine VM: 192.168.x.x
    Please provide a comma-separated list (max3) of IP addresses of domain name servers for the engine VM
    Engine VM DNS (leave it empty to skip):
    Add lines for the appliance itself and for this host to /etc/hosts on the engine VM?
    Note: ensuring that this host could resolve the engine VM hostname is still up to you (Yes, No)[No] Yes
  5. 配置托管引擎

    在管理门户中指定要标识的主机的名称,以及 admin@internal 用户的密码来访问管理门户。提供 SMTP 服务器的名称和 TCP 端口号、用于发送电子邮件通知的电子邮件地址,以及用于接收这些通知的电子邮件地址列表。
    Enter engine admin password: p@ssw0rd
    Confirm engine admin password: p@ssw0rd
    Enter the name which will be used to identify this host inside the Administrator Portal [hosted_engine_1]:
    Please provide the FQDN for the engine you would like to use.
              This needs to match the FQDN that you will use for the engine installation within the VM.
              Note: This will be the FQDN of the VM you are now going to create,
              it should not point to the base host or to any other existing machine.
              Engine FQDN:  []: manager.example.com
    Please provide the name of the SMTP server through which we will send notifications [localhost]:
    Please provide the TCP port number of the SMTP server [25]:
    Please provide the email address from which notifications will be sent [root@localhost]:
    Please provide a comma-separated list of email addresses which will get notifications [root@localhost]:
  6. 配置预览

    在继续之前,hosted-engine 脚本会显示您输入的配置值,并提示您确认以继续使用这些值。
  7. 创建 Manager 虚拟机

    该脚本将创建 Manager 虚拟机,启动 ovirt-engine 和高可用性服务,并将主机和共享存储域连接到 Manager 虚拟机。
    You can now connect to the VM with the following command:
    	/usr/bin/remote-viewer vnc://localhost:5900
    Use temporary password "3042QHpX" to connect to vnc console.
    Please note that in order to use remote-viewer you need to be able to run graphical applications.
    This means that if you are using ssh you have to supply the -Y flag (enables trusted X11 forwarding).
    Otherwise you can run the command from a terminal in your preferred desktop environment.
    If you cannot run graphical applications you can connect to the graphic console from another host or connect to the serial console using the following command:
    socat UNIX-CONNECT:/var/run/ovirt-vmconsole-console/fabbea5a-1989-411f-8ed7-7abe0917fc66.sock,user=ovirt-vmconsole STDIO,raw,echo=0,escape=1
    
    If you need to reboot the VM you will need to start it manually using the command:
    hosted-engine --vm-start
    You can then set a temporary password using the command:
    hosted-engine --add-console-password
    [ INFO ] Running engine-setup on the appliance
    ...
    [ INFO ] Engine-setup successfully completed
    [ INFO ] Engine is still unreachable
    [ INFO ] Engine is still unreachable, waiting...
    [ INFO ] Engine replied: DB Up!Welcome to Health Status!
    [ INFO ] Connecting to the Engine
             Enter the name of the cluster to which you want to add the host (Default) [Default]:
    [ INFO  ] Waiting for the host to become operational in the engine. This may take several minutes... [ INFO  ] Still waiting for VDSM host to become operational...
    [ INFO  ] The VDSM Host is now operational
    [ INFO  ] Shutting down the engine VM
    [ INFO  ] Enabling and starting HA services
    [ INFO  ] Saving hosted-engine configuration on the shared storage domain
              Hosted Engine successfully set up
    [ INFO  ] Stage: Clean up
    [ INFO  ] Generating answer file '/var/lib/ovirt-hosted-engine-setup/answers/answers-2015xx.conf'
    [ INFO  ] Generating answer file '/etc/ovirt-hosted-engine/answers.conf'
    [ INFO  ] Stage: Pre-termination
    [ INFO  ] Stage: Termination
    hosted-engine 部署脚本成功完成时,Red Hat Virtualization Manager 已配置并在您的主机上运行。Manager 已配置了数据中心、集群、主机、管理器虚拟机和专用于 Manager 虚拟机的共享存储域。
    重要
    admin@internal 用户身份登录,以继续配置管理器并添加其他资源。您必须为数据中心创建另一个数据域,以托管常规虚拟机数据,以及管理器虚拟机可见。如需了解不同存储选项以及如何添加数据存储域,请参阅管理指南中的 存储。https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/administration-guide/#chap-Storage
    将 Red Hat Virtualization Manager 链接到目录服务器,以便您可以向环境中添加额外的用户。Red Hat Virtualization 支持许多目录服务器类型;例如,红帽目录服务器(RHDS)、红帽身份管理(IdM)、Active Directory 和许多其他类型。使用 ovirt-engine-extension-aaa-ldap-setup 交互式设置脚本,在您的环境中添加目录服务器。如需更多信息,请参阅管理指南中的配置外部 LDAP 提供程序
    ovirt-hosted-engine-setup 脚本还会将您在配置期间提供的答案保存到文件,以帮助进行灾难恢复。如果没有使用 --generate-answer=<file> 参数指定 目的地,则会在 /etc/ovirt-hosted-engine/answers.conf 中生成回答文件。
    注意
    RHV-M 虚拟设备上不默认启用 SSH 密码身份验证。您可以通过 SPICE 或 VNC 控制台访问 Red Hat Virtualization Manager 虚拟机来启用 SSH 密码身份验证。验证 sshd 服务是否正在运行。编辑 /etc/ssh/sshd_config,并将以下两个选项改为 yes
    • PasswordAuthentication
    • PermitRootLogin
    重启 sshd 服务以使更改生效。
  8. 订阅所需权利

    为 Manager 虚拟机订阅所需的权利。 如需更多信息,请参阅安装指南中的订阅所需权利

2.2. 在 Red Hat Virtualization 主机上部署自托管引擎

在 Red Hat Virtualization Host (RHVH)上,自托管引擎部署通过 Cockpit 用户界面执行。hosted-engine 脚本的 UI 版本有助于配置主机和管理器虚拟机。该脚本要求您包含一系列问题,并根据您的答案配置您的环境。

前提条件

  • 您必须已安装 Red Hat Virtualization Host 系统。Cockpit 用户界面 的系统 子选项卡中的性能配置集必须设置为 virtual-host
  • 您必须已为自托管引擎环境准备存储。至少需要两个存储域:
    • 专用于 Manager 虚拟机的共享存储域。此域是在自托管引擎部署期间创建的,且必须至少 60 GB。
    • 常规虚拟机数据的数据存储域。此域必须在完成部署后添加到自托管引擎环境中。
      警告
      红帽强烈建议您在与自托管引擎环境相同的数据中心中提供额外的活跃数据存储域。
      如果您在只有一个活动数据存储域的数据中心部署自托管引擎,如果数据存储域损坏,您将无法添加新的数据存储域或删除损坏的数据存储域。您必须重新部署自托管引擎。
      如果您使用 ISO 存储域,红帽建议 ISO 域不在托管引擎虚拟机中。
    有关为您的部署准备存储的更多信息,请参阅管理指南中的存储章节https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/administration-guide/#chap-Storage
    重要
    如果您使用的是 iSCSI 存储,请不要将同样的 iSCSI 目标用于共享存储域和数据存储域。
  • 您必须有针对 Manager 和主机的完全限定域名。正向和反向查找记录必须在 DNS 中设置。
  • 要将 RHV-M 虚拟设备用于管理器安装,一个目录必须至少 5 GB。hosted-engine 脚本首先检查 /var/tmp 是否有足够空间来提取设备文件。如果没有,您可以指定不同的目录或挂载外部存储。VDSM 用户和组必须具有目录的读取、写入和执行权限。

过程 2.3. 配置基于 RHVH 的自托管引擎

  1. 获取 RHV-M 虚拟设备

    从客户门户网站下载 RHV-M 虚拟设备:
    1. 登录位于 的客户门户网站 https://access.redhat.com
    2. 点菜单栏中的 Downloads
    3. Red Hat Virtualization > Download Latest 访问产品下载页面。
    4. 为正确的 Red Hat Virtualization 版本选择设备,然后单击 Download Now
    保护将 OVA 文件复制到 Red Hat Virtualization 主机:
    scp rhvm-appliance.ova root@host.example.com:/usr/share
  2. 启动自托管引擎部署

    登录到位于 https://HostIPorFQDN:9090 的 Cockpit 用户界面,并导航到 Virtualization > Hosted Engine。单击 Start
    部署脚本中的文本字段会在有可用的情况下预先填充默认答案;根据需要更改或输入您的答案。
    注意
    在此过程中,部署问题以文本形式显示。在 UI 中,在提示时点 Next
    During customization use CTRL-D to abort.
    Continuing will configure this host for serving as hypervisor and create a VM where you have to install the engine afterwards.
    Are you sure you want to continue? (Yes, No)[Yes]:
  3. 配置存储

    选择要使用的存储类型。
    Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs3, nfs4)[nfs3]:
    • 对于 NFS 存储类型,请使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/nfs
    • 对于 iSCSI,指定 iSCSI 门户 IP 地址、端口、用户名和密码,然后从自动检测的列表中选择目标名称。在部署过程中只能选择一个 iSCSI 目标。
      Please specify the iSCSI portal IP address:
      Please specify the iSCSI portal port [3260]:
      Please specify the iSCSI portal user:
      Please specify the iSCSI portal password:
      Please specify the target name (auto-detected values) [default]:
    • 对于 Gluster 存储,使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      重要
      仅支持副本 3 Gluster 存储。确保已进行以下配置:
      • 在所有三个 Gluster 服务器上的 /etc/glusterfs/glusterd.vol 文件中,将 rpc-auth-allow-insecure 设置为 上的
        option rpc-auth-allow-insecure on
      • 配置卷,如下所示:
        gluster volume set volume cluster.quorum-type auto
        gluster volume set volume network.ping-timeout 10
        gluster volume set volume auth.allow \*
        gluster volume set volume group virt
        gluster volume set volume storage.owner-uid 36
        gluster volume set volume storage.owner-gid 36
        gluster volume set volume server.allow-insecure on
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/gluster_volume
    • 对于光纤通道,必须配置并连接主机总线适配器,hosted-engine 脚本将自动探测可用的 LUN。LUN 不得包含任何现有数据。
      The following luns have been found on the requested target:
      [1]     3514f0c5447600351       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
                
      [2]     3514f0c5447600352       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
      
      Please select the destination LUN (1, 2) [1]:
  4. 配置网络

    该脚本检查您的防火墙配置,并提供修改控制台(SPICE 或 VNC)访问。然后,它会检测可能的网络接口控制器(NIC),以用作环境的管理网桥。
    iptables was detected on your computer, do you wish setup to configure it? (Yes, No)[Yes]: Yes
    Please indicate a pingable gateway IP address [X.X.X.X]:
    Please indicate a nic to set ovirtmgmt bridge on: (eth1, eth0) [eth1]:
  5. 配置虚拟机

    为引导设备类型选择 磁盘,然后指定到 RHV-M 虚拟设备的路径。如果 /var/tmp 目录没有足够的空间,请指定不同的目录。VDSM 用户和组必须具有目录的读取、写入和执行权限。
    Please specify the device to boot the VM from (choose disk for the oVirt engine appliance) (cdrom, disk, pxe) [disk]: disk
    Please specify the console type you would like to use to connect to the VM (vnc, spice) [vnc]: vnc
    Using an oVirt engine appliance could greatly speed-up ovirt hosted-engine deploy.
    You could get oVirt engine appliance installing ovirt-engine-appliance rpm.
    Please specify path to OVF archive you would like to use [None]: /path/to/rhvm-appliance.ova
    如果您希望 cloud-init 处理 Manager 虚拟机的初始配置,请指定 Yes。指定 Generate for cloud-init 以处理诸如设置 root 密码、配置网络、配置主机名、注入 engine-setup 要使用的回答文件,以及在引导时运行 engine-setup 等任务。(可选)如果您有一个现有的 cloud-init 脚本可以处理 cloud-init 的更复杂的功能,请选择 Existing
    注意
    有关 cloud-init 的更多信息,请参阅 https://cloudinit.readthedocs.org/en/latest/
    Would you like to use cloud-init to customize the appliance on the first boot (Yes, No)[Yes]? Yes
    Would you like to generate on-fly a cloud-init ISO image (of no-cloud type) or do you have an existing one (Generate, Existing)[Generate]? Generate
    Please provide the FQDN you would like to use for the engine appliance.
    Note: This will be the FQDN of the engine VM you are now going to launch.
    It should not point to the base host or to any other existing machine.
    Engine VM FQDN: (leave it empty to skip): manager.example.com
    Automatically execute engine-setup on the engine appliance on first boot (Yes, No)[Yes]? Yes
    Automatically restart the engine VM as a monitored service after engine-setup (Yes, No)[Yes]? Yes
    Please provide the domain name you would like to use for the engine appliance.
    Engine VM domain: [localdomain] example.com
    Enter root password that will be used for the engine appliance (leave it empty to skip): p@ssw0rd
    Confirm appliance root password: p@ssw0rd
    The following CPU types are supported by this host:
        - model_SandyBridge: Intel SandyBridge Family
        - model_Westmere: Intel Westmere Family
        - model_Nehalem: Intel Nehalem Family
        - model_Penryn: Intel Penryn Family
        - model_Conroe: Intel Conroe Family
    Please specify the CPU type to be used by the VM [model_SandyBridge]:
    Please specify the number of virtual CPUs for the VM [Defaults to appliance OVF value: [2]:
    You may specify a unicast MAC address for the VM or accept a randomly generated default [00:16:3e:77:b2:a4]:
    Please specify the memory size of the VM in MB (Defaults to maximum available): [12722]:
    How should the engine VM network be configured (DHCP, Static)[DHCP]? Static
    Please enter the IP address to be used for the engine VM: 192.168.x.x
    Please provide a comma-separated list (max 3) of IP addresses of domain name servers for the engine VM
    Engine VM DNS (leave it empty to skip):
    指定 Yes/etc/hosts 文件从主机复制到 Manager 虚拟机,以进行主机名解析。
    Add lines for the appliance itself and for this host to /etc/hosts on the engine VM?
    Note: ensuring that this host could resolve the engine VM hostname is still up to you (Yes, No)[No] Yes
  6. 配置自托管引擎

    在管理门户中指定要标识的主机的名称,以及 admin@internal 用户的密码来访问管理门户。提供 SMTP 服务器的名称和 TCP 端口号、用于发送电子邮件通知的电子邮件地址,以及用于接收这些通知的电子邮件地址列表。
    Enter engine admin password: p@ssw0rd
    Confirm engine admin password: p@ssw0rd
    Enter the name which will be used to identify this host inside the Administrator Portal [hosted_engine_1]:
    Please provide the name of the SMTP server through which we will send notifications [localhost]:
    Please provide the TCP port number of the SMTP server [25]:
    Please provide the email address from which notifications will be sent [root@localhost]:
    Please provide a comma-separated list of email addresses which will get notifications [root@localhost]:
  7. 配置预览

    在继续之前,hosted-engine 脚本会显示您输入的配置值,并提示您确认以继续使用这些值。
    Please confirm installation settings (Yes, No)[Yes]: Yes
    该脚本将创建 Manager 虚拟机,启动 ovirt-engine 和高可用性服务,并将主机和共享存储域连接到 Manager 虚拟机。
    hosted-engine 部署脚本成功完成时,Red Hat Virtualization Manager 已配置并在您的主机上运行。Manager 已配置了数据中心、集群、主机、管理器虚拟机和专用于 Manager 虚拟机的共享存储域。
    重要
    admin@internal 用户身份登录管理门户,以继续配置管理器并添加其他资源。您必须为数据中心创建另一个数据域,以托管常规虚拟机数据,以及管理器虚拟机可见。如需了解不同存储选项以及如何添加数据存储域,请参阅管理指南中的 存储。https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/administration-guide/#chap-Storage
    将 Red Hat Virtualization Manager 链接到目录服务器,以便您可以向环境中添加额外的用户。Red Hat Virtualization 支持许多目录服务器类型;例如,红帽目录服务器(RHDS)、红帽身份管理(IdM)、Active Directory 和许多其他类型。使用 ovirt-engine-extension-aaa-ldap-setup 交互式设置脚本,在您的环境中添加目录服务器。如需更多信息,请参阅管理指南中的配置外部 LDAP 提供程序
    该脚本还会将您在配置期间提供的答案保存到文件,以帮助进行灾难恢复。如果没有使用 --generate-answer=<file> 参数指定 目的地,则会在 /etc/ovirt-hosted-engine/answers.conf 中生成回答文件。
    注意
    RHV-M 虚拟设备上不默认启用 SSH 密码身份验证。您可以通过 SPICE 或 VNC 控制台访问 Red Hat Virtualization Manager 虚拟机来启用 SSH 密码身份验证。验证 sshd 服务是否正在运行。编辑 /etc/ssh/sshd_config,并将以下两个选项改为 yes
    • PasswordAuthentication
    • PermitRootLogin
    重启 sshd 服务以使更改生效。
  8. 订阅所需权利

    为 Manager 虚拟机订阅所需的权利。 如需更多信息,请参阅安装指南中的订阅所需权利

2.3. 管理 Manager 虚拟机

提供了 hosted-engine 实用程序,以帮助管理管理器虚拟机。它可以在环境中的任何自托管引擎节点上运行。对于所有选项,请运行 hosted-engine --help。如需有关特定命令的更多信息,请运行 hosted-engine --命令 --help
如需更多信息,请参阅 第 3.1 节 “Manager 虚拟机故障排除”

第 3 章 对自托管引擎部署进行故障排除

要确认自托管引擎是否已部署运行 hosted-engine --check-deployed。只有尚未部署自托管引擎,才会显示错误。

3.1. Manager 虚拟机故障排除

过程 3.1. Manager 虚拟机故障排除

  1. 运行 hosted-engine --vm-status 来检查 Manager 虚拟机的状态。
    注意
    对 Manager 虚拟机所做的任何更改都将花费大约 20 秒时间才能反映到 status 命令输出中。
    如果 Manager 虚拟机已启动并正常运行,您会看到以下输出:
    --== Host 1 status ==--
    
    Status up-to-date              : True
    Hostname                       : hypervisor.example.com
    Host ID                        : 1
    Engine status                  : {"health": "good", "vm": "up", "detail": "up"}
    Score                          : 3400
    stopped                        : False
    Local maintenance              : False
    crc32                          : 99e57eba
    Host timestamp                 : 248542
  2. 如果 健康状况 不良或 vm 停机,请启用全局维护模式,以便主机不再由 HA 服务管理。
    • 在管理门户中,右键单击 Manager 虚拟机,然后选择 Enable Global HA Maintenance
    • 您还可以从命令行设置维护模式:
      # hosted-engine --set-maintenance --mode=global
  3. 如果 Manager 虚拟机停机,请启动 Manager 虚拟机。如果虚拟机已启动,请跳过这一步。
    # hosted-engine ---vm-start
  4. 设置控制台密码:
    # hosted-engine --add-console-password
  5. 连接到控制台。出现提示时,输入上一步中设置的密码。如需了解更多控制台选项,请参阅 https://access.redhat.com/solutions/2221461
    # hosted-engine --console
  6. 确定为什么 Manager 虚拟机停机或处于错误健康状态。检查 /var/log/messages/var/log/ovirt-engine/engine.log。修复问题后,重启 Manager 虚拟机。
  7. 以 root 用户身份登录 Manager 虚拟机,验证 ovirt-engine 服务是否正在运行:
    # systemctl status ovirt-engine.service
  8. 确保 Manager 虚拟机启动并运行后,关闭控制台会话并禁用维护模式以再次启用 HA 服务:
    # hosted-engine --set-maintenance --mode=none

其他故障排除命令:

重要
如果您认为需要运行任何这些命令对自托管引擎环境进行故障排除,请联系红帽支持团队。
  • hosted-engine --reinitialize-lockspace :当 sanlock 锁定空间损坏时使用此命令。确保已启用全局维护模式,并在重新初始化 sanlock 锁定空间前停止 Manager 虚拟机。
  • hosted-engine --clean-metadata :从全局状态数据库中删除主机的代理元数据。这可以使得所有其他主机忘记这个主机。确保目标主机已停机,并且启用了全局维护模式。
  • hosted-engine --check-liveliness :该命令检查 ovirt-engine 服务的 livelines 页面。您还可以在 Web 浏览器中连接到 https://engine-fqdn/ovirt-engine/services/health/ 来检查。
  • hosted-engine --connect-storage :该命令指示 VDSM 准备主机和管理器虚拟机所需的所有存储连接。这通常在自托管引擎部署期间在后端运行。如果您需要运行此命令来排除存储问题,请确保已启用全局维护模式。

3.2. 清理失败的自托管引擎部署

如果自托管引擎部署中断,后续的部署将失败,并显示以下错误:
Failed to connect to broker, the number of errors has exceeded the limit.
有关如何清理失败的部署的更多信息,请参阅 https://access.redhat.com/solutions/2121581

第 4 章 从裸机迁移到基于 RHEL 的自托管环境

4.1. 迁移到自托管环境

要将标准 Red Hat Virtualization 的现有实例迁移到自托管引擎环境,请使用 hosted-engine 脚本协助任务。该脚本要求您包含一系列问题,并根据您的答案配置您的环境。在以下情况下,标准 Red Hat Virtualization 环境中的 Manager 被称为 BareMetal-Manager。
RHV-M 虚拟设备通过减少所需的用户与管理器虚拟机交互来缩短进程。但是,虽然设备可以在标准安装中自动执行 engine-setup,但在迁移过程 engine-setup 中必须手动运行,以便您可以事先在新管理器虚拟机上恢复 BareMetal-Manager 备份文件。
迁移涉及以下关键操作:
  • 运行 hosted-engine 脚本,将主机配置为用作自托管引擎节点,并创建新的 Red Hat Virtualization 虚拟机。
  • 使用 engine-backup 工具备份引擎数据库和配置文件,将备份复制到新的 Manager 虚拟机,并使用 engine-backup--mode=restore 参数恢复备份。运行 engine-setup 以完成 Manager 虚拟机配置。
  • 按照 hosted-engine 脚本完成设置。

前提条件

  • 准备安装 ovirt-hosted-engine-setup 软件包的新主机。有关订阅和软件包安装的详情,请查看 第 2.1 节 “在 Red Hat Enterprise Linux 主机上部署自托管引擎”。主机必须是当前 Red Hat Virtualization 环境的支持版本。
    注意
    如果要使用现有主机,请将主机置于维护模式,并将其从现有环境中删除。如需更多信息,请参阅管理指南中的 删除主机
  • 为您的自托管引擎环境准备存储。自托管引擎需要一个专用于管理器虚拟机的共享存储域。此域是在部署过程中创建的,且必须至少为 60 GB。有关为您的部署准备存储的更多信息,请参阅管理指南中的存储章节https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/administration-guide/#chap-Storage
    重要
    如果您使用的是 iSCSI 存储,请不要将同样的 iSCSI 目标用于共享存储域和数据存储域。
  • 通过安装 rhevm-appliance 软件包来获取 RHV-M 虚拟设备。RHV-M 虚拟设备始终基于最新支持的管理器版本。确保当前环境中的 Manager 版本更新至最新支持的 Y-stream 版本,因为 Manager 版本需要与迁移相同。
  • 要将 RHV-M 虚拟设备用于管理器安装,请确保一个目录至少为 5 GB。hosted-engine 脚本首先检查 /var/tmp 是否有足够空间来提取设备文件。如果没有,您可以指定不同的目录或挂载外部存储。VDSM 用户和组必须具有目录的读取、写入和执行权限。
  • 新管理器的完全限定域名必须与 BareMetal-Manager 的完全限定域名相同。正向和反向查找记录必须在 DNS 中设置。
  • 您必须有权访问,并可以更改 BareMetal-Manager。
  • 迁移 BareMetal-Manager 的虚拟机必须具有与要迁移 BareMetal-Manager 的物理机相同的 RAM。如果必须迁移到比迁移 BareMetal-Manager 的物理机更少的 RAM 的虚拟机,请参阅以下红帽知识库文章: https://access.redhat.com/articles/2705841

过程 4.1. 迁移到自托管环境

  1. 启动自托管引擎部署

    注意
    如果您要从版本 3.5 或更早版本更新,您必须运行命令 hosted-engine --deploy --config-append=/etc/ovirt-hosted-engine/answers.conf。文件 answers.conf 必须包含参数 OVE HOSTED_NETWORK/bridgeName=str: running。从 3.5 升级到 3.6 或更高版本会导致默认的管理网络无法正常运行,除非设置了此参数。
    运行 hosted-engine 脚本。要随时退出脚本,请使用 CTRL+D 键盘组合来中止部署。建议您使用 screen 窗口管理器运行脚本,以避免在网络或终端中断时丢失会话。如果尚未安装,请安装 screen 软件包,该软件包可在标准 Red Hat Enterprise Linux 存储库中获得。
    # yum install screen
    # screen
    # hosted-engine --deploy
    注意
    如果出现会话超时或连接中断,请运行 screen -d -r 来恢复 hosted-engine 部署会话。
  2. 配置存储

    选择要使用的存储类型。
    During customization use CTRL-D to abort.
    Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs3, nfs4)[nfs3]:
    • 对于 NFS 存储类型,请使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/nfs
    • 对于 iSCSI,指定 iSCSI 门户 IP 地址、端口、用户名和密码,然后从自动检测的列表中选择目标名称。在部署过程中只能选择一个 iSCSI 目标。
      Please specify the iSCSI portal IP address:           
      Please specify the iSCSI portal port [3260]:           
      Please specify the iSCSI portal user:           
      Please specify the iSCSI portal password:
      Please specify the target name (auto-detected values) [default]:
    • 对于 Gluster 存储,使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      重要
      仅支持副本 3 Gluster 存储。确保已进行以下配置:
      • 在所有三个 Gluster 服务器上的 /etc/glusterfs/glusterd.vol 文件中,将 rpc-auth-allow-insecure 设置为 上的
        option rpc-auth-allow-insecure on
      • 配置卷,如下所示:
        gluster volume set volume cluster.quorum-type auto
        gluster volume set volume network.ping-timeout 10
        gluster volume set volume auth.allow \*
        gluster volume set volume group virt
        gluster volume set volume storage.owner-uid 36
        gluster volume set volume storage.owner-gid 36
        gluster volume set volume server.allow-insecure on
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/gluster_volume
    • 对于光纤通道,必须配置并连接主机总线适配器,hosted-engine 脚本将自动探测可用的 LUN。LUN 不得包含任何现有数据。
      The following luns have been found on the requested target:
      [1]     3514f0c5447600351       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
                
      [2]     3514f0c5447600352       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
      
      Please select the destination LUN (1, 2) [1]:
  3. 配置网络

    该脚本检测可能的网络接口控制器(NIC),以用作环境的管理网桥。然后,它会检查您的防火墙配置,并将其修改为控制台(SPICE 或 VNC)访问 HostedEngine-VM。提供可 ping 网关 IP 地址,供 ovirt-ha-agent 使用,以帮助确定主机是否适合运行 HostedEngine-VM。
    Please indicate a nic to set rhvm bridge on: (eth1, eth0) [eth1]:
    iptables was detected on your computer, do you wish setup to configure it? (Yes, No)[Yes]: 
    Please indicate a pingable gateway IP address [X.X.X.X]:
  4. 配置虚拟机

    该脚本创建一个虚拟机,配置为 Red Hat Virtualization Manager,在此过程中称为 HostedEngine-VM。为引导设备类型选择 磁盘,该脚本将自动检测可用的 RHV-M 设备。选择设备。
             Please specify the device to boot the VM from (choose disk for the oVirt engine appliance) 
             (cdrom, disk, pxe) [disk]: 
             Please specify the console type you would like to use to connect to the VM (vnc, spice) [vnc]: vnc
    [ INFO ] Detecting available oVirt engine appliances
             The following appliance have been found on your system:
                   [1] - The oVirt Engine Appliance image (OVA)
                   [2] - Directly select an OVA file
             Please select an appliance (1, 2) [1]:
    [ INFO ] Checking OVF archive content (could take a few minutes depending on archive size)
    如果您希望 cloud-init 处理 Manager 虚拟机的初始配置,请指定 Yes。为 cloud-init 指定 Generate 以处理诸如设置 root 密码、配置网络和配置主机名等任务。(可选)如果您有一个现有的 cloud-init 脚本可以处理 cloud-init 的更复杂的功能,请选择 Existing。指定 Manager 虚拟机的 FQDN。这必须是为 BareMetal-Manager 提供的 FQDN。
    注意
    有关 cloud-init 的更多信息,请参阅 https://cloudinit.readthedocs.org/en/latest/
    Would you like to use cloud-init to customize the appliance on the first boot (Yes, No)[Yes]? Yes
    Would you like to generate on-fly a cloud-init no-cloud ISO image or do you have an existing one(Generate, Existing)[Generate]? Generate
    Please provide the FQDN you would like to use for the engine appliance.
    Note: This will be the FQDN of the engine VM you are now going to launch.
    It should not point to the base host or to any other existing machine.
    Engine VM FQDN: (leave it empty to skip): manager.example.com
    您必须回答 No,以便您可以在 HostedEngine-VM 上恢复 BareMetal-Manager 备份文件,然后才能运行 engine-setup
    Automatically execute engine-setup on the engine appliance on first boot (Yes, No)[Yes]? No
    配置 Manager 域名、root 密码、网络、硬件和控制台访问详情。
    Enter root password that will be used for the engine appliance (leave it empty to skip): p@ssw0rd
    Confirm appliance root password: p@ssw0rd
    The following CPU types are supported by this host:
        - model_Penryn: Intel Penryn Family
        - model_Conroe: Intel Conroe Family
    Please specify the CPU type to be used by the VM [model_Penryn]: 
    Please specify the number of virtual CPUs for the VM [Defaults to appliance OVF value: 4]: 
    You may specify a MAC address for the VM or accept a randomly generated default [00:16:3e:77:b2:a4]: 
    How should the engine VM network be configured (DHCP, Static)[DHCP]? Static
    Please enter the IP address to be used for the engine VM: 192.168.x.x
    Please provide a comma-separated list (max3) of IP addresses of domain name servers for the engine VM
    Engine VM DNS (leave it empty to skip):
    Add lines for the appliance itself and for this host to /etc/hosts on the engine VM?
    Note: ensuring that this host could resolve the engine VM hostname is still up to you (Yes, No)[No] Yes
  5. 配置自托管引擎

    指定要在 Red Hat Virtualization 环境中标识的 Host-HE1 的名称,以及 admin@internal 用户的密码来访问管理门户。最后,提供 SMTP 服务器的名称和 TCP 端口号、用于发送电子邮件通知的电子邮件地址,以及用于接收这些通知的电子邮件地址列表。
    Enter engine admin password: p@ssw0rd
    Confirm engine admin password: p@ssw0rd
    Enter the name which will be used to identify this host inside the Administrator Portal [hosted_engine_1]:
    Please provide the FQDN for the engine you would like to use.
              This needs to match the FQDN that you will use for the engine installation within the VM.
              Note: This will be the FQDN of the VM you are now going to create,
              it should not point to the base host or to any other existing machine.
              Engine FQDN:  []: manager.example.com
    Please provide the name of the SMTP server through which we will send notifications [localhost]: 
    Please provide the TCP port number of the SMTP server [25]: 
    Please provide the email address from which notifications will be sent [root@localhost]: 
    Please provide a comma-separated list of email addresses which will get notifications [root@localhost]:
  6. 配置预览

    在继续之前,hosted-engine 脚本会显示您输入的配置值,并提示您确认以继续使用这些值。
    Bridge interface                 : eth1
    Engine FQDN                      : manager.example.com
    Bridge name                      : ovirtmgmt
    Host address                     : host.example.com
    SSH daemon port                  : 22
    Firewall manager                 : iptables
    Gateway address                  : X.X.X.X
    Host name for web application    : Host-HE1
    Host ID                          : 1
    Image size GB                    : 50
    Storage connection               : storage.example.com:/hosted_engine/nfs
    Console type                     : vnc
    Memory size MB                   : 4096
    MAC address                      : 00:16:3e:77:b2:a4
    Boot type                        : pxe
    Number of CPUs                   : 2
    CPU Type                         : model_Penryn
    
    Please confirm installation settings (Yes, No)[Yes]:
  7. Creating HostedEngine-VM

    该脚本创建虚拟机,以配置为 HostedEngine-VM 并提供连接详情。在 HostedEngine-VM 上恢复备份文件后,您必须手动运行 engine-setup,然后才能在 Host-HE1 上进行 hosted-engine 脚本。
    [ INFO  ] Stage: Transaction setup
    ...
    [ INFO  ] Creating VM
              You can now connect to the VM with the following command:
                      /bin/remote-viewer vnc://localhost:5900
              Use temporary password "3463VnKn" to connect to vnc console.
              Please note that in order to use remote-viewer you need to be able to run graphical applications.
              This means that if you are using ssh you have to supply the -Y flag (enables trusted X11 forwarding).
              Otherwise you can run the command from a terminal in your preferred desktop environment.
              If you cannot run graphical applications you can connect to the graphic console from another host or connect to the serial console using the following command:
              socat UNIX-CONNECT:/var/run/ovirt-vmconsole-console/8f74b589-8c6f-4a32-9adf-6e615b69de07.sock,user=ovirt-vmconsole STDIO,raw,echo=0,escape=1
              Please ensure that your Guest OS is properly configured to support serial console according to your distro documentation.
              Follow http://www.ovirt.org/Serial_Console_Setup#I_need_to_access_the_console_the_old_way for more info.
              If you need to reboot the VM you will need to start it manually using the command:
              hosted-engine --vm-start
              You can then set a temporary password using the command:
              hosted-engine --add-console-password
              Please install and setup the engine in the VM.
              You may also be interested in subscribing to "agent" RHN/Satellite channel and installing rhevm-guest-agent-common package in the VM.
            
            
              The VM has been rebooted.
              To continue please install oVirt-Engine in the VM
              (Follow http://www.ovirt.org/Quick_Start_Guide for more info).
            
              Make a selection from the options below:
              (1) Continue setup - oVirt-Engine installation is ready and ovirt-engine service is up
              (2) Abort setup
              (3) Power off and restart the VM
              (4) Destroy VM and abort setup
            
              (1, 2, 3, 4)[1]:
    使用以下命令,使用 VNC 协议连接到虚拟机。使用自托管引擎节点的完全限定域名或 IP 地址替换 FQDN。
    # /bin/remote-viewer vnc://FQDN:5900
  8. 在 HostedEngine-VM 中启用 SSH

    RHV-M 虚拟设备上不默认启用 SSH 密码身份验证。通过 VNC 连接到 HostedEngine-VM 并启用 SSH 密码身份验证,以便您可以稍后通过 SSH 访问虚拟机,以恢复 BareMetal-Manager 备份文件并配置新的管理器。验证 sshd 服务是否正在运行。编辑 /etc/ssh/sshd_config,并将以下两个选项改为 yes
    [...]
    PermitRootLogin yes       
    [...]
    PasswordAuthentication yes
    重启 sshd 服务以使更改生效。
    # systemctl restart sshd.service
  9. Disabling BareMetal-Manager

    连接到 BareMetal-Manager (您建立的 Red Hat Virtualization 环境的管理器),并停止 ovirt-engine 服务并阻止它运行。
    # systemctl stop ovirt-engine.service
    # systemctl disable ovirt-engine.service
    注意
    虽然无法禁止运行 BareMetal-Manager,但建议不要对环境进行更改,因为它在创建备份后不会对环境进行任何更改。另外,它还可防止 BareMetal-Manager 和 HostedEngine-VM 同时管理现有资源。
  10. 更新 DNS

    更新您的 DNS,以便 Red Hat Virtualization 环境的 FQDN 与在 Host-HE1 上配置 hosted-engine 部署脚本时提供的 IP 地址 HostedEngine-VM 和 FQDN 相关联。在此过程中,FQDN 被设置为 manager.example.com,因为在迁移的 hosted-engine 设置中,为引擎提供的 FQDN 必须与原始引擎引擎引擎中提供的 FQDN 相同。
  11. 创建 BareMetal-Manager 备份

    连接到 BareMetal-Manager,并使用 --mode=backup--file=FILE--log=LogFILE 参数运行 engine-backup 命令,以指定备份模式、创建并用于备份的备份文件的名称,以及要创建的日志文件名称来存储备份日志。
    # engine-backup --mode=backup --file=FILE --log=LogFILE
  12. 将备份文件复制到 HostedEngine-VM

    在 BareMetal-Manager 上,将备份文件复制到 HostedEngine-VM。在以下示例中,manager.example.com 是 HostedEngine-VM 的 FQDN,/backup/ 是任何指定的文件夹或路径。如果指定的文件夹或路径不存在,您必须连接到 HostedEngine-VM,并在从 BareMetal-Manager 复制备份前创建它。
    # scp -p FILE LogFILE manager.example.com:/backup/
  13. Registering HostedEngine-VM

    使用红帽订阅管理注册 HostedEngine-VM 并启用所需的存储库。请参阅安装指南中的订阅所需 权利
  14. 在 HostedEngine-VM 上恢复备份文件

    使用 engine-backup 工具恢复完整的备份。如果您在 engine-setup 过程中手动配置 BareMetal-Manager 数据库,请按照 第 6.2.3 节 “手动恢复自托管引擎管理器” 中的说明手动恢复备份环境。
    • 如果您只恢复 Manager,请运行:
      # engine-backup --mode=restore --file=file_name --log=log_file_name --provision-db --restore-permissions
    • 如果您要恢复 Manager 和数据仓库,请运行:
      # engine-backup --mode=restore --file=file_name --log=log_file_name --provision-db --provision-dwh-db --restore-permissions
    如果成功,则会显示以下输出:
    You should now run engine-setup.
    Done.
  15. Configuring HostedEngine-VM

    配置恢复的 Manager 虚拟机。这个过程标识现有的配置设置和数据库内容。确认设置。完成后,设置会提供 SSH 指纹和内部证书颁发机构哈希。
    # engine-setup
    [ INFO  ] Stage: Initializing
    [ INFO  ] Stage: Environment setup
    Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf']
    Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20140304075238.log
    Version: otopi-1.1.2 (otopi-1.1.2-1.el6ev)
    [ INFO  ] Stage: Environment packages setup
    [ INFO  ] Yum Downloading: rhel-65-zstream/primary_db 2.8 M(70%)
    [ INFO  ] Stage: Programs detection
    [ INFO  ] Stage: Environment setup
    [ INFO  ] Stage: Environment customization
             
              --== PACKAGES ==--
             
    [ INFO  ] Checking for product updates...
    [ INFO  ] No product updates found
             
              --== NETWORK CONFIGURATION ==--
             
    Setup can automatically configure the firewall on this system.
    Note: automatic configuration of the firewall may overwrite current settings.
    Do you want Setup to configure the firewall? (Yes, No) [Yes]: 
    [ INFO  ] iptables will be configured as firewall manager.
             
              --== DATABASE CONFIGURATION ==--
             
             
              --== OVIRT ENGINE CONFIGURATION ==--
             
             
              --== PKI CONFIGURATION ==--
             
             
              --== APACHE CONFIGURATION ==--
             
             
              --== SYSTEM CONFIGURATION ==--
             
             
              --== END OF CONFIGURATION ==--
             
    [ INFO  ] Stage: Setup validation
    [ INFO  ] Cleaning stale zombie tasks
             
              --== CONFIGURATION PREVIEW ==--
             
              Default SAN wipe after delete           : False
              Firewall manager                        : iptables
              Update Firewall                         : True
              Host FQDN                               : manager.example.com
              Engine database secured connection      : False
              Engine database host                    : X.X.X.X
              Engine database user name               : engine
              Engine database name                    : engine
              Engine database port                    : 5432
              Engine database host name validation    : False
              Engine installation                     : True
              PKI organization                        : example.com
              NFS mount point                         : /var/lib/exports/iso
              Configure VMConsole Proxy               : True
              Engine Host FQDN                        : manager.example.com
              Configure WebSocket Proxy               : True
             
              Please confirm installation settings (OK, Cancel) [OK]:
  16. 同步主机和管理器

    返回到 Host-HE1,并通过选择选项 1 继续运行 hosted-engine 部署脚本:
    (1) Continue setup - oVirt-Engine installation is ready and ovirt-engine service is up
    脚本显示内部证书颁发机构哈希,并提示您选择要添加 Host-HE1 的集群。
    [ INFO  ] Engine replied: DB Up!Welcome to Health Status!
    [ INFO  ] Acquiring internal CA cert from the engine
    [ INFO  ] The following CA certificate is going to be used, please immediately interrupt if not correct:
    [ INFO  ] Issuer: C=US, O=example.com, CN=manager.example.com.23240, Subject: C=US, O=example.com, CN=manager.example.com.23240, Fingerprint (SHA-1): XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    [ INFO  ] Connecting to the Engine
              Enter the name of the cluster to which you want to add the host (DB1, DB2, Default) [Default]:
    [ INFO  ] Waiting for the host to become operational in the engine. This may take several minutes...
    [ INFO  ] The VDSM Host is now operational
    [ INFO  ] Saving hosted-engine configuration on the shared storage domain
              Please shutdown the VM allowing the system to launch it as a monitored service.
              The system will wait until the VM is down.
  17. 关闭 HostedEngine-VM

    关闭 HostedEngine-VM.
    # shutdown -h now
  18. 设置确认

    返回到 Host-HE1,以确认它检测到 HostedEngine-VM 已关闭。
    [ INFO  ] Enabling and starting HA services
    [ INFO  ] Stage: Clean up
    [ INFO  ] Generating answer file '/var/lib/ovirt-hosted-engine-setup/answers/answers-20160509162843.conf'
    [ INFO  ] Generating answer file '/etc/ovirt-hosted-engine/answers.conf'
    [ INFO  ] Stage: Pre-termination
    [ INFO  ] Stage: Termination
    [ INFO  ] Hosted Engine successfully set up
您的 Red Hat Virtualization 引擎已迁移到自托管引擎设置中。Manager 现在在 Host-HE1 上的虚拟机上运行,在环境中名为 HostedEngine-VM。当 HostedEngine-VM 具有高可用性时,它将在适用时迁移到环境中的其他自托管引擎节点。

第 5 章 维护和升级资源

5.1. 维护自托管引擎

通过维护模式,您可以在不干扰高可用性代理的情况下启动、停止和修改管理器虚拟机,以及重启和修改环境中的自托管引擎节点,而无需干扰管理器。
可以强制执行三种维护模式:
  • 全局 - 集群中的所有高可用性代理都禁止监控 Manager 虚拟机的状态。对于需要停止 ovirt-engine 服务的任何设置或升级操作,需要应用全局维护模式,如升级到更新的 Red Hat Virtualization 版本。
  • 本地 - 发出命令的节点上的高可用性代理通过监控管理器虚拟机的状态被禁用。该节点免于在本地维护模式的托管管理器虚拟机;如果托管 Manager 虚拟机(如果进入此模式时,管理器将迁移到另一节点),只要有一个可用的节点,管理器将迁移到另一节点。当对自托管引擎节点应用系统更改或更新时,建议使用本地维护模式。
  • none - 禁用维护模式,确保高可用性代理正在运行。

过程 5.1. 维护基于 RHEL 的自托管引擎(本地维护)

  1. 将自托管引擎节点置于本地维护模式:
    • 在管理门户中,选择一个自托管引擎节点,再单击 Maintenance。自动为该节点触发本地维护模式。
    • 您还可以从命令行设置维护模式:
      # hosted-engine --set-maintenance --mode=local
  2. 完成任何维护任务后,禁用维护模式:
    # hosted-engine --set-maintenance --mode=none

过程 5.2. 维护基于 RHEL 的自托管引擎(全球维护)

  1. 将自托管引擎节点置于全局维护模式:
    • 在管理门户中,右键单击 Manager 虚拟机,然后选择 Enable Global HA Maintenance
    • 您还可以从命令行设置维护模式:
      # hosted-engine --set-maintenance --mode=global
  2. 完成任何维护任务后,禁用维护模式:
    # hosted-engine --set-maintenance --mode=none

5.2. 从自托管引擎环境中删除主机

要从环境中删除自托管引擎节点,请将节点置于维护模式,取消部署该节点,并选择性地将其删除。在停止 HA 服务后,节点可以作为常规主机进行管理,并且删除了自托管引擎配置文件。

过程 5.3. 从自托管引擎环境中删除主机

  1. 在管理门户中,点 Hosts 选项卡。选择自托管引擎节点,再单击 Maintenance,将它设置为本地维护模式。
  2. Edit
  3. 单击 托管引擎 子选项卡,再选择 Undeploy 单选按钮。此操作将停止 ovirt-ha-agentovirt-ha-broker 服务,并删除自托管引擎配置文件。
    注意
    主机将可见,但在运行 hosted-engine --vm-status 时显示为不可用。这是因为在主机取消部署时元数据不会被删除。当元数据没有刷新时,删除的主机将会在大约一周中消失。要强制删除主机的元数据,请参阅 如何清理托管引擎设置中重新部署的主机的元数据
  4. (可选)点 Remove 打开 Remove Host (s) 确认窗口,然后点 OK

5.3. 升级基于 RHEL 的自托管引擎环境

Red Hat Enterprise Virtualization 3.6 自托管引擎环境可以升级到 Red Hat Virtualization 4.0。Red Hat Virtualization 4.0 提供的升级工具将在 Manager 虚拟机上安装 Red Hat Enterprise Linux 7,并在新 Manager 上恢复 3.6 Manager 数据库的备份。在管理器升级到 4.0 后,您可以将自托管引擎节点和任何标准主机都更新至 4.0。
重要
upgrade 工具基于模板构建新的 Manager。需要手动将配置更改或自定义配置到原始管理器,如自定义用户、SSH 密钥和监控,需要在新 Manager 上手动重新应用。
注意
不支持将 Manager 虚拟机的原位升级到 Red Hat Enterprise Linux 7。
重要
以下流程只适用于升级在 Red Hat Enterprise Linux 7 主机上运行的 Red Hat Enterprise Virtualization 3.6 自托管引擎环境。在尝试这个过程前,环境中的所有数据中心和集群都必须将集群兼容性级别设置为版本 3.6。
注意
升级必须在当前运行 Manager 虚拟机的主机上进行,并设置为 SPM 服务器。upgrade 工具将检查这一点。
升级过程涉及以下关键步骤:
  • 将管理 Manager 虚拟机的高可用性代理放入全局维护模式。
  • 在主机上启用所需的存储库,并更新 ovirt-hosted-engine-setuprhevm-appliance 软件包。
  • 运行 hosted-engine --upgrade-appliance 以升级 Manager 虚拟机。在升级过程中,您需要创建 3.6 Manager 的备份,并将其复制到正在执行升级的主机机器中。
  • 更新主机。
  • 更新 Manager 虚拟机和集群中的所有主机后,将集群兼容性版本改为 4.0。
升级过程中创建的备份不会被自动删除。确认升级成功后,您需要手动删除它。备份磁盘使用 hosted-engine-backup-* 标记。

前提条件

  • /var/tmp 目录必须至少有 5 GB 的可用空间,才能提取设备文件。如果没有,您可以指定不同的目录或挂载具有所需空间的备用存储。VDSM 用户和组必须具有目录的读取、写入和执行权限。
  • 自托管引擎存储域必须具有要部署的新设备的额外可用空间(默认为 50 GB)。要在 iSCSI 或光纤通道存储上增加存储,您必须手动在存储上扩展 LUN 大小,然后使用 Manager 扩展存储域。有关调整 LUN 大小的更多信息,请参阅管理指南中的 增加 iSCSI 或 FCP 存储

过程 5.4. 升级自托管引擎

  1. 在所有自托管引擎节点上禁用高可用性代理。为此,请在集群中的任何主机上运行以下命令。
    # hosted-engine --set-maintenance --mode=global
    注意
    运行 hosted-engine --vm-status 以确认环境处于维护模式。
  2. 在当前设置为 SPM 并包含 Manager 虚拟机的主机上,启用所需的存储库。
    # subscription-manager repos --enable=rhel-7-server-rhv-4-mgmt-agent-rpms
  3. 将除 Manager 虚拟机外的所有虚拟机迁移到备用主机。
  4. 在主机上,更新 Manager 虚拟机软件包。
    # yum update ovirt-hosted-engine-setup rhevm-appliance
    如果缺少 rhevm-appliance 软件包,请在更新 ovirt-hosted-engine-setup 前手动安装它。
    # yum install rhevm-appliance
    # yum update ovirt-hosted-engine-setup
  5. 运行 upgrade 工具来升级 Manager 虚拟机。如果尚未安装,请安装 screen 软件包,该软件包可在标准 Red Hat Enterprise Linux 存储库中获得。
    # yum install screen
    # screen
    # hosted-engine --upgrade-appliance
    注意
    如果检测到多个设备,并且创建 Manager 数据库的备份并提供其完整位置,系统将提示您选择设备。
  6. 升级完成后,禁用全局维护:
    # hosted-engine --set-maintenance --mode=none
如果升级过程中出现任何问题,请使用 hosted-engine --vm-poweroff 命令关闭 Manager,然后运行 hosted-engine --rollback-upgrade 来回滚升级。
要升级自托管引擎环境中的主机,请参阅 第 5.5 节 “在自托管引擎环境中升级主机”

5.4. 升级基于 RHEV-H 的自托管引擎环境

将基于 RHEV-H 的自托管引擎环境从 RHEV 3.6 升级到 RHV 4.0,要求您安装最新的 Red Hat Virtualization 主机(RHVH) 4.0 并升级到 Red Hat Virtualization Manager (RHV-M) 4.0。Red Hat Virtualization 4.0 提供的升级工具将在 Manager 虚拟机上安装 Red Hat Enterprise Linux 7,并在新 Manager 上恢复 3.6 Manager 数据库的备份。
重要
upgrade 工具基于模板构建新的 Manager。需要手动将配置更改或自定义配置到原始管理器,如自定义用户、SSH 密钥和监控,需要在新 Manager 上手动重新应用。
重要
在尝试这个过程前,环境中的所有数据中心和集群都必须将集群兼容性级别设置为版本 3.6。
升级过程涉及以下关键步骤:
  • 将管理 Manager 虚拟机的高可用性代理放入全局维护模式。
  • 将新的 RHVH 4.0 主机添加到您的环境中。
  • 将 Manager 虚拟机迁移到新主机,并设置为 SPM。
  • 运行 upgrade 工具来升级 Manager。在升级过程中,您需要创建 3.6 Manager 的备份,并将其复制到要执行升级的主机机器中。
  • 更新主机。
  • 更新 Manager 虚拟机和集群中的所有主机后,将集群兼容性版本改为 4.0。
升级过程中创建的备份不会被自动删除。确认升级成功后,您需要手动删除它。备份磁盘使用 hosted-engine-backup-* 标记。

前提条件

  • /var/tmp 目录必须至少有 5 GB 的可用空间,才能提取设备文件。如果没有,您可以指定不同的目录或挂载具有所需空间的备用存储。VDSM 用户和组必须具有目录的读取、写入和执行权限。
  • 自托管引擎存储域必须具有要部署的新设备的额外可用空间(默认为 50 GB)。要在 iSCSI 或光纤通道存储上增加存储,您必须手动在存储上扩展 LUN 大小,然后使用 Manager 扩展存储域。有关调整 LUN 大小的更多信息,请参阅管理指南中的 增加 iSCSI 或 FCP 存储

过程 5.5. 升级自托管引擎

  1. 安装新的 RHVH 4.0 主机。有关安装 RHVH 的说明,请参阅 安装指南
  2. 将新主机添加到您的环境中。在新主机上运行部署脚本:
    # hosted-engine --deploy
    在提示时指定现有的共享存储域;该脚本会检测到这是额外的主机设置。如需了解在额外的主机 部署期间,请参阅 Red Hat Enterprise Virtualization 3.6 自托管引擎指南中的 将其他主机安装到自托管引擎指南中。
  3. 在所有自托管引擎节点上禁用高可用性代理。为此,请在集群中的任何主机上运行以下命令。
    # hosted-engine --set-maintenance --mode=global
    注意
    运行 hosted-engine --vm-status 以确认环境处于维护模式。
  4. 从客户门户网站下载 RHV-M 虚拟设备并将其复制到新主机:
    1. 登录位于 的客户门户网站 https://access.redhat.com
    2. 点菜单栏中的 Downloads
    3. Red Hat Virtualization > Download Latest 访问产品下载页面。
    4. 为 Red Hat Virtualization 4.0 选择设备,再单击 Download Now
    保护将 OVA 文件复制到 Red Hat Virtualization 主机:
    scp rhvm-appliance.ova root@host.example.com:/usr/share
  5. 将 Manager 虚拟机迁移到 RHVH 4.0 主机,并将主机设置为 Storage Pool Manager (SPM)。
  6. 运行 upgrade 脚本以升级 Manager 虚拟机。如果尚未安装,请安装 screen 软件包。
    # yum install screen
    # screen
    # hosted-engine --upgrade-appliance
    注意
    该脚本将询问您复制到主机的 RHV-M 虚拟设备的位置。它还会提示您创建 Manager 数据库的备份并提供其完整位置。
  7. 升级完成后,禁用全局维护:
    # hosted-engine --set-maintenance --mode=none
如果升级过程中出现任何问题,请使用 hosted-engine --vm-poweroff 命令关闭 Manager,然后运行 hosted-engine --rollback-upgrade 来回滚升级。
要升级自托管引擎环境中的主机,请参阅 第 5.5 节 “在自托管引擎环境中升级主机”

5.5. 在自托管引擎环境中升级主机

在更新环境中的 Red Hat Enterprise Linux 主机前,在您要更新的主机上运行以下命令,禁用版本 3.6 存储库并启用所需的 4.0 存储库。
# subscription-manager repos --disable=rhel-7-server-rhev-mgmt-agent-rpms
# subscription-manager repos --enable=rhel-7-server-rhv-4-mgmt-agent-rpms
现在,您可以更新环境中的 Red Hat Enterprise Linux 主机。如需更多信息, 请参阅升级指南中的 更新主机。
必须使用 RHVH 4.0 重新安装 RHEV-H 主机。请参阅安装指南中的 Red Hat Virtualization 主机
更新主机后,将数据中心和集群兼容性级别更新为 4.0。如需更多信息,请参阅升级 指南中的 Post-Upgrade 任务

5.6. 在次版本间更新自托管引擎管理器

将自托管引擎更新到次要发行本需要将计算机置于全局维护模式,然后按照标准流程在次版本间更新。
  1. 确保您已将 Manager 虚拟机订阅了所需的权利。如需更多信息,请参阅安装指南中的订阅所需权利
  2. 将系统置于全局维护模式。详情请查看 第 5.1 节 “维护自托管引擎”
  3. 按照使用 engine-setup 在次版本间更新的步骤操作。详情请参阅安装指南中的更新 次版本
  4. 禁用全局维护模式。详情请查看 第 5.1 节 “维护自托管引擎”

第 6 章 备份和恢复基于 RHEL 的自托管引擎环境

自托管引擎的性质以及自托管引擎节点和管理器虚拟机之间的关系,这意味着备份和恢复自托管引擎环境需要额外的注意事项。特别是,自托管引擎节点在备份时保留在环境中,这可能会导致在环境恢复后同步新节点和管理器虚拟机。
要解决这个问题,红帽建议在备份前将其中一个节点置于维护模式,从而使它从虚拟负载中释放。然后,可以使用此故障转移主机来部署新的自托管引擎。
如果自托管引擎节点在备份时执行虚拟负载,则具有任何匹配标识符的主机 - IP 地址、FQDN 或名称 - 无法用于部署恢复的自托管引擎。数据库冲突将阻止主机与恢复的 Manager 虚拟机同步。但是,在同步前,可以从恢复的 Manager 虚拟机中删除故障转移主机。
注意
如果使用新主机部署自托管引擎,则备份时不需要故障转移主机。新主机必须具有唯一的 IP 地址、FQDN 和名称,以便它不与数据库备份中存在的任何主机冲突。

过程 6.1. 备份自托管引擎环境的工作流

此流程提供了使用故障转移主机备份自托管引擎的工作流示例。然后,之后可以使用此主机来部署恢复的自托管引擎环境。有关备份自托管引擎的更多信息,请参阅 第 6.1 节 “备份自托管引擎管理器虚拟机”
  1. Manager 虚拟机在主机 2 上运行,环境中的六个常规虚拟机已在三个主机之间平衡。
    将主机 1 置于维护模式.这会将 主机 1 上的虚拟机迁移到其他主机,释放它的任何虚拟负载,并使其用作备份的故障转移主机。
  2. 主机 1 处于维护模式。之前托管的两台虚拟机已迁移到主机 3。
    使用 engine-backup 创建环境的备份。在执行备份后,可以再次激活主机 1 以托管虚拟机,包括管理器虚拟机。

过程 6.2. 恢复自托管引擎环境的工作流

此流程提供了从备份恢复自托管引擎环境的工作流示例。故障转移主机部署新的 Manager 虚拟机,然后恢复备份。直接恢复备份后,故障切换主机仍存在于 Red Hat Virtualization Manager 中,因为它在创建备份时位于环境中。从 Manager 中删除旧故障转移主机可让新主机与 Manager 虚拟机同步并完成部署。有关恢复自托管引擎的更多信息,请参阅 第 6.2 节 “恢复自托管引擎环境”
  1. 主机 1 已被用于部署新的自托管引擎,并恢复了之前示例过程中执行的备份。部署恢复的环境涉及常规自托管引擎部署的额外步骤:
    • 在 Manager 虚拟机上安装了 Red Hat Virtualization Manager 后,但在首次运行 engine-setup 之前,使用 engine-backup 工具恢复备份。
    • 配置 并恢复 了 Manager 后,登录到管理门户并删除 主机 1,这将存在于备份中。如果没有删除旧 主机 1,且在新主机 1 上最终部署时仍存在管理器,则管理器虚拟机将无法与新主机 1 同步,部署将失败。
    主机 1 和 Manager 虚拟机同步并完成部署后,可以在基本级别上将环境视为操作。只有一个自托管引擎节点,管理器虚拟机不可用。但是,如果需要,可以在 主机 1 上启动高优先级虚拟机。
    任何基于 RHEL 的主机 - 环境中存在但不是自托管引擎节点的主机 - 正常运行将会变为活动状态,并且备份时处于活动状态的虚拟机现在会在这些主机上运行并管理器中可用。
  2. 主机 2 和主机 3 无法恢复其当前状态。这些主机需要从环境中删除,然后使用 hosted-engine 部署脚本重新添加到环境中。有关这些操作的更多信息,请参阅 第 6.2.4 节 “从恢复的自托管引擎环境中删除非操作主机”第 7 章 在自托管环境中安装其他主机
    主机 2 和主机 3 已重新部署到恢复的环境中。现在,在进行备份前,环境位于第一个镜像中,但管理器虚拟机托管在 主机 1 上除外。

6.1. 备份自托管引擎管理器虚拟机

红帽建议定期备份自托管引擎环境。支持的备份方法使用 engine-backup 工具,可以在不中断 ovirt-engine 服务的情况下执行。engine-backup 工具只允许备份 Red Hat Virtualization Manager 虚拟机,但不允许您备份运行 Manager 虚拟机或环境中托管的其他虚拟机的自托管引擎节点。

过程 6.3. 备份原始 Red Hat Virtualization Manager

  1. 准备故障切换主机

    一个故障转移主机(一个环境中自托管引擎节点之一)必须置于维护模式,以便在备份时没有虚拟负载。之后,此主机可用于部署恢复的自托管引擎环境。任何自托管引擎节点都可以用作此备份场景的故障切换主机,但如果使用了 Host 1,则恢复过程更为简单。Host 1 主机的默认名称为 hosted_engine_1 ;这是初始运行 hosted-engine 部署脚本时所设置的。
    1. 登录到自托管引擎节点之一。
    2. 确认 hosted_engine_1 主机是 Host 1:
       # hosted-engine --vm-status
    3. 登录管理门户。
    4. 单击 Hosts 选项卡。
    5. 在结果列表中选择 hosted_engine_1 主机,然后单击 Maintenance
    6. 单击确定
    根据主机的虚拟负载,可能需要一些时间才能迁移所有虚拟机。主机状态变为 Maintenance 后,继续下一步。
  2. 创建 Manager 的备份

    在 Manager 虚拟机上,备份配置设置和数据库内容,将 [EngineBackupFile] 替换为备份文件的文件名,并将 [LogFILE] 替换为备份日志的文件名。
    # engine-backup --mode=backup --file=[EngineBackupFile] --log=[LogFILE]
  3. 将文件备份到外部服务器

    将文件备份到外部服务器。在以下示例中,[Storage.example.com] 是网络存储服务器的完全限定域名,它将存储备份直到需要,/backup/ 是任何指定的文件夹或路径。必须可以访问备份文件来恢复配置设置和数据库内容。
    # scp -p [EngineBackupFiles] [Storage.example.com:/backup/EngineBackupFiles]
  4. 激活故障切换主机

    使 hosted_engine_1 主机退出维护模式。
    1. 登录管理门户。
    2. 单击 Hosts 选项卡。
    3. 从结果列表中选择 hosted_engine_1
    4. Activate
您已备份了 Red Hat Virtualization Manager 虚拟机的配置设置和数据库内容。

6.2. 恢复自托管引擎环境

本节介绍如何从新安装的主机上的备份中恢复自托管引擎环境。支持的恢复方法使用 engine-backup 工具。
恢复自托管引擎环境涉及以下关键操作:
  1. 创建新安装的 Red Hat Enterprise Linux 主机并运行 hosted-engine 部署脚本。
  2. 在新 Manager 虚拟机中恢复 Red Hat Virtualization Manager 配置设置和数据库内容。
  3. 删除处于 Non Operational 状态的自托管引擎节点,并将其重新安装到恢复的自托管引擎环境中。

前提条件

  • 要恢复自托管引擎环境,您必须在物理主机上准备新安装的 Red Hat Enterprise Linux 系统。
  • 新主机和管理器的操作系统版本必须与原始主机和管理器的相同。
  • 您必须有适用于您新环境的红帽订阅管理器权利。有关所需存储库的列表 ,请参阅安装指南中的订阅所需 权利
  • 新管理器的完全限定域名必须与原始 Manager 的完全限定域名相同。正向和反向查找记录必须在 DNS 中设置。
  • 您必须为新的自托管引擎环境准备存储,以用作管理器虚拟机的共享存储域。此域必须至少为 60 GB。有关为您的部署准备存储的更多信息,请参阅管理指南中的存储章节https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/administration-guide/#chap-Storage

6.2.1. 创建新的自托管引擎环境,用作恢复的环境

您可以在备份环境中使用的硬件上恢复自托管引擎。但是,您必须将故障转移主机用于恢复的部署。第 6.1 节 “备份自托管引擎管理器虚拟机” 中使用的故障转移 主机 (主机 1)使用 hosted_engine_1 的默认主机名,该主机名也在此流程中使用。 由于自托管引擎的恢复过程的性质,可以在恢复引擎的最终同步前发生,需要删除此故障转移主机,只有在执行备份时主机没有虚拟负载时才实现。您还可以在备份环境中不使用的独立硬件上恢复备份,这并不是一个问题。
重要
此流程假设您在物理主机上安装了 Red Hat Enterprise Linux 系统,已将主机订阅到所需权利,并安装了 ovirt-hosted-engine-setup 软件包。如需更多信息,请参阅安装指南中的订阅 所需 权利和 第 2.1.1 节 “安装自托管引擎软件包”

过程 6.4. 创建新的自托管环境,用作恢复的环境

  1. 更新 DNS

    更新您的 DNS,以便 Red Hat Virtualization 环境的完全限定域名与新管理器的 IP 地址相关联。在此过程中,完全限定域名被设置为 Manager.example.com。为引擎提供的完全限定域名必须与备份的原始引擎引擎设置中给出的相同。
  2. 启动托管引擎部署

    在新安装的 Red Hat Enterprise Linux 主机上,运行 hosted-engine 部署脚本。要随时退出脚本,请使用 CTRL+D 键盘组合来中止部署。如果通过网络运行 hosted-engine 部署脚本,建议使用 screen 窗口管理器以避免在网络或终端中断时丢失会话。如果尚未安装,则首先安装 screen 软件包。
    # screen
    # hosted-engine --deploy
  3. 准备初始化

    脚本首先请求确认,以使用主机作为虚拟机监控程序在自托管引擎环境中使用。
    Continuing will configure this host for serving as hypervisor and create a VM where you have to install oVirt Engine afterwards. 
    Are you sure you want to continue? (Yes, No)[Yes]:
  4. 配置存储

    选择要使用的存储类型。
    During customization use CTRL-D to abort.
    Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs3, nfs4)[nfs3]:
    • 对于 NFS 存储类型,请使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/nfs
    • 对于 iSCSI,指定 iSCSI 门户 IP 地址、端口、用户名和密码,然后从自动检测的列表中选择目标名称。在部署过程中只能选择一个 iSCSI 目标。
      Please specify the iSCSI portal IP address:           
      Please specify the iSCSI portal port [3260]:           
      Please specify the iSCSI portal user:           
      Please specify the iSCSI portal password:
      Please specify the target name (auto-detected values) [default]:
    • 对于 Gluster 存储,使用 FQDN 或 IP 地址以及共享存储域的路径名称指定完整地址。
      重要
      仅支持副本 3 Gluster 存储。确保已进行以下配置:
      • 在所有三个 Gluster 服务器上的 /etc/glusterfs/glusterd.vol 文件中,将 rpc-auth-allow-insecure 设置为 上的
        option rpc-auth-allow-insecure on
      • 配置卷,如下所示:
        gluster volume set volume cluster.quorum-type auto
        gluster volume set volume network.ping-timeout 10
        gluster volume set volume auth.allow \*
        gluster volume set volume group virt
        gluster volume set volume storage.owner-uid 36
        gluster volume set volume storage.owner-gid 36
        gluster volume set volume server.allow-insecure on
      Please specify the full shared storage connection path to use (example: host:/path): storage.example.com:/hosted_engine/gluster_volume
    • 对于光纤通道,必须配置并连接主机总线适配器,hosted-engine 脚本将自动探测可用的 LUN。LUN 不得包含任何现有数据。
      The following luns have been found on the requested target:
      [1]     3514f0c5447600351       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
                
      [2]     3514f0c5447600352       30GiB   XtremIO XtremApp
                              status: used, paths: 2 active
      
      Please select the destination LUN (1, 2) [1]:
  5. 配置网络

    该脚本检测可能的网络接口控制器(NIC),以用作环境的管理网桥。然后,它会检查您的防火墙配置,并提供了修改控制台(SPICE 或 VNC)以访问 Manager 虚拟机。提供可供 ovirt-ha-agent 使用的可 ping 网关 IP 地址,以帮助确定主机是否适合运行 Manager 虚拟机。
    Please indicate a nic to set ovirtmgmt bridge on: (eth1, eth0) [eth1]:
    iptables was detected on your computer, do you wish setup to configure it? (Yes, No)[Yes]: 
    Please indicate a pingable gateway IP address [X.X.X.X]:
    
  6. 配置新管理器虚拟机

    该脚本将创建要配置为新管理器虚拟机的虚拟机。指定引导设备,如果适用,安装媒体的路径名称、镜像别名、CPU 类型、虚拟 CPU 数量和磁盘大小。为 Manager 虚拟机指定 MAC 地址或接受随机生成的地址。在 Manager 虚拟机上安装操作系统之前,可以使用 MAC 地址来更新 DHCP 服务器。指定用于创建 Manager 虚拟机的内存大小和控制台连接类型。
    Please specify the device to boot the VM from (cdrom, disk, pxe) [cdrom]: 
    Please specify an alias for the Hosted Engine image [hosted_engine]:  
    The following CPU types are supported by this host:
              - model_Penryn: Intel Penryn Family
              - model_Conroe: Intel Conroe Family
    Please specify the CPU type to be used by the VM [model_Penryn]: 
    Please specify the number of virtual CPUs for the VM [Defaults to minimum requirement: 2]: 
    Please specify the disk size of the VM in GB [Defaults to minimum requirement: 25]: 
    You may specify a MAC address for the VM or accept a randomly generated default [00:16:3e:77:b2:a4]: 
    Please specify the memory size of the VM in MB [Defaults to minimum requirement: 4096]: 
    Please specify the console type you want to use to connect to the VM (vnc, spice) [vnc]:
    
  7. 识别主机名

    指定 admin@internal 用户的密码来访问管理门户。
    必须为主机名提供唯一名称,以确保它不与从备份中恢复引擎时存在的其他资源冲突。此流程中可以使用名称 hosted_engine_1,因为此主机在环境备份前被置于维护模式,从而在引擎恢复引擎和主机和引擎的最终同步之间删除此主机。
    Enter engine admin password: 
    Confirm engine admin password:
    Enter the name which will be used to identify this host inside the Administration Portal [hosted_engine_1]:
  8. 配置托管引擎

    为新 Manager 虚拟机提供完全限定域名。此流程使用完全限定域名 Manager.example.com。提供 SMTP 服务器的名称和 TCP 端口号、用于发送电子邮件通知的电子邮件地址,以及用于接收这些通知的电子邮件地址列表。
    重要
    为引擎(Manager.example.com)提供的完全限定域名必须与最初设置原始管理器时提供的完全限定域名相同。
    Please provide the FQDN for the engine you would like to use.
    This needs to match the FQDN that you will use for the engine installation within the VM.
     Note: This will be the FQDN of the VM you are now going to create,
     it should not point to the base host or to any other existing machine.
     Engine FQDN: Manager.example.com
    Please provide the name of the SMTP server through which we will send notifications [localhost]: 
    Please provide the TCP port number of the SMTP server [25]: 
    Please provide the email address from which notifications will be sent [root@localhost]: 
    Please provide a comma-separated list of email addresses which will get notifications [root@localhost]:
  9. 配置预览

    在继续之前,hosted-engine 部署脚本会显示您输入的配置值,并提示您确认以继续使用这些值。
    Bridge interface                   : eth1
    Engine FQDN                        : Manager.example.com
    Bridge name                        : ovirtmgmt
    SSH daemon port                    : 22
    Firewall manager                   : iptables
    Gateway address                    : X.X.X.X
    Host name for web application      : hosted_engine_1
    Host ID                            : 1
    Image alias                        : hosted_engine
    Image size GB                      : 25
    Storage connection                 : storage.example.com:/hosted_engine/nfs
    Console type                       : vnc
    Memory size MB                     : 4096
    MAC address                        : 00:16:3e:77:b2:a4
    Boot type                          : pxe
    Number of CPUs                     : 2
    CPU Type                           : model_Penryn
    
    Please confirm installation settings (Yes, No)[Yes]:
    
  10. 创建新管理器虚拟机

    该脚本创建虚拟机以配置为管理器虚拟机,并提供连接详情。您必须在其上安装操作系统,然后 hosted-engine 部署脚本可以在 Hosted Engine 配置中继续。
    [ INFO  ] Stage: Transaction setup
    [ INFO  ] Stage: Misc configuration
    [ INFO  ] Stage: Package installation
    [ INFO  ] Stage: Misc configuration
    [ INFO  ] Configuring libvirt
    [ INFO  ] Configuring VDSM
    [ INFO  ] Starting vdsmd
    [ INFO  ] Waiting for VDSM hardware info
    [ INFO  ] Waiting for VDSM hardware info
    [ INFO  ] Configuring the management bridge
    [ INFO  ] Creating Storage Domain
    [ INFO  ] Creating Storage Pool
    [ INFO  ] Connecting Storage Pool
    [ INFO  ] Verifying sanlock lockspace initialization
    [ INFO  ] Creating VM Image
    [ INFO  ] Disconnecting Storage Pool
    [ INFO  ] Start monitoring domain
    [ INFO  ] Configuring VM
    [ INFO  ] Updating hosted-engine configuration
    [ INFO  ] Stage: Transaction commit
    [ INFO  ] Stage: Closing up
    [ INFO  ] Creating VM
    You can now connect to the VM with the following command:
          /usr/bin/remote-viewer vnc://localhost:5900
    Use temporary password "3477XXAM" to connect to vnc console.
    Please note that in order to use remote-viewer you need to be able to run graphical applications.
    This means that if you are using ssh you have to supply the -Y flag (enables trusted X11 forwarding).
    Otherwise you can run the command from a terminal in your preferred desktop environment.
    If you cannot run graphical applications you can connect to the graphic console from another host or connect to the console using the following command:
    virsh -c qemu+tls://Test/system console HostedEngine
    If you need to reboot the VM you will need to start it manually using the command:
    hosted-engine --vm-start
    You can then set a temporary password using the command:
    hosted-engine --add-console-password
    The VM has been started.  Install the OS and shut down or reboot it.  To continue please make a selection:
             
      (1) Continue setup - VM installation is complete
      (2) Reboot the VM and restart installation
      (3) Abort setup
      (4) Destroy VM and abort setup
             
      (1, 2, 3, 4)[1]:
    使用此流程的命名约定,使用以下命令使用 VNC 连接到虚拟机:
    /usr/bin/remote-viewer vnc://hosted_engine_1.example.com:5900
  11. 安装虚拟机操作系统

    连接到 Manager 虚拟机并安装 Red Hat Enterprise Linux 7 操作系统。
  12. 同步主机和管理器

    返回到主机,并通过选择选项 1 继续运行 hosted-engine 部署脚本:
    (1) Continue setup - VM installation is complete
    Waiting for VM to shut down...
    [ INFO  ] Creating VM
    You can now connect to the VM with the following command:
          /usr/bin/remote-viewer vnc://localhost:5900
    Use temporary password "3477XXAM" to connect to vnc console.
    Please note that in order to use remote-viewer you need to be able to run graphical applications.
    This means that if you are using ssh you have to supply the -Y flag (enables trusted X11 forwarding).
    Otherwise you can run the command from a terminal in your preferred desktop environment.
    If you cannot run graphical applications you can connect to the graphic console from another host or connect to the console using the following command:
    virsh -c qemu+tls://Test/system console HostedEngine
    If you need to reboot the VM you will need to start it manually using the command:
    hosted-engine --vm-start
    You can then set a temporary password using the command:
    hosted-engine --add-console-password
    Please install and setup the engine in the VM.
    You may also be interested in subscribing to "agent" RHN/Satellite channel and installing rhevm-guest-agent-common package in the VM.
    To continue make a selection from the options below:
      (1) Continue setup - engine installation is complete
      (2) Power off and restart the VM
      (3) Abort setup
      (4) Destroy VM and abort setup
             
      (1, 2, 3, 4)[1]:
  13. 安装 Manager

    连接到新的 Manager 虚拟机,在 Red Hat Subscription Management 中注册,并启用所需的存储库。请参阅安装指南中的订阅所需 权利
    确保所有已安装软件包的最新版本都正在使用,并安装 rhevm 软件包。
    # yum update
    注意
    如果任何与内核相关的软件包已更新,请重新启动计算机。
    # yum install rhevm
软件包安装完成后,您将能够继续恢复自托管引擎管理器。

6.2.2. 恢复自托管引擎管理器

以下流程概述了如何使用 engine-backup 工具自动恢复备份自托管引擎管理器虚拟机和数据仓库的配置设置和数据库内容。该流程只适用于在初始 engine-setup 期间自动配置的组件。如果您在 engine-setup 过程中手动配置了数据库,请按照 第 6.2.3 节 “手动恢复自托管引擎管理器” 中的说明手动恢复备份环境。

过程 6.5. 恢复自托管引擎管理器

  1. 保护将备份文件复制到新 Manager 虚拟机。这个示例将文件复制到 第 6.1 节 “备份自托管引擎管理器虚拟机” 中的网络存储服务器中。在本例中,Storage.example.com 是存储服务器的完全限定域名,/backup/EngineBackupFiles 是存储服务器上备份文件的指定文件路径,/backup/ 是文件将在新管理器中复制的路径。
    # scp -p Storage.example.com:/backup/EngineBackupFiles /backup/
  2. 使用 engine-backup 工具恢复完整的备份。
    • 如果您只恢复 Manager,请运行:
      # engine-backup --mode=restore --file=file_name --log=log_file_name --provision-db --restore-permissions
    • 如果您要恢复 Manager 和数据仓库,请运行:
      # engine-backup --mode=restore --file=file_name --log=log_file_name --provision-db --provision-dwh-db --restore-permissions
    如果成功,则会显示以下输出:
    You should now run engine-setup.
    Done.
  3. 配置恢复的 Manager 虚拟机。这个过程标识现有的配置设置和数据库内容。确认设置。完成后,设置会提供 SSH 指纹和内部证书颁发机构哈希。
    # engine-setup
    [ INFO  ] Stage: Initializing
    [ INFO  ] Stage: Environment setup
    Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf']
    Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20140304075238.log
    Version: otopi-1.1.2 (otopi-1.1.2-1.el6ev)
    [ INFO  ] Stage: Environment packages setup
    [ INFO  ] Yum Downloading: rhel-65-zstream/primary_db 2.8 M(70%)
    [ INFO  ] Stage: Programs detection
    [ INFO  ] Stage: Environment setup
    [ INFO  ] Stage: Environment customization
             
              --== PACKAGES ==--
             
    [ INFO  ] Checking for product updates...
    [ INFO  ] No product updates found
             
              --== NETWORK CONFIGURATION ==--
             
    Setup can automatically configure the firewall on this system.
    Note: automatic configuration of the firewall may overwrite current settings.
    Do you want Setup to configure the firewall? (Yes, No) [Yes]: 
    [ INFO  ] iptables will be configured as firewall manager.
             
              --== DATABASE CONFIGURATION ==--
             
             
              --== OVIRT ENGINE CONFIGURATION ==--
             
              Skipping storing options as database already prepared
             
              --== PKI CONFIGURATION ==--
             
              PKI is already configured
             
              --== APACHE CONFIGURATION ==--
             
             
              --== SYSTEM CONFIGURATION ==--
             
             
              --== END OF CONFIGURATION ==--
             
    [ INFO  ] Stage: Setup validation
    [ INFO  ] Cleaning stale zombie tasks
             
              --== CONFIGURATION PREVIEW ==--
             
              Database name                      : engine
              Database secured connection        : False
              Database host                      : X.X.X.X
              Database user name                 : engine
              Database host name validation      : False
              Database port                      : 5432
              NFS setup                          : True
              Firewall manager                   : iptables
              Update Firewall                    : True
              Configure WebSocket Proxy          : True
              Host FQDN                          : Manager.example.com
              NFS mount point                    : /var/lib/exports/iso
              Set application as default page    : True
              Configure Apache SSL               : True
             
              Please confirm installation settings (OK, Cancel) [OK]:
  4. 从 Restored 环境中删除主机

    如果恢复的自托管引擎的部署位于备份引擎中不存在唯一的名称的新硬件上,请跳过这一步。此步骤仅适用于在故障转移主机 hosted_engine_1 上发生的部署。因为创建备份时,此主机存在于环境中,所以它会在恢复的引擎中维护一个存在的,因此必须首先从环境中删除,然后才能进行最终同步。
    1. 登录管理门户。
    2. 单击 Hosts 选项卡。故障转移主机 hosted_engine_1 将处于维护模式,且没有虚拟负载,因为这是如何为备份做好准备。
    3. 点击 Remove
    4. 单击确定
    注意
    如果您要删除的主机无法正常工作,请参阅 第 6.2.4 节 “从恢复的自托管引擎环境中删除非操作主机” 来强制删除主机。
  5. 同步主机和管理器

    返回到主机,并通过选择选项 1 继续运行 hosted-engine 部署脚本:
    (1) Continue setup - engine installation is complete
    [ INFO  ] Engine replied: DB Up!Welcome to Health Status!
    [ INFO  ] Waiting for the host to become operational in the engine. This may take several minutes...
    [ INFO  ] Still waiting for VDSM host to become operational...
    此时,hosted_engine_1 将在进入 Non Operational 状态前在管理门户中可见,并带有 InstallingInitializing 状态。主机将继续等待 VDSM 主机变为正常运行,直到最终超时为止。这是因为环境中的另一台主机维护存储池管理器(SPM)角色和 hosted_engine_1 无法与存储域交互,因为 SPM 主机处于 Non Responsive 状态。当此过程超时时,系统会提示您关闭虚拟机以完成部署。部署完成后,可以手动将主机置于维护模式,并通过管理门户激活主机。
    [ INFO  ] Still waiting for VDSM host to become operational...
    [ ERROR ] Timed out while waiting for host to start. Please check the logs.
    [ ERROR ] Unable to add hosted_engine_2 to the manager
              Please shutdown the VM allowing the system to launch it as a monitored service.
              The system will wait until the VM is down.
  6. 关闭新 Manager 虚拟机。
    # shutdown -h now
  7. 返回到主机,以确认它检测到 Manager 虚拟机已关闭。
    [ INFO  ] Enabling and starting HA services
              Hosted Engine successfully set up
    [ INFO  ] Stage: Clean up
    [ INFO  ] Stage: Pre-termination
    [ INFO  ] Stage: Termination
    
  8. 激活主机。
    1. 登录管理门户。
    2. 单击 Hosts 选项卡。
    3. 选择 hosted_engine_1,再单击 维护 按钮。在进入维护模式前,主机可能需要几分钟时间。
    4. Activate 按钮。
    处于活动状态后,hosted_engine_1 会立即标记为 SPM,存储域和数据中心将变为活动状态。
  9. 通过手动隔离不响应的主机将虚拟机迁移到活动主机。在管理门户中,右键单击主机并选择 Confirm 'Host has Rebooted'
    在备份时在该主机上运行的任何虚拟机都将从该主机中删除,并从 Unknown 状态移到 Down 状态。这些虚拟机现在可以在 hosted_engine_1 上运行。现在,隔离的主机可以使用 REST API 强制删除。
现在,环境已恢复到 active _engine_1 处于活动状态,并且能够在恢复的环境中运行虚拟机。现在,可以按照 第 6.2.4 节 “从恢复的自托管引擎环境中删除非操作主机” 中的步骤删除剩余的自托管引擎节点,然后按照 第 7 章 在自托管环境中安装其他主机 中的步骤重新安装到环境中。
注意
如果 Manager 数据库成功恢复,但 Manager 虚拟机似乎为 Down,且无法迁移到另一个自托管引擎节点,您可以启用新的 Manager 虚拟机,并按照 中提供 https://access.redhat.com/solutions/1517683 的步骤从环境中删除死管理器虚拟机。

6.2.3. 手动恢复自托管引擎管理器

以下流程概述了如何为备份自托管引擎管理器虚拟机手动恢复配置设置和数据库内容。

过程 6.6. 恢复自托管引擎管理器

  1. 手动创建可以恢复备份中数据库内容的空数据库。必须在要托管数据库的计算机上执行以下步骤。
    1. 如果数据库要托管在 Manager 虚拟机以外的计算机上,请安装 postgresql-server 软件包。如果数据库要托管在 Manager 虚拟机上,则不需要这一步,因为该软件包包含在 rhevm 软件包中。
      # yum install postgresql-server
    2. 初始化 postgresql 数据库,启动 postgresql 服务并确保该服务在引导时启动:
      # postgresql-setup initdb
      # systemctl start postgresql.service
      # systemctl enable postgresql.service
    3. 输入 postgresql 命令行:
      # su postgres
      $ psql
    4. 创建 engine 用户:
      postgres=# create role engine with login encrypted password 'password';
      如果您也恢复数据仓库,请在相关主机上创建 ovirt_engine_history 用户:
      postgres=# create role ovirt_engine_history with login encrypted password 'password';
    5. 创建新数据库:
      postgres=# create database database_name owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
      如果您也恢复数据仓库,请在相关主机上创建数据库:
      postgres=# create database database_name owner ovirt_engine_history template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
    6. 退出 postgresql 命令行,再从 postgres 用户注销:
      postgres=# \q
      $ exit
    7. 编辑 /var/lib/pgsql/data/pg_hba.conf 文件,如下所示:
      • 对于每个本地数据库,使用以下指令替换以文件底部的 local 部分的现有指令:
        host    database_name    user_name    0.0.0.0/0  md5
        host    database_name    user_name    ::0/0      md5
      • 对于每个远程数据库:
        • 在文件底部的以 Local 开头的行下添加以下行,将 X.X.X.X 替换为 Manager 的 IP 地址:
          host    database_name    user_name    X.X.X.X/32   md5
        • 允许到数据库的 TCP/IP 连接。编辑 /var/lib/pgsql/data/postgresql.conf 文件并添加以下行:
          listen_addresses='*'
          这个示例将 postgresql 服务配置为侦听所有接口上的连接。您可以通过提供 IP 地址来指定接口。
        • 打开用于 PostgreSQL 数据库连接的默认端口,并保存更新的防火墙规则:
          # iptables -I INPUT 5 -p tcp -s Manager_IP_Address --dport 5432 -j ACCEPT
          # service iptables save
    8. 重启 postgresql 服务:
      # systemctl restart postgresql.service
  2. 保护将备份文件复制到新 Manager 虚拟机。这个示例将文件复制到 第 6.1 节 “备份自托管引擎管理器虚拟机” 中的网络存储服务器中。在本例中,Storage.example.com 是存储服务器的完全限定域名,/backup/EngineBackupFiles 是存储服务器上备份文件的指定文件路径,/backup/ 是文件将在新管理器中复制的路径。
    # scp -p Storage.example.com:/backup/EngineBackupFiles /backup/
  3. 使用 --change-db-credentials 参数恢复完整的备份或仅数据库备份,以传递新数据库的凭证。在本地的数据库到管理器的 database_locationlocalhost
    注意
    以下示例为每个数据库使用 --*password 选项而不指定密码,这将为每个数据库提示输入密码。可以在命令本身中为这些选项提供密码,但不建议密码存储在 shell 历史记录中。另外,--*passfile=password_file 选项可用于每个数据库安全地将密码传递给 engine-backup 工具,而无需交互式提示。
    • 恢复完整的备份:
      # engine-backup --mode=restore --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password
      如果数据仓库也作为完整备份的一部分恢复,请包括额外数据库的修订凭证:
      engine-backup --mode=restore --file=file_name --log=log_file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password --change-dwh-db-credentials --dwh-db-host=database_location --dwh-db-name=database_name --dwh-db-user=ovirt_engine_history --dwh-db-password
    • 恢复仅数据库备份,恢复配置文件和数据库备份:
      # engine-backup --mode=restore --scope=files --scope=db --file=file_name --log=file_name --change-db-credentials --db-host=database_location --db-name=database_name --db-user=engine --db-password
      上面的示例恢复 Manager 数据库的备份。
      # engine-backup --mode=restore --scope=files --scope=dwhdb --file=file_name --log=file_name --change-dwh-db-credentials --dwh-db-host=database_location --dwh-db-name=database_name --dwh-db-user=ovirt_engine_history --dwh-db-password
      上面的示例恢复数据仓库数据库的备份。
    如果成功,则会显示以下输出:
    You should now run engine-setup.
    Done.
  4. 配置恢复的 Manager 虚拟机。这个过程标识现有的配置设置和数据库内容。确认设置。完成后,设置会提供 SSH 指纹和内部证书颁发机构哈希。
    # engine-setup
    [ INFO  ] Stage: Initializing
    [ INFO  ] Stage: Environment setup
    Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf']
    Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20140304075238.log
    Version: otopi-1.1.2 (otopi-1.1.2-1.el6ev)
    [ INFO  ] Stage: Environment packages setup
    [ INFO  ] Yum Downloading: rhel-65-zstream/primary_db 2.8 M(70%)
    [ INFO  ] Stage: Programs detection
    [ INFO  ] Stage: Environment setup
    [ INFO  ] Stage: Environment customization
             
              --== PACKAGES ==--
             
    [ INFO  ] Checking for product updates...
    [ INFO  ] No product updates found
             
              --== NETWORK CONFIGURATION ==--
             
    Setup can automatically configure the firewall on this system.
    Note: automatic configuration of the firewall may overwrite current settings.
    Do you want Setup to configure the firewall? (Yes, No) [Yes]: 
    [ INFO  ] iptables will be configured as firewall manager.
             
              --== DATABASE CONFIGURATION ==--
             
             
              --== OVIRT ENGINE CONFIGURATION ==--
             
              Skipping storing options as database already prepared
             
              --== PKI CONFIGURATION ==--
             
              PKI is already configured
             
              --== APACHE CONFIGURATION ==--
             
             
              --== SYSTEM CONFIGURATION ==--
             
             
              --== END OF CONFIGURATION ==--
             
    [ INFO  ] Stage: Setup validation
    [ INFO  ] Cleaning stale zombie tasks
             
              --== CONFIGURATION PREVIEW ==--
             
              Database name                      : engine
              Database secured connection        : False
              Database host                      : X.X.X.X
              Database user name                 : engine
              Database host name validation      : False
              Database port                      : 5432
              NFS setup                          : True
              Firewall manager                   : iptables
              Update Firewall                    : True
              Configure WebSocket Proxy          : True
              Host FQDN                          : Manager.example.com
              NFS mount point                    : /var/lib/exports/iso
              Set application as default page    : True
              Configure Apache SSL               : True
             
              Please confirm installation settings (OK, Cancel) [OK]:
  5. 从 Restored 环境中删除主机

    如果恢复的自托管引擎的部署位于备份引擎中不存在唯一的名称的新硬件上,请跳过这一步。此步骤仅适用于在故障转移主机 hosted_engine_1 上发生的部署。因为创建备份时,此主机存在于环境中,所以它会在恢复的引擎中维护一个存在的,因此必须首先从环境中删除,然后才能进行最终同步。
    1. 登录管理门户。
    2. 单击 Hosts 选项卡。故障转移主机 hosted_engine_1 将处于维护模式,且没有虚拟负载,因为这是如何为备份做好准备。
    3. 点击 Remove
    4. 单击确定
  6. 同步主机和管理器

    返回到主机,并通过选择选项 1 继续运行 hosted-engine 部署脚本:
    (1) Continue setup - engine installation is complete
    [ INFO  ] Engine replied: DB Up!Welcome to Health Status!
    [ INFO  ] Waiting for the host to become operational in the engine. This may take several minutes...
    [ INFO  ] Still waiting for VDSM host to become operational...
    此时,hosted_engine_1 将在进入 Non Operational 状态前在管理门户中可见,并带有 InstallingInitializing 状态。主机将继续等待 VDSM 主机变为正常运行,直到最终超时为止。这是因为环境中的另一台主机维护存储池管理器(SPM)角色和 hosted_engine_1 无法与存储域交互,因为 SPM 主机处于 Non Responsive 状态。当此过程超时时,系统会提示您关闭虚拟机以完成部署。部署完成后,可以手动将主机置于维护模式,并通过管理门户激活主机。
    [ INFO  ] Still waiting for VDSM host to become operational...
    [ ERROR ] Timed out while waiting for host to start. Please check the logs.
    [ ERROR ] Unable to add hosted_engine_2 to the manager
              Please shutdown the VM allowing the system to launch it as a monitored service.
              The system will wait until the VM is down.
  7. 关闭新 Manager 虚拟机。
    # shutdown -h now
  8. 返回到主机,以确认它检测到 Manager 虚拟机已关闭。
    [ INFO  ] Enabling and starting HA services
              Hosted Engine successfully set up
    [ INFO  ] Stage: Clean up
    [ INFO  ] Stage: Pre-termination
    [ INFO  ] Stage: Termination
    
  9. 激活主机。
    1. 登录管理门户。
    2. 单击 Hosts 选项卡。
    3. 选择 hosted_engine_1,再单击 维护 按钮。在进入维护模式前,主机可能需要几分钟时间。
    4. Activate 按钮。
    处于活动状态后,hosted_engine_1 会立即标记为 SPM,存储域和数据中心将变为活动状态。
  10. 通过手动隔离不响应的主机将虚拟机迁移到活动主机。在管理门户中,右键单击主机并选择 Confirm 'Host has Rebooted'
    在备份时在该主机上运行的任何虚拟机都将从该主机中删除,并从 Unknown 状态移到 Down 状态。这些虚拟机现在可以在 hosted_engine_1 上运行。现在,隔离的主机可以使用 REST API 强制删除。
现在,环境已恢复到 active _engine_1 处于活动状态,并且能够在恢复的环境中运行虚拟机。现在,可以按照 第 6.2.4 节 “从恢复的自托管引擎环境中删除非操作主机” 中的步骤删除剩余的自托管引擎节点,然后按照 第 7 章 在自托管环境中安装其他主机 中的步骤重新安装到环境中。
注意
如果 Manager 数据库成功恢复,但 Manager 虚拟机似乎为 Down,且无法迁移到另一个自托管引擎节点,您可以启用新的 Manager 虚拟机,并按照 中提供 https://access.redhat.com/solutions/1517683 的步骤从环境中删除死管理器虚拟机。

6.2.4. 从恢复的自托管引擎环境中删除非操作主机

在管理门户中隔离主机后,可以使用 REST API 请求强制删除主机。此流程将使用 cURL (命令行界面)将请求发送到 HTTP 服务器。大多数 Linux 发行版包括 cURL。这个过程将连接到 Manager 虚拟机,以执行相关的请求。
  1. 隔离非操作主机

    在管理门户中,右键单击主机并选择 Confirm 'Host has Rebooted'
    在备份时在该主机上运行的任何虚拟机都将从该主机中删除,并从 Unknown 状态移到 Down 状态。现在,隔离的主机可以使用 REST API 强制删除。
  2. 检索 Manager 证书颁发机构

    连接到 Manager 虚拟机,并使用命令行通过 cURL 执行以下请求:
    使用 GET 请求来检索以后的所有 API 请求中使用的 Manager 证书颁发机构(CA)证书。在以下示例中,-- output 选项用于 将文件 hosted-engine.ca 指定为 Manager CA 证书的输出。--insecure 选项表示此初始请求将没有证书。
    # curl --output hosted-engine.ca --insecure https://[Manager.example.com]/ca.crt
  3. 检索要删除的主机的 GUID

    在主机集合上使用 GET 请求来检索要删除的主机的全局唯一标识符(GUID)。以下示例包括 Manager CA 证书文件,并使用 admin@internal 用户进行身份验证,在执行命令后,系统将提示输入密码。
    # curl --request GET --cacert hosted-engine.ca --user admin@internal https://[Manager.example.com]/api/hosts
    此请求返回环境中所有主机的详细信息。主机 GUID 是与主机名关联的十六进制字符串。有关 Red Hat Virtualization REST API 的更多信息,请参阅 Red Hat Virtualization REST API 指南
  4. 删除 Fenced 主机

    使用隔离主机的 GUID 使用 DELETE 请求从环境中删除主机。除了之前使用的选项外,本例指定了标头,以指定要使用 eXtensible Markup Language (XML)发送和返回请求,以及 XML 中的正文将 force 操作设为 true
    curl --request DELETE --cacert hosted-engine.ca --user admin@internal --header "Content-Type: application/xml" --header "Accept: application/xml" --data "<action><force>true</force></action>" https://[Manager.example.com]/api/hosts/ecde42b0-de2f-48fe-aa23-1ebd5196b4a5
    只要指定了适当的 GUID,可以使用此 DELETE 请求来删除自托管引擎环境中每个隔离的主机。
  5. 从主机中删除自托管引擎配置

    删除主机的自托管引擎配置,以便在将主机重新安装到自托管引擎环境时重新配置它。
    登录到主机并删除配置文件:
    # rm /etc/ovirt-hosted-engine/hosted-engine.conf
主机现在可以重新安装到自托管引擎环境。

第 7 章 在自托管环境中安装其他主机

添加额外的自托管引擎节点的方式与常规主机相同,另外一步用于将主机部署为自托管引擎节点。可自动检测共享存储域,并在需要时将节点用作故障转移主机来托管管理器虚拟机。您还可以将常规主机附加到自托管引擎环境,但不能托管管理器虚拟机。红帽强烈建议至少有两个自托管引擎节点,以确保 Manager 虚拟机高度可用。也可以使用 REST API 添加其他主机。请参阅 REST API 指南中的 主机。

前提条件

过程 7.1. 添加额外的自托管引擎节点

  1. 在管理门户中,点 Hosts resource 选项卡。
  2. New
    有关其他主机设置的详情,请参考管理指南中的新主机和编辑主机 Windows 中的设置 和控制 说明
  3. 使用下拉列表为新主机选择 Data CenterHost Cluster
  4. 输入新主机的 名称和地址标准 SSH 端口(端口 22)在 SSH Port 字段中自动填充。
  5. 选择用于管理器以访问主机的身份验证方法。
    • 输入 root 用户的密码以使用密码身份验证。
    • 或者,将 SSH PublicKey 字段中显示的密钥复制到主机上的 /root/.ssh/authorized_keys 以使用公钥身份验证。
  6. (可选)配置电源管理,其中主机具有受支持的电源管理卡。有关电源管理配置的详情 ,请参考管理指南中的主机电源管理设置说明
  7. 单击 托管引擎 子选项卡。
  8. 选择 Deploy 单选按钮。
  9. 点击 OK

第 8 章 将自托管引擎数据库迁移到远程服务器数据库

在对 Red Hat Virtualization Manager 进行了初始配置后,也可以将自托管引擎的 engine 数据库迁移到远程数据库服务器。使用 engine-backup 创建数据库备份,并在新的数据库服务器中恢复它。此流程假设新数据库服务器安装了 Red Hat Enterprise Linux 7,并配置了适当的订阅。请参阅安装指南中的订阅所需 权利
要将数据仓库迁移到单独的计算机,请参阅 数据仓库 指南中的将数据仓库 迁移到一个独立的机器

过程 8.1. 迁移数据库

  1. 登录自托管引擎节点,并将环境置于全局维护模式。这会禁用高可用性代理,并防止 Manager 虚拟机在流程中迁移:
    # hosted-engine --set-maintenance --mode=global
  2. 登录到 Red Hat Virtualization Manager 机器并停止 ovirt-engine 服务,使其不会影响到引擎备份:
    # systemctl stop ovirt-engine.service
  3. 创建 engine 数据库备份:
    # engine-backup --scope=files --scope=db --mode=backup --file=file_name --log=backup_log_name
  4. 将备份文件复制到新的数据库服务器:
    # scp /tmp/engine.dump root@new.database.server.com:/tmp
  5. 登录到新的数据库服务器并安装 engine-backup
    # yum install ovirt-engine-tools-backup
  6. 在新数据库服务器上恢复数据库。FILE_ NAME 是从 Manager 复制的备份文件。
    # engine-backup --mode=restore --scope=files --scope=db --file=file_name --log=restore_log_name --provision-db --no-restore-permissions
  7. 现在数据库已迁移,启动 ovirt-engine 服务:
    # systemctl start ovirt-engine.service
  8. 登录到自托管引擎节点并关闭维护模式,启用高可用性代理:
    # hosted-engine --set-maintenance --mode=none