監視するために、2つのプロジェクトを必要とし、1は、プロジェクトの春ブーツを監視する責任管理サーバー側は、あり、そしてもう一方の端は、それが春のブートサービス監視されている管理クライアントです。
管理サーバー端
最初のpom.xmlプロファイル依存インポート機能。
1の<?xml version = "1.0"エンコード= "UTF-8"?> 2 <プロジェクトのxmlns = "http://maven.apache.org/POM/4.0.0" 3 のxmlns:XSI = "のhttp:// www.w3.org/2001/XMLSchema-instance " 4 のxsi:schemaLocationの=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0 .xsd "> 5 <modelVersion> 4.0.0 </ modelVersion> 6 7 <groupIdを>管理者</ groupIdを> 8 <たartifactId>管理者</たartifactId> 9 <バージョン> 1.0-SNAPSHOT </バージョン> 10 11 <親> 12 <groupIdを> org.springframework。 ブート</ groupIdを> 13 <たartifactId>ばねブートスタータ親</たartifactId> 14 <バージョン> 2.1.6.RELEASE </バージョン> 15 </親> 16 17 <依存性> 18 <依存性> 19 <のgroupId> org.springframework.boot </ groupIdを> 20 <たartifactId>ばねブートスタータウェブ</たartifactId> 21 <バージョン> 2.1.6.RELEASE </バージョン> 22 </依存> 23 24 <依存性> 25 <のgroupId> de.codecentric < / groupIdを> 26 < たartifactId>春・ブート・管理・スターター・サーバー</たartifactId> 27 <バージョン> 2.1.6 </バージョン> 28 </依存> 29 30 <! -监控- > 31 <依存性> 32 <のgroupId> org.springframework.boot </ groupIdを> 33 <たartifactId>ばねboot-スタータアクチュエータ</たartifactId> 34 </依存> 35 36 <依存性> 37 <のgroupId> de.codecentric </ groupIdを> 38 <たartifactId>ばねブート管理サーバ-UI </たartifactId> 39 <バージョン> 2.0 0.1 </バージョン> 40 < /依存> 41 </依存関係> 42 </プロジェクト>
次に、設定ファイルを書きapplication.yml
1 :春 2 アプリケーション: 3 名:ADMIN- サーバ 4 サーバ: 5 ポート:9090
最後に、プロジェクト全体のメインクラスを埋めます
1つの パッケージCY; 2 3 インポートde.codecentric.boot.admin.server.config.EnableAdminServer。 4 インポートorg.springframework.boot.SpringApplication。 5 輸入org.springframework.boot.autoconfigure.SpringBootApplication。 6 7 @SpringBootApplication 8 @EnableAdminServer 9 10 パブリック クラスTestApplication { 11 公共 静的 ボイドメイン(文字列[]引数){ 12 SpringApplication.run(TestApplication。クラス、引数)。 13 14 } 15 }
そして、入力 HTTPを:// localhostを:9090 / 以下のインタフェースが完了しているサーバー側の第1のステップを表してご覧ください。
管理クライアントの終了
プロジェクトファイルを監視するためのpom.xmlファイルに次の依存関係を追加します。
1 <依存性> 2 <依存性> 3 <のgroupId> de.codecentric </ groupIdを> 4 <たartifactId>ばねブート管理スタータクライアント</たartifactId> 5 <バージョン> 2.1.0 </バージョン> 6 </依存関係> 7 </依存関係>
あなたがapplication.ymlを設定している場合は、設定ファイルには、2つのカテゴリに分類されています
1 // application.yml 2 サーバー: 3 ポート:8080 4 春: 5 アプリケーション: 6 名:管理クライアント 7 のブート: 8 管理: 9 クライアント: 10 URL:のhttp:// localhostを:9090 11 マネジメント: 12の エンドポイント: 13 ウェブ: 14 露出: 15 含めます: '*'
あなたはapplication.propertiesを設定している場合
1 // application.properties 2はserver.port = 8080 3 spring.application.name = 管理クライアント 4 spring.boot.admin.client.url =のhttp:// localhostを:9090 5 management.endpoints.web.exposure.include = *
違いが見られることができhttps://www.cnblogs.com/chenyun-/p/11306854.html
メインクラスを実行しているクライアント、あなたが見ることができます
プロジェクトを入力するように選択して、あなたが見ることができます
今回はサービスの指標を監視することができるようになります。
我々は、設定ファイルの意味を説明する前回の記事では、我々はレイアウトを使用application.propertiesの便宜のために、ここで、application.ymlお勧めします:
server.port = 8080 ポートで実行中のプロジェクトを監視しています。
spring.application.name =管理クライアント クライアント名称。
= HTTP spring.boot.admin.client.url:// localhostを:9090 場所での監視プログラム、両方を見つけることができるように。
management.endpoints.web.exposure.include=* 开放给监控程序的权限,这里的✳代指所有的权限。