介绍

Goodrain datacenter controller util - A new cli application。通过此命令可以获取应用运行详细信息、计算节点信息、租户应用信息以及操作容器。
grctl命令优点:
1.可以快速获取应用运行信息
2.可以获取计算节点信息
3.可以获取租户应用信息
4.可以便捷调试应用

安装

默认集成在云帮中

命令

grctl [global options] command [command options] [arguments...]

COMMANDS:
     exec     进入容器方法。grctl exec POD_NAME COMMAND
     get      获取应用运行详细信息。grctl get PATH
     log      获取服务的日志。grctl log SERVICE_ID
     node     获取计算节点信息
     tenant   获取租户应用(包括未运行)信息。 grctl tenant TENANT_NAME
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config FILE, -c FILE        Load configuration from FILE (default: "/etc/goodrain/grctl.json")
   --region.url value, -u value  Region api url. to form region get other config (default: "http://region.goodrain.me:8888")
   --help, -h                    show help
   --version, -v                 print the version

使用

get命令

NAME:
   grctl get - 获取应用运行详细信息。grctl get PATH

USAGE:
   grctl get [command options] [arguments...]

OPTIONS:
   --url value  URL of the app. eg. https://user.goodrain.com/apps/goodrain/dev-debug/detail/
 
通过此命令可以获取容器ip(podip)、容器所在节点(PodHostIP)、容器状态

例子:
应用URL可以是完整的URL地址(如:https://user.goodrain.com/apps/goodrain/dev-debug/detail/),也可以租户名+应用别名(如:goodrain/dev-debug)

root@ali-sh-rain01:~# grctl get https://user.goodrain.com/apps/goodrain/dev-debug/detail/
Namespace:          	b7584c080ad24fafaa812a7739174b50
ServiceID:          	f398048d1a2998b05e556330b05ec1aa
RcName:             	6e91345d7f3b67aae9274d47f687098b
RcCreateTime:       	2017-04-17T14:27:51+08:00
PodNumber:          	0/1
K8sServiceName:     	service74d47f687098b5000
K8sServiceClusterIP:	11.1.213.143
K8sServicePorts:    	(TCP:5000)
-------------------Pod_0-----------------------
PodName:      	6e91345d7f3b67aae9274d47f687098b-a0000
PodStatus:    	Running
PodIP:        	192.168.0.38
PodHostIP:    	10.0.4.17
PodHostName:  	10.0.4.17
PodVolumePath:	/grdata/tenant/b7584c080ad24fafaa812a7739174b50/service/f398048d1a2998b05e556330b05ec1aa
PodStratTime: 	2017-04-17T14:27:51+08:00
Containers:
+--------------+----------------------------------+--------------------+---------------------------+
| ID           | Name                             | Image              | State                     |
+--------------+----------------------------------+--------------------+---------------------------+
| f41bc20ef8d0 | f398048d1a2998b05e556330b05ec1aa | goodrain.me/runner | 2017-04-17T14:27:55+08:00 |
+--------------+----------------------------------+--------------------+---------------------------+

exec命令

NAME:
   grctl exec - 进入容器方法。grctl exec POD_NAME COMMAND

USAGE:
   grctl exec [arguments...]

例子:
POD_NAME可以通过grctl get 应用URL获取

root@ali-sh-rain01:~# grctl exec 6f92b39f54b7a86d1f1f01d15e7eb213-a0000 ls
Godeps	Procfile  bin  conf  hello.go  vendor

log命令

NAME:
   grctl log - 获取服务的日志。grctl log SERVICE_ID

USAGE:
   grctl log [command options] [arguments...]

OPTIONS:
   -f  添加此参数日志持续输出。

例子:

root@ali-sh-rain01:~# grctl log f398048d1a2998b05e556330b05ec1aa
f41bc20ef8d0: 10.0.4.12 - - [24/Apr/2017:01:02:47 +0800] "GET / HTTP/1.0" 302 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36"

tenant命令

NAME:
   grctl tenant - 获取租户应用(包括未运行)信息。 grctl tenant TENANT_NAME

USAGE:
   grctl tenant [arguments...]

例子:

root@ali-sh-rain01:~# grctl tenant admail
+----------------------------------+----------------------------------+----------+
| 租户ID                           | 服务ID                           | 服务别名 |
+----------------------------------+----------------------------------+----------+
| bf952b88223a44d7adbd260af7b6296d | 9af1bc7cb64827813912ea8d3232013b | gr32013b |
| bf952b88223a44d7adbd260af7b6296d | c0d38160d0c8b3147a46710a8d906e7e | gr906e7e |
| bf952b88223a44d7adbd260af7b6296d | 162187346b7bf0edb534dac0c2c23d50 | grc23d50 |
+----------------------------------+----------------------------------+----------+