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

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

请确认已经满足了以下先决条件:

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

过程 3.3. 配置基于 RHEL 的自承载引擎

  1. 初始化引擎

    运行 hosted-engine 脚本。推荐使用 screen 来运行这个脚本。这可以防止,在出现网络问题或终端被非正常终止时丢失当前运行的任务。screen 软件包包括在标准的 Red Hat Enterprise Linux 软件仓库中,安装这个软件包后就可以使用这个工具程序。使用 CTRL+D 键组合可以随时终止脚本。
    # 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 存储副本(replica)。请确认已进行了以下配置:
      • 在所有 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]:
    选择环境中使用的存储域和存储数据中心名。
    [ 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]:
  3. 配置网络

    这个脚本会检测可以被用来作为环境的管理网桥的网卡(NIC),然后会检查防火墙的配置,并为控制台(SPICE 或 VNC)访问修改防火墙的配置。

    注意

    当前,还不支持绑定的网络接口以及 vlan-tagged 网络接口。如果需要使用它们,请参阅 https://access.redhat.com/solutions/1417783
    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]: Yes
    Please indicate a pingable gateway IP address [X.X.X.X]:
  4. 配置虚拟机

    注意

    如需手工安装 Manager 虚拟机,请参阅 附录 A, 手工安装 Manager 的操作系统。使用 appliance,可以简化安装过程,而使用手工安装的方法,可以对安装过程进行完全的控制。
    选择 disk 作为引导设备类型,脚本会自动检测到可用的 RHEV-M Appliances。指定内存的大小。
             Please specify the device to boot the VM from (cdrom, disk, pxe) [disk]: 
    [ 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)
    	       Please specify the memory size of the appliance in MB (Defaults to OVF value: 16384):
    如果使用 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 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
    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: [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
    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
    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 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]: 
    Please specify the console type you would like to use to connect to the VM (vnc, spice) [vnc]: vnc
  5. 配置引擎

    指定在管理门户中标识 hypervisor 主机的名称,以及访问管理门户所使用的 admin@internal 用户的密码。提供 HostedEngine-VM 的 FQDN(在这里我们使用 Manager.example.com 作为 FQDN)。为 SMTP 服务器提供名称和 TCP 端口号、发送事件通知的电子邮件地址、以及需要接收事件通知的用户的电子邮件地址列表(以逗号分隔)。
    Enter the name which will be used to identify this host inside the Administrator Portal [hosted_engine_1]:
    Enter 'admin@internal' user password that will be used for accessing the Administrator Portal: p@ssw0rd
    Confirm 'admin@internal' user password: p@ssw0rd
    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 和高可用性服务,并把 hypervisor 主机和共享存储域连接到 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 conifguration 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 Enterprise Virtualization Manager 就已经被配置完成,并在您的 hypervisor 服务器上运行。Manager 已经配置好了数据中心、集群、hypervisor 主机、Manager 虚拟机,以及 Manager 虚拟机专用的共享存储域。您可以使用 admin@internal 用户登录来继续进行 Manager 的配置,并添加其它资源。您需要创建另外一个数据域来提供常规的虚拟机数据。
把您的 Red Hat Enterprise Virtualization Manager 和一个目录服务相关联,从而可以向环境添加额外的用户。Red Hat Enterprise Virtualization 支持的目录服务包括 Red Hat Directory Server (RHDS)、IdM 和 Active Directory。您需要使用 engine-manage-domains 命令在环境中添加目录服务器。
ovirt-hosted-engine-setup 脚本同时也会把您在配置过程中提供的信息保存为一个应答文件,您可以使用它来进行系统恢复。如果没有使用 --generate-answer=<file> 参数指定应答文件,它会被默认存为 /etc/ovirt-hosted-engine/answers.conf

注意

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