天天看點

Dubbo服務調試管理實用指令

Dubbo2.0.5以上版本服務提供端口支援telnet指令,下面我通過執行個體抛磚引玉一下:

1.連接配接服務

測試對應IP和端口下的dubbo服務是否連通,cmd指令如下

Dubbo服務調試管理實用指令

dubbo>ls com.test.DemoService

queryDemoPageList

insertDemolist

uploadDemoList

deleteDemolist      

ls

(listservices and methods)

顯示服務清單。

ls -l

顯示服務詳細資訊清單。

lsXxxService

顯示服務的方法清單。

ls -lXxxService

顯示服務的方法詳細資訊清單。

3.調用服務接口

調用接口時,以JSON格式傳入參數(這點很友善 :-D),然後列印傳回值和所用時間。

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

{"totalCount":1,"data":\[{date":"2011-03-2314:10:32","name":"張三","keyword":null}\]}

elapsed: 10 ms.      

invoke

invokeXxxService.xxxMethod({"prop":"value"})

調用服務的方法。

invokexxxMethod({"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

countXxxService

統計1次服務任意方法的調用情況。

countXxxService 10

統計10次服務任意方法的調用情況。

countXxxService xxxMethod

統計1次服務方法的調用情況。

countXxxService xxxMethod 10

統計10次服務方法的調用情況。

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

推薦去我的部落格閱讀更多:

1.Java JVM、集合、多線程、新特性系列教程

2.Spring MVC、Spring Boot、Spring Cloud 系列教程

3.Maven、Git、Eclipse、Intellij IDEA 系列工具教程

4.Java、後端、架構、阿裡巴巴等大廠最新面試題

覺得不錯,别忘了點贊+轉發哦!