附註:
- 此教學課程可在 Oracle 提供的免費實驗室環境中取得。
- 它使用 Oracle Cloud Infrastructure 證明資料、租用戶及區間的範例值。完成實驗室時,請將這些值取代為您雲端環境特定的值。
在 Oracle Linux Automation Manager 上使用躍點節點
簡介
Oracle Linux Automation Manager 支援基於上游接收者專案的服務網格技術。服務網格透過常駐程式式的接收器應用程式,將控制器、躍點以及執行節點連結至覆疊網路。
Oracle Linux Automation Manager 在服務網狀組織中導入躍點節點。此節點類型允許作業從控制層節點轉送至遠端或受限制網路上的執行節點,與 SSH 使用跳躍主機的方式相同。此實作可讓工作在不同的執行節點間執行,並將工作更接近需要自動化的系統。
下方的範例產品目錄定義免費實驗室環境中的多節點叢集部署。若要協助將硬體上的叢集安裝自動化,請查看 ansible-playbooks 專案中 Oracle Linux Automation Manager 區段的手冊。
此範例產品目錄會建立由兩個控制層節點、兩個執行節點、一個含有單一遠端執行節點的躍點節點,以及一個遠端資料庫組成的叢集。
此影像顯示此叢集的服務網狀組織拓樸。
此教學課程顯示檢查服務網狀組織狀態和確認各種節點之間拓樸通訊的多種方法。
目標
在本教學課程中,您將瞭解如何:
- 列出控制層和執行節點的容量
- 檢視指定叢集節點的服務網狀組織狀態
- 使用 API 呼叫檢視服務網狀組織狀態
必要條件
- 已安裝 Oracle Linux Automation Manager 且已設定 Service Mesh 的叢集
- Oracle Cloud Infrastructure (OCI) 帳戶
- OCI 帳戶中具備使用區間中資源權限的使用者
- 存取該帳戶的證明資料和 OCID 資訊
如需有關安裝 Oracle Linux Automation Manager 的詳細資訊,請參閱 Oracle Linux Automation Manager Installation Guide (僅英文版)。
部署 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
-
開啟終端機,然後將 SSH 通道設定為 Oracle Linux Automation Manager 叢集的 olam-control-01 執行處理。
ssh -L 8444:localhost:443 oracle@<hostname_or_ip_address>
-
開啟 Web 瀏覽器並輸入 URL。
https://localhost:8444
注意:根據使用的瀏覽器來核准安全警告。按一下 Chrome 的 **Advanced 按鈕,然後按一下繼續 localhost (不安全) 連結。
-
使用 USERNAME
admin
與自動部署期間建立的 PASSWORDadmin
登入 Oracle Linux Automation Manager。 -
登入之後,會顯示 WebUI。
確認 WebUI 中的執行處理群組
「執行處理群組」允許根據原則將叢集內的執行處理分組。這些原則會決定執行處理群組行為,以及執行哪些工作。
-
按一下導覽功能表中管理底下的執行處理群組。
-
複查執行處理群組頁面。
此頁面會根據原則設定值顯示容量。請參閱 Oracle Linux Automation Manager User's Guide 文件中 Setting Up Resources 章節的管理執行處理群組,瞭解這些原則設定值的詳細資訊。
視覺化叢集拓樸
-
按一下導覽功能表中管理段落底下的拓樸檢視。
-
複查拓樸檢視頁面。
此頁面顯示叢集拓樸的圖形版面配置,其中包含叢集的每個節點。累計節點會顯示從一個節點到另一個節點的箭號,表示其對等關聯。
列出執行處理
管理員可以使用 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。
在上述範例中,路由開始於第一個控制層節點、通過 hop 節點以及在遠端執行節點上執行。
檢查 WebUI 中的服務網狀組織狀態
Oracle Linux Automation Manager API 使用其餘的 API 呼叫,可讓管理員檢視服務網狀組織叢集中每個節點的狀態資訊。
-
切換至免費實驗室環境中的瀏覽器視窗,然後輸入 URL。
https://localhost:8444/api/login/
注意:根據使用的瀏覽器來核准安全警告。按一下 Chrome 的進階按鈕,然後按一下繼續 localhost (不安全) 連結。
-
登入 Oracle Linux Automation Manager REST API。使用自動部署期間建立的使用者名稱
admin
和密碼admin
。 -
REST API 會在成功登入後顯示。
-
按一下回應區域中的其中一個 /api/v2/ 超連結。
按一下即可執行 GET 要求並顯示所有可用的 API 資源。
-
捲動至底部,然後按一下 mesh_visualizer 連結。
-
查看整個輸出。
請注意不同的節點及其特定的 node_type 。連結區段顯示每個節點在服務網狀組織中的關聯性。
接下來的步驟
各種輸出都會顯示一個執行中的叢集,其中含有使用 Oracle Linux Automation Manager 執行手冊的躍點和執行節點。現在,瀏覽 Oracle Linux 訓練站的其他教學課程,即可瀏覽並執行幾本手冊並進行其他練習。
相關連結
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 Help Center 。
Use Hop Nodes on Oracle Linux Automation Manager
G33086-02
Copyright ©2023, Oracle and/or its affiliates.