分布式系列 - dubbo服務telnet命令【轉】
Dubbo2.0.5以上版本服務提供端口支持telnet命令,下面我以通過實例拋磚引玉一下:
1.連接服務
測試對應IP和端口下的dubbo服務是否連通,cmd命令如下
telnet localhost 20880
正常情況下,進入telnet窗口,鍵入回車進入dubbo命令模式。
2.查看服務列表
查看服務
dubbo>ls
com.test.DemoService
查看服務中的接口
dubbo>ls com.test.DemoService
queryDemoPageList
insertDemolist
uploadDemoList
deleteDemolist
ls
(list services and methods)
ls
顯示服務列表。
ls -l
顯示服務詳細信息列表。
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
轉自分布式系列 - dubbo服務telnet命令 - 秦鵬飛 - 博客園
https://www.cnblogs.com/feiqihang/p/4387330.html
參考
Dubbo命令行詳解 - CSDN博客
https://blog.csdn.net/qq_15958689/article/details/79171957
DUBBO功能使用說明 - 愛妻容易 - 博客園
https://www.cnblogs.com/php0368/p/4290791.html
Dubbo性能調優參數及原理 - cyfonly - 博客園
https://www.cnblogs.com/cyfonly/p/8987043.html
分布式系列 - dubbo服務telnet命令【轉】