Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

第 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 虚拟机订阅所需的权利。 如需更多信息,请参阅安装指南中的订阅所需权利