Synchronization CLI Tools
要在服务器容器内访问外壳,请在容器主机上运行 |
There are two tools for synchronizing clients to the server. For clients that are connected to the SUSE Customer Center, use mgr-sync
. For all other clients, use spacewalk-repo-sync
.
1. Synchronize SCC Repositories With mgr-sync
The primary use of mgr-sync
is to connect to the SUSE Customer Center, retrieve product and package information, and prepare channels for synchronization with the SUSE Manager Server.
此工具应与 SUSE 支持订阅配合使用。openSUSE、CentOS 和 Ubuntu 等开源发行套件不需要此工具。
下表中列出了 mgr-sync
的可用命令和参数。请对 mgr-sync
命令使用以下语法:
mgr-sync [-h] [--version] [-v] [-s] [-d {1,2,3}] {list,add,refresh,delete}
命令 | 说明 | 示例用法 |
---|---|---|
list |
列出通道、组织身份凭证或产品 |
|
add |
添加通道、组织身份凭证或产品 |
|
refresh |
刷新产品、通道和订阅的本地副本 |
|
delete |
从本地系统中删除现有的 SCC 组织身份凭证 |
|
sync |
同步指定的通道,如果将通道名称留空,则请求提供名称 |
|
要查看特定于某个命令的完整选项列表,请使用以下命令:
mgr-sync <命令> --help
选项 | 选项缩写 | 说明 | 示例用法 |
---|---|---|---|
help |
|
显示命令用法和选项 |
|
version |
不适用 |
显示当前安装的 |
|
verbose |
|
提供详细输出 |
|
store-credentials |
|
将身份凭证存储在本地隐藏文件中 |
|
debug |
|
记录附加调试信息。需要指定级别 1、2、3。3 提供的调试信息量最多 |
|
no-sync |
不适用 |
与 |
|
mgr-sync
的日志位于:
-
/var/log/rhn/mgr-sync.log
-
/var/log/rhn/rhn_web_api.log
2. Synchronize Repositories with spacewalk-repo-sync
The spacewalk-repo-sync
tool synchronizes software repositories into SUSE Manager channels. In most cases, this happens automatically, but you can use the tool to run it manually if required.
The spacewalk-repo-sync
tool has these primary commands:
Option | Description | Example Use |
---|---|---|
list |
List all custom channels and the repositories assigned to them. |
|
channel |
Synchronize a single channel to all repositories assigned to it. |
|
deep-verify |
ignore cached package checksums. |
|
force-all-errata |
force re-importing all the patches. |
|
no-packages |
excludes packages from the operation. |
|
For a complete list of options, see the spacewalk-repo-sync
manpage:
man spacewalk-repo-sync
3. 同步查错
If you are having trouble synchronizing with spacewalk-repo-sync
you can find out more by watching the HTTP log as the command runs.
-
Log the HTTP output into
/var/log/zypper.log
:ZYPP_MEDIA_CURL_DEBUG=2 spacewalk-repo-sync --channel <channel-label>
-
Export the setting:
export URLGRABBER_DEBUG=DEBUG
-
Start the synchronization:
/usr/bin/spacewalk-repo-sync --channel <channel-label> --type yum
You can increase the debug level, by adding the [option]``-vvv`` option to the command.
-
When the complete completes, or fails, disable debug mode:
unset URLGRABBER_DEBUG
3.1. Add Custom Extra HTTP Headers
You can add custom HTTP headers to the requests made by spacewalk-repo-sync
at the time of synchronization. The custom HTTP headers are defined in the /etc/rhn/spacewalk-repo-sync/extra_headers.conf
configuration file. The headers can be defined by repository name or channel label. You can also define global headers by putting them in the main
section. For example:
[testchannel] X-MY-HEADER-1=VALUE X-MY-HEADER-2=VALUE [mychannel] X-MY-HEADER-3=VALUE X-MY-HEADER-4=VALUE [main] X-MYGLOBAL-HEADER=VALUE
This can be particularly useful when dealing with Red Hat Update Infrastructure (RHUI) repositories in the public cloud.