首选方法是使用launchd将 Agent 作为服务加载。在安装过程中选择“作为服务安装”后,您可以使用以下命令启动或停止代理服务。
要启动代理:
$> sudo launchctl load /Library/LaunchDaemons/mysql.agent.plist要停止代理:
$> sudo launchctl unload /Library/LaunchDaemons/mysql.agent.plist
或者,用于在 macOS 上启动代理的 init.d 脚本位于该
/Applications/mysql/enterprise/agent/etc/init.d
目录中。要启动代理,请导航到此目录并在命令行键入:
$> ./mysql-monitor-agent start
要停止代理,请使用以下stop命令:
$> ./mysql-monitor-agent stop
如果由于找不到包含代理进程 ID 的文件而无法停止
pid代理,则可以使用kill向正在运行的进程发送TERM信号:
$> kill -TERM PID
如果您在一台特定机器上运行多个代理程序,您还必须ini在停止代理程序时指定该文件的路径。mysql-monitor-agent stop在没有
文件的情况下执行
ini只会停止与默认文件关联的代理ini。
要验证代理是否正在运行,请使用以下命令:
$> ./mysql-monitor-agent statusThe resulting message indicates whether the agent is running. If the agent is not running, use the following command to view the last ten entries in the general Agent log file:
$> tail /Applications/mysql/enterprise/agent/logs/mysql-monitor-agent.logFor further information on troubleshooting the agent, see Section 5.10, “Troubleshooting the Agent”.
Installation creates the directory
/Applications/mysql/enterprise/agent, and
the logs directory is located immediately
below the agent directory.
To see all the command-line options available when running the
monitor agent, navigate to the
/Applications/mysql/enterprise/agent/etc/init.d
directory and execute
mysql-monitor-agent
help, which displays the usage message:
$> ./mysql-monitor-agent {start|stop|restart|status}
To report its findings, the agent connects to the Monitor UI
through the port specified during installation. The default
value for this port is 18443; ensure that
this port is not blocked. To troubleshoot the agent
installation, see
Section 5.10, “Troubleshooting the Agent”.