3

telnet检查dubbo服务

 3 years ago
source link: https://www.wencst.com/archives/463
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

telnet检查dubbo服务

作者: wencst 分类: JAVA,linux,Uncategorized,windows 发布时间: 2017-01-22 15:46 阅读: 2,790 次

dubbo服务发布之后,我们可以利用telnet命令进行调试、管理。

Dubbo2.0.5以上版本服务提供端口支持telnet命令,下面我以 Windows为例 抛砖引玉一下:

1.连接服务

测试对应IP和端口下的dubbo服务是否连通,cmd命令如下

telnet localhost 20880

正常情况下,进入telnet窗口,键入回车进入dubbo命令模式。





2.查看服务列表

dubbo>ls

com.test.DemoService

查看服务中的接口

dubbo>ls com.test.DemoService

queryDemoPageList

insertDemolist

uploadDemoList

deleteDemolist

(list services and methods)

显示服务列表。

显示服务详细信息列表。

ls XxxService

显示服务的方法列表。

ls -l XxxService

显示服务的方法详细信息列表。

3.调用服务接口

调用接口时,以JSON格式传入参数(这点很方便 :-D),然后打印返回值和所用时间。

dubbo>invoke com.test.DemoService.queryDemoPageList({“id”:”100″}, 1, 2)

{“totalCount”:1,”data”:[{date”:”2011-03-23 14:10:32″,”name”:”张三”,”keyword”:null}]}

elapsed: 10 ms.

invoke

invoke XxxService.xxxMethod({“prop”: “value”})

调用服务的方法。

invoke xxxMethod({“prop”: “value”})

调用服务的方法(自动查找包含此方法的服务)。

4.查看服务状态

查看服务调用次数,不过比较奇怪的是,我刚才已经调用过一次queryDemoPageList了,而这里显示的为0(貌似不太准,有待进一步了解)

dubbo>count  com.test.DemoService

dubbo>

+————————-+——-+——–+——–+———+—–+

| method                  | total | failed | active | average | max |

+————————-+——-+——–+——–+———+—–+

| queryDemoPageList | 0     | 0      | 0      | 0ms     | 0ms |

| insertDemolist    | 0     | 0      | 0      | 0ms     | 0ms |

| uploadDemoList    | 0     | 0      | 0      | 0ms     | 0ms |

| deleteDemolist    | 0     | 0      | 0      | 0ms     | 0ms |

+————————-+——-+——–+——–+———+—–+

count

count XxxService

统计1次服务任意方法的调用情况。

count XxxService 10

统计10次服务任意方法的调用情况。

count XxxService xxxMethod

统计1次服务方法的调用情况。

count XxxService xxxMethod 10

统计10次服务方法的调用情况。

status

status

显示汇总状态,该状态将汇总所有资源的状态,当全部OK时则显示OK,只要有一个ERROR则显示ERROR,只要有一个WARN则显示WARN。

status -l

显示状态列表。

参考资料:

Telnet命令参考手册: http://alibaba.github.io/dubbo-doc-static/Telnet+Command+Reference-zh-showComments=true&showCommentArea=true.htm

来自为知笔记(Wiz)

本文链接: dubbo服务telnet命令 ,转载请注明。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK