Skip to main content
本产品推出了新版本。
简体中文版经机器翻译而成,仅供参考。如与英语版出现任何冲突,应以英语版为准。

安装 Trident Protect CLI 插件

您可以使用 Trident Protect 命令行插件(Trident tridentctl 实用程序的扩展)来创建 Trident Protect 自定义资源(CR)并与之交互。

安装 Trident Protect CLI 插件

在使用命令行实用程序之前,需要将其安装在用于访问群集的计算机上。根据您的计算机使用的是 x64 还是 ARM CPU,请执行以下步骤。

为 Linux AMD64 CPU 下载插件
步骤
  1. 下载 Trident Protect CLI 插件:

    curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/26.02.0/tridentctl-protect-linux-amd64
为 Linux ARM64 CPU 下载插件
步骤
  1. 下载 Trident Protect CLI 插件:

    curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/26.02.0/tridentctl-protect-linux-arm64
下载适用于 Mac AMD64 CPU 的插件
步骤
  1. 下载 Trident Protect CLI 插件:

    curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/26.02.0/tridentctl-protect-macos-amd64
下载适用于 Mac ARM64 CPU 的插件
步骤
  1. 下载 Trident Protect CLI 插件:

    curl -L -o tridentctl-protect https://github.com/NetApp/tridentctl-protect/releases/download/26.02.0/tridentctl-protect-macos-arm64
  1. 为插件二进制文件启用执行权限:

    chmod +x tridentctl-protect
  2. 将插件二进制文件复制到 PATH 变量中定义的位置。例如, /usr/bin/usr/local/bin(您可能需要提升权限):

    cp ./tridentctl-protect /usr/local/bin/
  3. 或者,您可以将插件二进制文件复制到主目录中的某个位置。在这种情况下,建议确保该位置是 PATH 变量的一部分:

    cp ./tridentctl-protect ~/bin/
备注 将插件复制到 PATH 变量中的某个位置,可以通过键入 `tridentctl-protect`或 `tridentctl protect`从任何位置使用插件。

查看 Trident CLI 插件帮助

您可以使用内置插件帮助功能获取有关插件功能的详细帮助:

步骤
  1. 使用帮助功能查看使用指南:

    tridentctl-protect help

启用命令自动完成

安装 Trident Protect CLI 插件后,可以启用某些命令的自动完成功能。

启用 Bash shell 的自动完成
步骤
  1. 创建完成脚本:

    tridentctl-protect completion bash > tridentctl-completion.bash
  2. 在主目录中创建包含脚本的新目录:

    mkdir -p ~/.bash/completions
  3. 将下载的脚本移动到 ~/.bash/completions 目录:

    mv tridentctl-completion.bash ~/.bash/completions/
  4. 将以下行添加到主目录中的 ~/.bashrc 文件:

    source ~/.bash/completions/tridentctl-completion.bash
启用 Z shell 的自动完成
步骤
  1. 创建完成脚本:

    tridentctl-protect completion zsh > tridentctl-completion.zsh
  2. 在主目录中创建包含脚本的新目录:

    mkdir -p ~/.zsh/completions
  3. 将下载的脚本移动到 ~/.zsh/completions 目录:

    mv tridentctl-completion.zsh ~/.zsh/completions/
  4. 将以下行添加到主目录中的 ~/.zprofile 文件:

    source ~/.zsh/completions/tridentctl-completion.zsh
结果

下次登录 shell 时,您可以使用 tridentctl-protect 插件自动完成命令。