注意:
- 此教程位于 Oracle 提供的免费实验室环境中。
- 它对 Oracle Cloud Infrastructure 身份证明、租户和区间使用示例值。完成实验室后,请使用特定于云环境的那些值替换这些值。
在 Oracle Linux Automation Manager 上使用跃点节点
简介
Oracle Linux Automation Manager 支持基于上游 receptor 项目的服务网格技术。服务网格通过基于守护进程的受体应用程序将控制器、跳跃和执行节点链接到叠加网络。
Oracle Linux Automation Manager 在服务网格中引入了跃点节点。此节点类型允许以与 SSH 使用跳转主机相同的方式将任务从控制层节点中继到远程或受限网络上的执行节点。通过这种实现,作业可以在不同的执行节点之间运行,并将任务移到需要自动化的系统中。
下面的样例清单定义了免费实验室环境中的多节点集群部署。为了帮助在硬件上自动安装群集,请查看 ansible-playbooks 项目的 Oracle Linux Automation Manager 部分中的手册。
此样例清单创建一个集群,该集群由两个控制层节点、两个执行节点、一个具有单个远程执行节点的跃点节点和一个远程数据库组成。
此图显示了此集群的服务网格拓扑。
本教程展示了几种方法来检查服务网格的状态并确认各个节点之间的拓扑通信。
目标
在本教程中,您将学习如何:
- 列出控制层和执行节点的容量
- 查看给定集群节点的服务网格状态
- 使用 API 调用查看服务网格状态
先决条件
- 安装了 Oracle Linux Automation Manager 并配置了服务网格的集群
- Oracle Cloud Infrastructure (OCI) 账户
- OCI 账户中的用户,有权使用区间中的资源
- 访问该账户的身份证明和 OCID 信息
有关安装 Oracle Linux Automation Manager 的详细信息,请参见《Oracle Linux Automation Manager 安装指南》。
部署 Oracle Linux Automation Manager 实例
注:如果在您自己的租户中运行,请阅读 linux-virt-labs
GitHub 项目 README.md ,并在部署实验室环境之前完成先决条件。
-
在 Luna 桌面上打开一个终端。
-
克隆
linux-virt-labs
GitHub 项目。git clone https://github.com/oracle-devrel/linux-virt-labs.git
-
转到工作目录。
cd linux-virt-labs/olam
-
安装所需的集合。
ansible-galaxy collection install -r requirements.yml
-
更新 Oracle Linux 实例配置。
cat << EOF | tee instances.yml > /dev/null compute_instances: 1: instance_name: "olam-control-01" type: "control" 2: instance_name: "olam-control-02" type: "control" 3: instance_name: "olam-execution-01" type: "execution" 4: instance_name: "olam-execution-02" type: "execution" 5: instance_name: "olam-remote-execution-01" type: "execution" 6: instance_name: "olam-hop-01" type: "execution" 7: instance_name: "olam-db" type: "db" passwordless_ssh: true olam_type: none add_cluster_ports: true EOF
-
部署实验室环境。
ansible-playbook create_instance.yml -e ansible_python_interpreter="/usr/bin/python3.6" -e "@instances.yml"
免费实验室环境需要额外的变量
ansible_python_interpreter
,因为它为 Oracle Cloud Infrastructure SDK for Python 安装了 RPM 程序包。此软件包安装的位置位于 python3.6 模块下。默认部署配置使用 AMD CPU 和 Oracle Linux 8。要使用 Intel CPU 或 Oracle Linux 9,请将
-e instance_shape="VM.Standard3.Flex"
或-e os_version="9"
添加到部署命令。重要提示:等待剧本成功运行并进入暂停任务。Oracle Linux Automation Manager 安装在手册的此阶段已完成,并且实例已准备就绪。记下之前的播放,该播放输出所部署节点的公共和专用 IP 地址。
部署 Oracle Linux Automation Manager 集群
-
打开一个新的终端。
-
确保位于 linux-virt-labs 项目的 olam 目录中。
-
转换基本清单文件。
此转换脚本根据实例部署手册生成的基本清单创建与集群兼容的清单文件。
chmod +x convert_ansible_inventory.sh ./convert_ansible_inventory.sh hosts > hosts.cluster
-
运行集群部署手册。
ansible-playbook -i hosts.cluster deploy_olam_cluster.yml -e ansible_python_interpreter="/usr/bin/python3.6"
登录到 WebUI
-
打开终端并配置到 Oracle Linux Automation Manager 群集的 olam-control-01 实例的 SSH 隧道。
ssh -L 8444:localhost:443 oracle@<hostname_or_ip_address>
-
打开 Web 浏览器并输入 URL。
https://localhost:8444
注:根据使用的浏览器批准安全警告。单击 Chrome 的 **Advanced 按钮,然后单击 Proceed to localhost (unsafe) 链接。
-
使用在自动部署期间创建的 USERNAME
admin
和 PASSWORDadmin
登录到 Oracle Linux Automation Manager。 -
登录后,将显示 WebUI。
确认 WebUI 中的实例组
实例组允许根据策略对集群中的实例进行分组。这些策略确定实例组行为以及执行哪些作业。
-
单击导航菜单中管理下的实例组。
-
查看实例组页。
此页根据策略设置显示容量。有关这些策略设置的更多详细信息,请参见 Oracle Linux Automation Manager 用户指南文档的设置资源一章下的管理实例组。
可视化集群拓扑
-
单击导航菜单中管理部分下的拓扑视图。
-
查看拓扑视图页。
该页面显示了包含其每个节点的群集拓扑的图形布局。滚动节点显示从一个节点到另一个节点的箭头,指示其对等节点关联。
列出实例
使用 awx-manage
实用程序,管理员可以配置和列出与实例组(队列)关联的实例。管理员从集群中的任何控制层节点执行此操作。
-
切换到连接到 olam-control-01 实例的终端窗口。
-
登录到 Oracle Linux Automation Manager 用户帐户。
sudo su -l awx -s /bin/bash
-
列出实例。
awx-manage list_instances
输出示例:
[awx@olam-control-01 ~]$ awx-manage list_instances [controlplane capacity=594] 10.0.0.50 capacity=297 node_type=control version=23.7.0 heartbeat="2025-04-26 17:23:59" 10.0.0.52 capacity=297 node_type=control version=23.7.0 heartbeat="2025-04-26 17:23:59" [execution capacity=891] 10.0.0.57 capacity=297 node_type=execution version=23.7.0 heartbeat="2025-04-26 17:23:38" 10.0.0.59 capacity=297 node_type=execution version=23.7.0 heartbeat="2025-04-26 17:23:59" 10.0.0.61 capacity=297 node_type=execution version=23.7.0 heartbeat="2025-04-26 17:23:59" [ungrouped capacity=0] 10.0.0.53 node_type=hop heartbeat="2025-04-26 17:23:32"
输出显示
controlplane
和execution
队列以及每个关联的节点。跃点节点显示在ungrouped
队列中,因为它们未与包含容量的活动队列关联。 -
断开与 Oracle Linux Automation Manager 用户的连接。
exit
此操作应返回到 olam-control-01 实例上的 oracle 用户帐户。
显示服务网格状态
在服务网格运行时,可以获取服务网格和关联节点的状态。
-
获取服务网格的状态。
sudo receptorctl --socket /var/run/receptor/receptor.sock status
输出示例:
[oracle@olam-control-01 ~]$ sudo receptorctl --socket /var/run/receptor/receptor.sock status Node ID: 10.0.0.50 Version: 1.4.2 System CPU Count: 4 System Memory MiB: 31804 Connection Cost 10.0.0.59 1 10.0.0.61 1 10.0.0.53 1 Known Node Known Connections 10.0.0.50 10.0.0.53: 1 10.0.0.59: 1 10.0.0.61: 1 10.0.0.52 10.0.0.53: 1 10.0.0.59: 1 10.0.0.61: 1 10.0.0.53 10.0.0.50: 1 10.0.0.52: 1 10.0.0.57: 1 10.0.0.57 10.0.0.53: 1 10.0.0.59 10.0.0.50: 1 10.0.0.52: 1 10.0.0.61 10.0.0.50: 1 10.0.0.52: 1 Route Via 10.0.0.52 10.0.0.53 10.0.0.53 10.0.0.53 10.0.0.57 10.0.0.53 10.0.0.59 10.0.0.59 10.0.0.61 10.0.0.61 Node Service Type Last Seen Tags 10.0.0.50 control Stream 2025-04-26 17:29:26 {'type': 'Control Service'} 10.0.0.52 control Stream 2025-04-26 17:28:54 {'type': 'Control Service'} 10.0.0.61 control Stream 2025-04-26 17:28:54 {'type': 'Control Service'} 10.0.0.59 control Stream 2025-04-26 17:28:54 {'type': 'Control Service'} 10.0.0.53 control Stream 2025-04-26 17:28:32 {'type': 'Control Service'} 10.0.0.57 control Stream 2025-04-26 17:28:33 {'type': 'Control Service'} Node Work Types 10.0.0.50 local 10.0.0.52 local 10.0.0.61 ansible-runner 10.0.0.59 ansible-runner 10.0.0.53 local 10.0.0.57 ansible-runner
receptorctl
命令是前端 CLI,通过其控制套接字接口与服务网格进行交互。将--help
传递到receptorctl
命令将显示 CLI 选项和不同的命令。 -
运行从控制层节点到远程执行节点的跟踪器路由。
sudo receptorctl --socket /var/run/receptor/receptor.sock traceroute $(ssh olam-remote-execution-01 hostname -i)
输出示例:
[oracle@olam-control-01 ~]$ sudo receptorctl --socket /var/run/receptor/receptor.sock traceroute $(ssh olam-remote-execution-01 hostname -i) 0: 10.0.0.50 in 282.074µs 1: 10.0.0.53 in 817.948µs 2: 10.0.0.57 in 817.226µs
注:如果在输出中看到无法呈现的特殊字符,请通过单击菜单中的“终端”>“设置编码”>“Unicode”,将终端窗口中的编码切换到 UTF-8。
在上面的示例中,路由在第一个控制层节点上启动,通过跃点节点,并落在远程执行节点上。
在 WebUI 中检查服务网格状态
Oracle Linux Automation Manager API 使用 rest API 调用,该调用允许管理员查看有关服务网格集群中每个节点的状态信息。
-
切换到免费实验室环境中的浏览器窗口并输入 URL。
https://localhost:8444/api/login/
注:根据使用的浏览器批准安全警告。单击 Chrome 的 Advanced(高级)按钮,然后单击 Proceed to localhost (unsafe) 链接。
-
登录到 Oracle Linux Automation Manager REST API。使用在自动部署期间创建的用户名
admin
和密码admin
。 -
成功登录后将显示 REST API。
-
单击响应区域中的 /api/v2/ 超链接之一。
单击可执行 GET 请求并显示所有可用的 API 资源。
-
滚动到底部并单击 mesh_visualizer 链接。
-
查看输出结果。
请注意不同的节点及其特定的 node_type 。links 部分显示每个节点在服务网格中如何相互关联。
后续步骤
各种输出显示正在运行的集群,其中包含使用 Oracle Linux Automation Manager 运行剧本的跃点和执行节点。现在,请浏览 Oracle Linux Training Station 上的其他教程,运行几本手册并获得更多练习。
相关链接
Oracle Linux Automation Manager 文档
Oracle Linux Automation Manager 培训
Oracle Linux 培训站
更多学习资源
浏览 docs.oracle.com/learn 上的其他实验室,或者访问 Oracle Learning YouTube 渠道上的更多免费学习内容。此外,请访问 education.oracle.com/learning-explorer 成为 Oracle Learning Explorer。
有关产品文档,请访问 Oracle 帮助中心。
Use Hop Nodes on Oracle Linux Automation Manager
G33085-02
Copyright ©2023, Oracle and/or its affiliates.