停止和卸载云助手Agent

停止或卸载云助手Agent将导致控制台免密登录(会话管理、Workbench)、系统运维管理(OOS)命令执行和自助问题排查等功能无法使用。

停止云助手Agent

重要

如果实例正在使用会话管理或Workbench免密登录远程连接实例,会话将中断。请通过Workbench终端连接第三方客户端工具(SSH)VNC等方式远程连接实例。

Linux

  1. 远程连接Linux实例

  2. 停止云助手守护进程。

    云助手守护进程用于监控并保障云助手Agent的稳定性,若只停止Agent主服务,守护进程会尝试自动重启它。
    sudo /usr/local/share/assist-daemon/assist_daemon --stop
  3. 判断初始化系统类型。

    初始化系统(init system)负责在系统启动时加载和管理服务进程,不同初始化系统对应的云助手Agent的命令不同。
    • systemd:Alibaba Cloud Linux、CentOS 7+、RHEL 7+、Fedora 15+、Ubuntu 15.04+、Debian 8+等。

    • Upstart:Ubuntu 6.10-14.10、RHEL 6、CentOS 6等。

    • SysVinit:RHEL 5、CentOS 5、Debian 6等。

  4. 停止云助手Agent。

    systemd

    sudo systemctl stop aliyun.service
    
    # 验证服务是否已停止,若回执内容包含inactive (dead),表示服务已停止。
    sudo systemctl status aliyun.service

    Upstart

    sudo /sbin/initctl stop aliyun-service
    
    # 验证服务是否已停止,若回执内容为空,表示服务已停止。
    ps aux | grep -v grep | grep "aliyun-service"

    SysVinit

    sudo /etc/init.d/aliyun-service stop
    
    # 验证服务是否已停止,若回执内容为空,表示服务已停止。
    ps aux | grep -v grep | grep "aliyun-service"
    

Windows

方法一:通过Windows服务停止

  1. 远程连接Windows实例

  2. 单击开始菜单,选择Windows 管理工具 > 计算机管理

  3. 选择计算机管理(本地) > 服务和应用程序 > 服务

  4. 找到Aliyun Assist Service服务,单击停止此服务

    重启动此服务

方法二:通过Windows PowerShell停止

  1. 远程连接Windows实例

  2. 单击开始菜单,选择Windows PowerShell,右键单击Windows PowerShell,选择以管理员身份运行

  3. 停止云助手服务。

    Stop-Service -Name "AliyunService"
  4. 验证云助手Agent是否已停止。

    若回执内容的Status项为Stopped,表示已停止。

    Get-Service -Name "AliyunService"

卸载云助手Agent

重要

如果实例正在使用会话管理或Workbench免密登录远程连接实例,会话将中断。请通过Workbench终端连接第三方客户端工具(SSH)VNC等方式远程连接实例。

Linux

  1. 停止云助手Agent

  2. 删除云助手守护进程。

    sudo /usr/local/share/assist-daemon/assist_daemon --delete
  3. 卸载软件包。

    • RPM:适用于Alibaba Cloud Linux、CentOS、Red Hat Enterprise Linux (RHEL)、Fedora、Rocky Linux、openSUSE等。

    • DEB:适用于Debian、Ubuntu等。

      RPM

      sudo rpm -qa | grep aliyun_assist | xargs sudo rpm -e

      DEB

      sudo apt-get purge -y aliyun-assist
  4. 清理残留文件与服务配置。

    sudo rm -rf /usr/local/share/aliyun-assist
    sudo rm -rf /usr/local/share/assist-daemon
    sudo rm -f /etc/systemd/system/aliyun.service
    sudo rm -f /etc/init.d/aliyun-service
  5. 验证云助手Agent是否卸载完成。

    若回执内容为空,表示进程不存在,云助手Agent已被成功卸载。

    ps aux | grep -v grep | grep "aliyun-service"

Windows

方法一:通过Windows界面操作

  1. 停止云助手Agent

  2. 在页面顶部勾选隐藏的项目,删除C:\ProgramData\aliyun\assist目录。

    d5c8f2f19778bba6247adb09143d4d1a

方法二:通过Windows PowerShell 操作

  1. 远程连接Windows实例

  2. 单击开始菜单,选择Windows PowerShell,右键单击Windows PowerShell,选择以管理员身份运行

  3. 关闭云助手进程。

    Stop-Service -Name "AliyunService" -Force
  4. 删除安装目录和注册表。

    # 删除安装目录
    Remove-Item -Path "C:\ProgramData\aliyun\assist" -Recurse -Force
    
    # 删除注册表
    Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\AliyunService" -Recurse -Force
  5. 验证云助手Agent是否卸载完成。

    若回执内容为空或者包含Cannot find any service with service name 'AliyunService'提示,表示已成功卸载。

    Get-Service -Name "AliyunService"

常见问题

云助手Agent停止后,如何重新启动?

Linux

  1. 远程连接Linux实例

  2. 启动云助手守护进程。

    sudo /usr/local/share/assist-daemon/assist_daemon --start
  3. 判断初始化系统类型。

  4. 启动云助手Agent。

    systemd

    sudo systemctl start aliyun.service
    
    # 验证服务是否启动,若回执内容包含active (running),表示启动成功。
    sudo systemctl status aliyun.service

    Upstart

    sudo /sbin/initctl start aliyun-service
    
    # 验证服务是否启动成功,若回执内容不为空,表示启动成功。
    ps aux | grep -v grep | grep "aliyun-service"

    SysVinit

    sudo /etc/init.d/aliyun-service start
    
    # 验证服务是否启动成功,若回执内容不为空,表示启动成功。
    ps aux | grep -v grep | grep "aliyun-service"

Windows

方法一:通过Windows服务启动

  1. 远程连接Windows实例

  2. 单击开始菜单,选择Windows 管理工具 > 计算机管理

  3. 选择计算机管理(本地) > 服务和应用程序 > 服务

  4. 找到Aliyun Assist Service服务,单击启动此服务

    image

方法二:通过Windows PowerShell启动

  1. 远程连接Windows实例

  2. 单击开始菜单,选择Windows PowerShell,右键单击Windows PowerShell,选择以管理员身份运行

  3. 启动云助手Agent服务。

    Start-Service -Name "AliyunService"
  4. 验证云助手Agent是否启动成功。

    若回执内容的Status项为Running,表示启动成功。

    Get-Service -Name "AliyunService"

相关文档