第 7 章 将客户端注册到 Load Balancer
要平衡来自客户端的网络流量的负载,您必须将客户端注册到负载均衡器。
要注册客户端,请执行以下步骤之一:
7.1. 使用主机注册注册客户端
您可以使用主机注册功能、卫星 API 或 Hammer CLI 使用卫星注册主机。
流程
- 在 Satellite Web UI 中,导航到 Hosts > Register Host。
- 点击 Generate create registration 命令。
- 点击 文件 图标将命令复制到您的剪贴板中。
- 登录您要注册的主机并运行之前生成的命令。
更新
rhsm.baseurl
和server.hostname
的订阅管理器配置:# subscription-manager config \ --rhsm.baseurl=https://loadbalancer.example.com/pulp/content \ --server.hostname=loadbalancer.example.com
-
检查
/etc/yum.repos.d/redhat.repo
文件,并确保启用了适当的软件仓库。
CLI 过程
使用 Hammer CLI 生成主机注册命令:
# hammer host-registration generate-command \ --activation-keys "My_Activation_Key"
如果您的主机不信任 Satellite 服务器的 SSL 证书,您可以通过在注册命令中添加
--insecure
标志来禁用 SSL 验证。# hammer host-registration generate-command \ --activation-keys "My_Activation_Key" \ --insecure true
- 登录您要注册的主机并运行之前生成的命令。
更新
rhsm.baseurl
和server.hostname
的订阅管理器配置:# subscription-manager config \ --rhsm.baseurl=https://loadbalancer.example.com/pulp/content \ --server.hostname=loadbalancer.example.com
-
检查
/etc/yum.repos.d/redhat.repo
文件,并确保启用了适当的软件仓库。
API 流程
使用 Satellite API 生成主机注册命令:
# curl -X POST https://satellite.example.com/api/registration_commands \ --user "My_User_Name" \ -H 'Content-Type: application/json' \ -d '{ "registration_command": { "activation_keys": ["My_Activation_Key_1, My_Activation_Key_2"] }}'
如果您的主机不信任 Satellite 服务器的 SSL 证书,您可以通过在注册命令中添加
--insecure
标志来禁用 SSL 验证。# curl -X POST https://satellite.example.com/api/registration_commands \ --user "My_User_Name" \ -H 'Content-Type: application/json' \ -d '{ "registration_command": { "activation_keys": ["My_Activation_Key_1, My_Activation_Key_2"], "insecure": true }}'
使用激活码来简化指定环境。如需更多信息,请参阅管理内容 中的 激活码 。
要以命令行参数输入密码,请使用
username:password
语法。请记住,这可以在 shell 历史记录中保存密码。有关注册的更多信息,请参阅在 管理主机 中将主机注册到 Red Hat Satellite。
- 登录您要注册的主机并运行之前生成的命令。
更新
rhsm.baseurl
和server.hostname
的订阅管理器配置:# subscription-manager config \ --rhsm.baseurl=https://loadbalancer.example.com/pulp/content \ --server.hostname=loadbalancer.example.com
-
检查
/etc/yum.repos.d/redhat.repo
文件,并确保启用了适当的软件仓库。