# 9.1 运行和部署

Juno Agent管理了节点信息、注册信息、配置信息、探活信息、消息总线等功能。

# 9.1.1 部署Agent模式

我们有两种运行Juno-Agent的模式:Client模式和Server模式。

  • Client模式:该模式需要我们将Agent部署到每个应用的节点上,这样我们的Juno-Agent,可以获取更多应用的信息,例如机器上的启动信息,还可以执行HShell指令,帮助我们排查线上问题。
  • Server模式:该模式需要我们将多个Agent组成一个Server进行部署,虽然这种模式,有部分组件功能无法启用,但是这种模式下,我们可以更方便的部署我们的Agent,减少我们的运维成本。

# 9.1.2 运行一个Agent

Juno-Agent可以通过命令行启动。当Juno-Agent运行后,你可以看到以下输出


   (_)_   _ _ __ (_) |_ ___ _ __
   | | | | | '_ \| | __/ _ \ '__|
   | | |_| | |_) | | ||  __/ |
  _/ |\__,_| .__/|_|\__\___|_|
 |__/      |_|
 
 Welcome to jupiter, starting jupiter ...

1590412508      INFO    load local file                         {"mod": "config", "addr": "./config/config-live.toml"}
1590412508      INFO    auto max procs                          {"mod": "proc", "procs": 4}
1590412508      INFO    plugin                                  {"reportAgentStatus": "start"}
1590412508      INFO    plugin                                  {"process": "start"}
1590412508      INFO    plugin                                  {"appConf.etcd": "start"}
1590412508      INFO    dial etcd server                        {"mod": "client.etcd", "addr": ["wsd-projecta-etcd-cc.pre.unp.oyw:2379"]}
1590412508      ERROR   init get update error                   {"plugin": "confProxy", "msg": "key check: port empty", "hostKey": "/Juno-agent/ubuntu", "err": "key check: port empty"}
1590412508      ERROR   init get update error                   {"plugin": "confProxy", "msg": "open /home/www/server: is a directory", "hostKey": "/Juno-agent/ubuntu", "err": "open /home/www/server: is a directory"}
1590412508      INFO    dial etcd server                        {"mod": "client.etcd", "addr": ["wsd-projecta-etcd-rd.pre.unp.oyw:2379"]}
1590412508      INFO    plugin                                  {"supervisorScanner": "start"}
1590412508      ERROR   fsnotify add dir err                    {"msg": "no such file or directory"}
1590412508      INFO    plugin                                  {"systemdScanner": "start"}
1590412508      ERROR   SystemdScanner add dir err              {"err": "no such file or directory"}
1590412508      INFO    plugin                                  {"healCheck": "start"}
1590412508      INFO    start governor                          {"mod": "app", "addr": "http://127.0.0.1:9099"}
1590412508      INFO    start servers                           {"mod": "app", "addr": "http://0.0.0.0:50000"}
1590412508      INFO    start servers                           {"mod": "app", "addr": "grpc://0.0.0.0:50001"}
1590412508      INFO    echo add route                          {"mod": "server.echo", "method": "POST", "path": "/api/v1/conf/command_line/status"}
1590412508      INFO    echo add route                          {"mod": "server.echo", "method": "GET", "path": "/api/v1/agent/config"}
1590412508      INFO    echo add route                          {"mod": "server.echo", "method": "GET", "path": "/api/agent/reload"}
1590412508      INFO    echo add route                          {"mod": "server.echo", "method": "GET", "path": "/api/agent/process/status"}
1590412508      INFO    echo add route                          {"mod": "server.echo", "method": "GET", "path": "/api/process/status"}
1590412508      INFO    echo add route                          {"mod": "server.echo", "method": "POST", "path": "/api/agent/process/shell"}
1590412508      INFO    echo add route                          {"mod": "server.echo", "method": "GET", "path": "/api/v1/agent/:target"}
⇨ http server started on [::]:50000

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

以下为输出的描述:

  • Info: 输出Agent的基本信息。
  • Plugin: 输出Agent启动的组件
  • Server: 输出Agent提供的服务