6.2. 创建一个新的自承载引擎环境作为恢复的环境

您可以在被备份环境中的硬件上恢复自承载引擎,但是必须使用故障转移(failover)主机。第 6.1 节 “备份自承载引擎 Manager 虚拟机” 中的故障转移主机(Host 1)使用默认的值作为主机名 - hosted_engine_1,这个主机名也在这里使用。因为自承载引擎恢复的特性,在对所恢复的引擎进行最后的同步前,使用的故障转移主机需要被删除(这要求在进行备份时,主机上没有运行任何虚拟机)。另外,您也可以在被备份环境外的硬件上进行恢复。

重要

本过程假设您已经在一台物理主机上全新安装了 Red Hat Enterprise Linux 系统,并为主机订阅了所需的权利,而且安装了 ovirt-hosted-engine-setup 软件包。如需了解更多信息,请参阅 第 3.1 节 “订阅所需的权利”第 3.2 节 “安装自承载引擎软件包”

过程 6.2. 创建一个新的自承载环境作为恢复的环境

  1. 更新 DNS

    更新 DNS,使 Red Hat Enterprise Virtualization 环境的完全限定域名与新 Manager 的 IP 地址相对应。在以下过程中,完全限定域名被设置为 Manager.example.com。引擎的完全限定域名需要和在设置被备份的原始引擎时使用的值相同。
  2. 初始化引擎

    在新安装的 Red Hat Enterprise Linux 主机上运行 hosted-engine 脚本开始部署的过程。您可以在任何时候使用 CTRL+D 键终止部署的过程。
    # hosted-engine --deploy
    如果需要通过网络运行 hosted-engine 部署脚本,我们推荐使用 screen 窗口管理程序。使用它可以在出现网络问题时保持当前运行的进程。如果还没有安装 screen,请先安装这个软件包。
    # screen hosted-engine --deploy
  3. 准备初始化

    脚本开始会要求您确认在自承载引擎环境中作为虚拟机管理程序(hypervisor)的主机信息。
    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 (iscsi, 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 地址、端口、用户名和密码,并从检测到的列表中选择一个目标名:
      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]:
    选择环境中使用的存储域和存储数据中心名。
    [ INFO  ] Installing on first host
    Please provide storage domain name. [hosted_storage]: 
    Local storage datacenter name is an internal name and currently will not be shown in engine's admin UI.Please enter local datacenter name [hosted_datacenter]:
  5. 配置网络

    这个脚本会检索可以作为环境的管理网桥的网卡(NIC),然后检查防火墙的配置,并根据控制台(SPICE 或 VNC)访问 Manager 虚拟机的需要来修改防火墙的配置。另外,它还需要一个可以被 ping 到的网关 IP 地址,ovirt-ha-agent 会使用它来决定主机是否适合运行 Manager 虚拟机。
    Please indicate a nic to set rhevm 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. 配置新的 Manager 虚拟机

    这个脚本会创建一个新的 Manager 虚拟机。根据具体情况指定引导设备、安装媒体的路径名、镜像别名、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. 指定主机的名称

    为主机提供一个唯一的名称,避免与从备份中恢复的名称冲突。hosted_engine_1 这个名称可以在此使用,因为在进行备份前,这个主机已被设置为维护模式,它会在恢复引擎操作和在主机与引擎进行最后的同步操作间被删除。
    Enter the name which will be used to identify this host inside the Administration Portal [hosted_engine_1]:
  8. 配置引擎

    为自承载环境指定一个名称,为访问管理门户的 admin@internal 用户设定一个密码。提供新的 Manager 虚拟机的完全限定域名。在这里使用 Manager.example.com 作为完全限定域名。指定 SMTP 服务器的名称、TCP 端口号、发送通知电子邮件的电邮地址、接收通知的一组电邮地址(以逗号分隔)。

    重要

    为引擎提供的完全限定域名(Manager.example.com)必须和初始设置原始 Manager 时提供的完全限定域名相同。
    Enter 'admin@internal' user password that will be used for accessing the Administrator Portal: 
    Confirm 'admin@internal' user password: 
    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                        : rhevm
    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. 创建新的 Manager 虚拟机

    这个脚本创建的虚拟机会被配置为 Manager 虚拟机,并提供和它进行连接的详情信息。在 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 6.5、6.6 或 6.7 操作系统。
  12. 把主机和 Manager 进行同步

    返回到主机,选择选项 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 虚拟机,确认所有安装的软件包都是最新版本,安装 rhevm 软件包。
    # yum update
    # yum install rhevm
  14. 安装 Reports 和 Data Warehouse

    如果您同时需要恢复 Reports 和 Data Warehouse,则需要安装 rhevm-reports-setuprhevm-dwh-setup 软件包。
    # yum install rhevm-reports-setup rhevm-dwh-setup
在软件包安装完成后,您就可以继续自承载引擎 Manager 的恢复过程。