部署高可用性自动化中心(automation hub)


Red Hat Ansible Automation Platform 2.4

通过具有高可用性功能的自动化 hub 部署,提高可靠性和可扩展性

Red Hat Customer Content Services

摘要

本指南概述了自动化中心高可用性部署的要求和程序。

前言

本指南概述了自动化中心高可用性部署的要求和程序。

高可用性(HA)配置提高了自动化中心部署的可靠性和可扩展性。

自动化中心的 HA 部署有多个节点,它们使用负载均衡器分布工作负载同时运行相同的服务(一个"主动-主动"配置)。此配置消除了单一故障点,以最小化服务停机时间,并可让您轻松添加或移除节点来满足工作负载需求。

本指南仅涵盖 HA 自动化中心应用程序堆栈的部署。其他 HA 组件(如数据库和文件系统 HA 或设置 DNS 负载平衡)超出了本指南的范围。

使开源包含更多

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。我们从这四个术语开始:master、slave、黑名单和白名单。由于此项工作十分艰巨,这些更改将在即将推出的几个发行版本中逐步实施。有关更多详情,请参阅我们的首席技术官 Chris Wright 提供的消息

对红帽文档提供反馈

我们非常感谢您对我们的技术内容提供反馈,并鼓励您告诉我们您的想法。如果您想添加评论,提供见解、纠正拼写错误甚至询问问题,您可以在文档中直接这样做。

注意

您必须有一个红帽帐户并登录到客户门户网站。

要从客户门户网站提交文档反馈,请执行以下操作:

  1. 选择 Multi-page HTML 格式。
  2. 点文档右上角的 反馈 按钮。
  3. 突出显示您要提供反馈的文本部分。
  4. 点高亮文本旁的添加反馈对话框。
  5. 在页面右侧的文本框中输入您的反馈,然后点 Submit

每次提交反馈时,我们都会自动创建跟踪问题。打开在点 Submit 后显示的链接,并开始监视问题或添加更多注释。

第 1 章 对高可用性自动化中心的要求

在部署高可用性 (HA) 自动化中心前,请确保在您的环境中安装了共享文件系统,并配置了网络存储系统(如果适用)。

1.1. 所需的共享文件系统

高可用性自动化中心需要您在环境中安装一个共享文件系统,如 NFS。在运行 Red Hat Ansible Automation Platform 安装程序前,请验证作为共享文件系统安装的一部分,在集群中安装了 /var/lib/pulp 目录。如果在其中一个节点中没有检测到 /var/lib/pulp,则 Red Hat Ansible Automation Platform 安装程序会返回错误,从而导致高可用性自动化中心设置失败。

1.2. 网络存储安装要求

如果要使用自动化 hub 节点本身的网络存储安装 HA 自动化中心,您必须首先安装和使用 firewalld,以根据共享存储系统的要求打开共享存储系统所需的端口,然后才能运行 Ansible Automation Platform 安装程序。

执行以下命令安装和配置 firewalld

  1. 安装 firewalld 守护进程:

    $ dnf install firewalld
  2. 使用以下命令在 <service> 下添加网络存储:

    $ firewall-cmd --permanent --add-service=<service>
    注意

    如需支持的服务列表,请使用 $ firewall-cmd --get-services 命令

  3. 重新载入以应用配置:

    $ firewall-cmd --reload

第 2 章 安装高可用性自动化中心

配置 Ansible Automation Platform 安装程序,以便在高可用 (HA) 配置中安装自动化中心。通过创建挂载点并在 Ansible Automation Platform 环境中添加适当的 SELinux 上下文,在 SELinux 上安装 HA 自动化中心。

2.1. 带有高可用性功能的自动化中心安装

通过对 Ansible Automation Platform 安装程序中的 清单文件 进行以下更改,然后运行 ./setup.sh 脚本,安装高可用性的自动化中心:

指定数据库主机 IP

使用 automation_pg_hostautomation_pg_port 清单变量指定数据库主机的 IP 地址。例如:

automationhub_pg_host='192.0.2.10'
automationhub_pg_port='5432'

另外,使用 automationhub_pg_host 清单变量中的值,在 [database] 部分中指定数据库主机的 IP 地址:

[database]
192.0.2.10

列出集群设置中的所有实例

如果安装集群设置,请将 [automationhub] 部分中的 localhost ansible_connection=local 替换为所有实例的主机名或 IP。例如:

