请按照以下步骤使用非 admin 用户帐户通过 SSH 访问 NSX Advanced Load Balancer CLI。
在该示例中,非 admin 用户还配置为超级用户。
打开 SSH 客户端并使用 cli@<Avi Controller IP> 命令。将 NSX Advanced Load Balancer 控制器 IP 替换为需要访问的控制器 IP。
在提示输入用户名时,请提供凭据。在下面的示例中,使用了一个用户名为 testuser 的用户帐户,该帐户还在 NSX Advanced Load Balancer 上配置为超级用户。
Using username "cli". Avi Cloud Controller Avi Networks software, Copyright (C) 2013-2017 by Avi Networks, Inc. All rights reserved. Version: 17.1.8 Date: 2017-09-21 06:03:07 UTC Build: 9020 Management: 10.10.1.1/23 UP Gateway: 10.10.1.1 UP The copyrights to certain works contained in this software are owned by other third parties and used and distributed under license. Certain components of this software are licensed under the GNU General Public License (GPL) version 2.0 or the GNU Lesser General Public License (LGPL) Version 2.1. A copy of each such license is available at http://www.opensource.org/licenses/gpl-2.0.php and http://www.opensource.org/licenses/lgpl-2.1.php Last login: Fri Oct 27 10:32:02 2017 from 10.10.8.11 Launching a CLI shell in a container No handlers could be found for logger "docker.auth.auth" Login: testuser Password:
在提供密码后(如上面的 CLI 片段中所示),您即可访问 NSX Advanced Load Balancer Shell。
[admin:avi-controller]: >
从 NSX Advanced Load Balancer Shell 提示符中,您可以运行所有 show 命令和 Shell 命令。
使用超级用户帐户检查日志
使用前面步骤中提到的帐户通过 attach controller <controller-ip> 命令转到 linux bash 提示符。由于这是一个没有持久性存储的容器,在使用 ls 命令时,不会显示任何日志文件。
[admin:avi-controller]: > bash root@04de723c268a:/# root@04de723c268a:/# cd /opt root@04de723c268a:/opt# ls root@04de723c268a:/opt# <- No directory in /opt as seen here
使用 avidebuguser 用户名
可以使用 attach <Avi Controller IP> 命令,将非 admin 用户(也是超级用户)与 NSX Advanced Load Balancer 控制器 相关联。这会为 avidebuguser 用户提供控制器容器访问权限。avidebuguser 也是 sudo 用户。只有在用户(本地或远程)配置为超级用户时,才能使用 Attach 选项。
[admin:avi-controller]: > attach controller 10.10.1.10 No handlers could be found for logger "root" Warning: Permanently added '10.10.1.10' (ECDSA) to the list of known hosts. Avi Cloud Controller Avi Networks software, Copyright (C) 2013-2017 by Avi Networks, Inc. All rights reserved. Version: 17.1.8 Date: 2017-09-21 06:03:07 UTC Build: 9020 Management: 10.10.1.10/23 UP Gateway: 10.10.1.1 UP Esx and OpenstackWelcome, this is your controller!!! The copyrights to certain works contained in this software are owned by other third parties and used and distributed under license. Certain components of this software are licensed under the GNU General Public License (GPL) version 2.0 or the GNU Lesser General Public License (LGPL) Version 2.1. A copy of each such license is available at http://www.opensource.org/licenses/gpl-2.0.php and http://www.opensource.org/licenses/lgpl-2.1.php Last login: Fri Oct 27 10:32:36 2017 from 172.17.0.2 avidebuguser@avi-controller:~$
使用 ls 命令检查日志文件,如下所示。
avidebuguser@avi-controller-2:/opt$ ls *avi zookeeper-3.4.6*
avidebuguser@avi-controller-2:/opt/avi/log$ pwd /opt/avi/log
附加信息
有关 NSX Advanced Load Balancer Linux CLI 和 NSX Advanced Load Balancer CLI 访问的更多信息,请参阅 CLI - Linux 命令行模式和访问设置。