這里記錄一個spring cloud的模板,有的模塊spring cloud eureka + spring boot admin + spring cloud zuul + 一個普通spring cloud服務service -A
eureka-server:注冊中心,api-gateway:網關,Admin-Server:spring boot admin的服務端,Service-A:普通服務A
1、注冊中心
在瀏覽器中輸入localhost:1111,然后輸入waterlufei,123456就可以看到注冊中心
注冊中心這一塊,允許自己注冊(便於adminserver監控到),關閉服務安全保護,開啟權限控制
2、普通服務
訪問localhost:4445/test能返回接口數據hahah,訪問localhost:4445能夠看到我們自己寫的主頁
3、服務網關
訪問localhost:2222/api-a/test能返回接口數據hahah,訪問localhost:2222/api-a/能夠看到我們自己寫的主頁,實現了通過網關訪問
4、admin服務端
訪問localhost:9527,輸入waterlufei,9527能夠看到性能監控頁面
隨便點進去一個可以看到服務的各種性能日志等
需要注意的:
1.如果需要看到log選項,需要在服務的配置文件中,指定生成日志文件
2.admin-server指定的服務名稱必須都是小寫
github源碼地址:https://github.com/waterlufei/spring-cloud