[automationhub]
automationhub1.testing.ansible.com ansible_user=cloud-user ansible_host=192.0.2.18
automationhub2.testing.ansible.com ansible_user=cloud-user ansible_host=192.0.2.20
automationhub3.testing.ansible.com ansible_user=cloud-user ansible_host=192.0.2.22

Red Hat Single Sign-On 要求

如果要在自动化中心环境中实施 Red Hat Single Sign-On,请使用 automationhub_main_url 清单变量指定客户端要连接的主自动化中心 URL。例如:

automationhub_main_url = 'https://automationhub.ansible.com'

安装后

检查以确保每个 Private Automation Hub 服务器的 /etc/pulp/settings.py 中存在以下指令:

USE_X_FORWARDED_PORT = True
USE_X_FORWARDED_HOST = True
注意

如果没有指定 Automationhub_main_url,则默认使用 [automationhub] 组中的第一个节点。

2.2. 在 SELinux 上安装自动化中心的高可用性 (HA) 部署

要在 SELinux 上设置自动化中心的高可用性(HA)部署,请为 /var/lib/pulp/var/lib/pulp/pulpcore_static 创建两个挂载点,然后将适当的 SELinux 上下文分配给每个。您需要为 /var/lib/pulp/pulpcore_static 添加上下文,并在为 /var/lib/pulp 添加上下文前运行 Ansible Automation Platform 安装程序。

先决条件

  • 您已在服务器上配置了 NFS 导出。

预安装步骤

  1. /var/lib/pulp 中创建挂载点:

    $ mkdir /var/lib/pulp/
  2. 使用文本编辑器打开 /etc/fstab,然后添加以下值:

    srv_rhel8:/data /var/lib/pulp nfs defaults,_netdev,nosharecache 0 0
    srv_rhel8:/data/pulpcore_static /var/lib/pulp/pulpcore_static nfs defaults,_netdev,nosharecache,context="system_u:object_r:httpd_sys_content_rw_t:s0" 0 0
  3. 运行以下命令:

    $ systemctl daemon-reload
  4. /var/lib/pulp 运行 mount 命令:

    $ mount /var/lib/pulp
  5. /var/lib/pulp/pulpcore_static 处创建一个挂载点:

    $ mkdir /var/lib/pulp/pulpcore_static
  6. 运行 mount 命令:

    $ mount -a
  7. 设置挂载点后,运行 Ansible Automation Platform 安装程序:

    $ setup.sh -- -b --become-user root

安装完成后,卸载 /var/lib/pulp/ 挂载点,然后应用适当的 SELinux 上下文:

安装后的步骤

  1. 关闭 Pulp 服务:

    $ systemctl stop pulpcore.service
  2. 卸载 /var/lib/pulp/pulpcore_static

    $ umount /var/lib/pulp/pulpcore_static
  3. 卸载 /var/lib/pulp/:

    $ umount /var/lib/pulp/
  4. 使用文本编辑器打开 /etc/fstab,然后使用以下内容替换 /var/lib/pulp 的现有值:

    srv_rhel8:/data /var/lib/pulp nfs defaults,_netdev,nosharecache,context="system_u:object_r:pulpcore_var_lib_t:s0" 0 0
  5. 运行 mount 命令:

    $ mount -a

配置 pulpcore.service:

  1. 设置了两个挂载点,关闭 Pulp 服务以配置 pulpcore.service

    $ systemctl stop pulpcore.service
  2. 使用 systemctl 编辑 pulpcore.service

    $ systemctl edit pulpcore.service
  3. 将以下条目添加到 pulpcore.service 中,以确保自动化中心服务仅在启动网络并挂载远程挂载点后启动:

    [Unit]
    After=network.target var-lib-pulp.mount
  4. 启用 remote-fs.target

    $ systemctl enable remote-fs.target
  5. 重启系统:

    $ systemctl reboot

故障排除

pulpcore SELinux 策略中存在一个错误,可能会导致 etc/pulp/certs/ 中的令牌身份验证的公钥/私钥没有正确的 SELinux 标签,从而导致 pulp 进程失败。当发生这种情况时,运行以下命令临时附加正确的标签:

$ chcon system_u:object_r:pulpcore_etc_t:s0 /etc/pulp/certs/token_{private,public}_key.pem
注意

您必须重复此命令,以便在重新标记系统时重新附加正确的 SELinux 标签。

其它资源

法律通告

Copyright © 2023 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.