第 2 章 部署自承载引擎

2.1. 在 Red Hat Enterprise Linux 主机上部署自承载引擎

2.1.1. 安装自承载引擎软件包

确认主机已注册并订阅了所需的权力。相关信息,请参阅安装指南中的 Subscribing to the Required Entitlements

过程 2.1. 安装自承载引擎

  1. 安装自承载引擎软件包
    # yum install ovirt-hosted-engine-setup
  2. 如果选择使用 appliance 来安装 Manager 虚拟机,则需要安装 RHV-M Virtual Appliance 软件包:
    # yum install rhevm-appliance
    您也可以使用 CD-ROM、磁盘或 PXE 安装 Manager 的操作系统。物理的 CD-ROM 驱动设备不被支持。
根据以下介绍的方法在 Red Hat Enterprise Linux 主机上部署和配置自承载引擎。

2.1.2. 配置基于 RHEL 的自承载引擎

hosted-engine 脚本可以帮助进行主机和 Manager 虚拟机的配置。这个脚本会要求您回答一系列问题,然后根据提供的信息对系统进行配置。
请确认已经满足了以下先决条件:

先决条件

  • 已经安装了一个全新的 Red Hat Enterprise Linux 7 系统,并在其中安装了 ovirt-hosted-engine-setup 软件包。
  • 为自承载引擎环境设置了存储系统。如需了解更多与存储相关的信息,请参阅 Red Hat Enterprise Virtualization 管理指南中的存储一章。
  • 设置了 Manager 和主机的完全限定域名(FQDN)。DNS 中需要有它的正向和反向查询记录。
  • 需要具有为 Manger 安装操作系统所需的安装介质(CD-ROM、磁盘或 PXE)。推荐的方法是选择磁盘选项,并使用RHV-M Virtual Appliance 安装 Manager。在安装 rhevm-appliance 软件包后,就可以使用 RHV-M Virtual Appliance。如果选择使用 CD-ROM 选项,则需要使用一个 ISO 文件。物理的 CD-ROM 驱动设备不被支持。
  • 如果使用 RHV-M Virtual Appliance 安装 Manager,需要保证一个目录有最少 60 GB 空间。hosted-engine 脚本会首先检查 /var/tmp 是否有足够的空间来展开 appliance 文件。如果空间不够,则需要指定一个不同的目录。

过程 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 地址指定它的完整地址,以及共享存储域的路径名。

      重要

      当前只支持 replica 3 Gluster 存储。请确认已进行了以下配置:
      • 在所有 3 个 Gluster 服务器的 /etc/glusterfs/glusterd.vol 文件中,把 rpc-auth-allow-insecure 设置为 on
        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. 配置虚拟机

    选择 disk 作为引导设备类型,脚本会自动检测到可用的 RHV-M Appliances。指定内存的大小。
             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 来使用 cloud-init 进行配置,如设置 root 密码、配置网络、配置主机名、为 engine-setup 提供使用的应答文件、在引导时运行 engine-setup。另外,如果已有存在的 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 用户的密码。提供 HostedEngine-VM 的 FQDN(在这里我们使用 Manager.example.com 作为 FQDN)。为 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 虚拟机,以及 Manager 虚拟机专用的共享存储域。

重要

admin@internal 用户身份进行登录来继续配置 Manager 并添加其它资源。您需要为数据中心创建另外一个数据域,对它进行初始化来支持一般的虚拟机数据,并使它对 Manager 虚拟机可见。如需了解与添加数据存储域相关的信息,请参阅管理指南中的 Storage
把您的 Red Hat Virtualization Manager 和一个目录服务器相关联,从而可以向环境添加额外的用户。Red Hat Virtualization 支持的目录服务器类型包括 Red Hat Directory Server (RHDS)、Red Hat Identity Management(IdM)、 Active Directory,以及其它一些类型。您需要使用 ovirt-engine-extension-aaa-ldap-setup 设置脚本在您的环境中添加目录服务器。如需了解更多相关信息,请参阅管理指南中的 Configuring an External LDAP Provider
ovirt-hosted-engine-setup 脚本同时也会把您在配置过程中提供的信息保存为一个应答文件,您可以使用它来进行系统恢复。如果没有使用 --generate-answer=<file> 参数指定应答文件,它会被默认存为 /etc/ovirt-hosted-engine/answers.conf

注意

默认情况下,SSH 密码验证不会在 RHV-M Virtual Appliance 中启动,您可以通过 SPICE 或 VNC 控制台访问 Red Hat Virtualization Manager 虚拟机来启用 SSH 密码。确认 sshd 服务正在运行。编辑 /etc/ssh/sshd_config,把以下两个选项设置为 yes
  • PasswordAuthentication
  • PermitRootLogin
重启 sshd 服务来使所做的修改生效。