欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

SpringBootAdmin監(jiān)控工具怎么用

這篇文章主要為大家展示了“SpringBootAdmin監(jiān)控工具怎么用”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“SpringBootAdmin監(jiān)控工具怎么用”這篇文章吧。

創(chuàng)新互聯(lián)建站是網(wǎng)站建設(shè)專家,致力于互聯(lián)網(wǎng)品牌建設(shè)與網(wǎng)絡(luò)營(yíng)銷,專業(yè)領(lǐng)域包括成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、電商網(wǎng)站制作開發(fā)、小程序設(shè)計(jì)、微信營(yíng)銷、系統(tǒng)平臺(tái)開發(fā),與其他網(wǎng)站設(shè)計(jì)及系統(tǒng)開發(fā)公司不同,我們的整合解決方案結(jié)合了恒基網(wǎng)絡(luò)品牌建設(shè)經(jīng)驗(yàn)和互聯(lián)網(wǎng)整合營(yíng)銷的理念,并將策略和執(zhí)行緊密結(jié)合,且不斷評(píng)估并優(yōu)化我們的方案,為客戶提供全方位的互聯(lián)網(wǎng)品牌整合方案!

配置Admin Server

既然是管理程序,肯定有一個(gè)server,配置server很簡(jiǎn)單,我們添加這個(gè)依賴即可:

<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>2.2.2</version></dependency>

同時(shí)我們需要在main程序中添加@EnableAdminServer來啟動(dòng)admin server。

@EnableAdminServer@SpringBootApplicationpublic class SpringBootAdminServerApplication { public static void main(String[] args) {  SpringApplication.run(SpringBootAdminServerApplication.class, args); }}

配置admin client

有了server,我們接下來配置需要監(jiān)控的client應(yīng)用程序,在本文中,我們自己監(jiān)控自己,添加client依賴如下:

<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>2.2.2</version></dependency>

我們需要為client指定要注冊(cè)到的admin server:

spring.boot.admin.client.url=http://localhost:8080

因?yàn)镾pring Boot Admin依賴于 Spring Boot Actuator, 從Spring Boot2 之后,我們需要主動(dòng)開啟暴露的主鍵,如下:

management.endpoints.web.exposure.include=*management.endpoint.health.show-details=always

配置安全主鍵

通常來說,我們需要一個(gè)登陸界面,以防止未經(jīng)授權(quán)的人訪問。spring boot admin提供了一個(gè)UI供我們使用,同時(shí)我們添加Spring Security依賴:

<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui-login</artifactId> <version>1.5.7</version></dependency><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId></dependency>

添加了Spring Security,我們需要自定義一些配置:

@Configurationpublic class WebSecurityConfig extends WebSecurityConfigurerAdapter { private final AdminServerProperties adminServer; public WebSecurityConfig(AdminServerProperties adminServer) {  this.adminServer = adminServer; } @Override protected void configure(HttpSecurity http) throws Exception {  SavedRequestAwareAuthenticationSuccessHandler successHandler =    new SavedRequestAwareAuthenticationSuccessHandler();  successHandler.setTargetUrlParameter("redirectTo");  successHandler.setDefaultTargetUrl(this.adminServer.getContextPath() + "/");  http   .authorizeRequests()    .antMatchers(this.adminServer.getContextPath() + "/assets/**").permitAll()    .antMatchers(this.adminServer.getContextPath() + "/login").permitAll()    .anyRequest().authenticated()    .and()   .formLogin()    .loginPage(this.adminServer.getContextPath() + "/login")    .successHandler(successHandler)    .and()   .logout()    .logoutUrl(this.adminServer.getContextPath() + "/logout")    .and()   .httpBasic()    .and()   .csrf()    .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())    .ignoringRequestMatchers(     new AntPathRequestMatcher(this.adminServer.getContextPath() +      "/instances", HttpMethod.POST.toString()),      new AntPathRequestMatcher(this.adminServer.getContextPath() +      "/instances/*", HttpMethod.DELETE.toString()),     new AntPathRequestMatcher(this.adminServer.getContextPath() + "/actuator/**"))    .and()   .rememberMe()    .key(UUID.randomUUID().toString())    .tokenValiditySeconds(1209600); }}

接下來,我們?cè)谂渲梦募兄付?a title="服務(wù)器" target="_blank" >服務(wù)器的用戶名和密碼:

spring.boot.admin.client.username=adminspring.boot.admin.client.password=admin

作為一個(gè)客戶端,連接服務(wù)器的時(shí)候,我們也需要提供相應(yīng)的認(rèn)證信息如下:

spring.boot.admin.client.instance.metadata.user.name=adminspring.boot.admin.client.instance.metadata.user.password=adminspring.boot.admin.client.username=adminspring.boot.admin.client.password=admin

好了,登錄頁面和權(quán)限認(rèn)證也完成了。

Hazelcast集群

Spring Boot Admin 支持Hazelcast的集群,我們先添加依賴如下:

<dependency> <groupId>com.hazelcast</groupId> <artifactId>hazelcast</artifactId> <version>3.12.2</version></dependency>

然后添加Hazelcast的配置:

@Configurationpublic class HazelcastConfig { @Bean public Config hazelcast() {  MapConfig eventStoreMap = new MapConfig("spring-boot-admin-event-store")   .setInMemoryFormat(InMemoryFormat.OBJECT)   .setBackupCount(1)   .setEvictionPolicy(EvictionPolicy.NONE)   .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100));  MapConfig sentNotificationsMap = new MapConfig("spring-boot-admin-application-store")   .setInMemoryFormat(InMemoryFormat.OBJECT)   .setBackupCount(1)   .setEvictionPolicy(EvictionPolicy.LRU)   .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100));  Config config = new Config();  config.addMapConfig(eventStoreMap);  config.addMapConfig(sentNotificationsMap);  config.setProperty("hazelcast.jmx", "true");  config.getNetworkConfig()   .getJoin()   .getMulticastConfig()   .setEnabled(false);  TcpIpConfig tcpIpConfig = config.getNetworkConfig()   .getJoin()   .getTcpIpConfig();  tcpIpConfig.setEnabled(true);  tcpIpConfig.setMembers(Collections.singletonList("127.0.0.1"));  return config; }}

以上是“SpringBootAdmin監(jiān)控工具怎么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

當(dāng)前標(biāo)題:SpringBootAdmin監(jiān)控工具怎么用
網(wǎng)站網(wǎng)址:http://www.aaarwkj.com/article40/pcceho.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)、商城網(wǎng)站、做網(wǎng)站網(wǎng)站排名、軟件開發(fā)營(yíng)銷型網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)
麻豆深夜激情在线观看| 一区二区蜜桃在线观看| 九月丁香花开综合网| 麻豆AV一区二区三区久久| 97日韩在线免费视频网站| 久久精品国产亚洲av高清综合| 亚洲新大香蕉视频在线播放| 日韩欧美国产亚洲在线| 欧美日韩国产激情高清| 久久久久久精品国产毛片| 国产男女做爰在线视频| 中文字幕在线日韩av| 久久综合午夜福利视频| 日韩无码一区二区视频| 欧美日韩国产在线91| 五月开心婷婷中文字幕| 国产自偷一区二区三区| av熟妇人妻一区二区三区| 人妻久久一区二区三区精品99| 亚洲av综合日韩精品久久| 成人深夜免费观看视频| 国产91在线拍揄自揄| 亚洲精品天堂av免费看| 国产日韩欧美亚洲中文| 久久伊人亚洲精品中文字幕| av黄色天堂在线观看| 亚洲国产区男人的天堂| 亚洲一区成人免费电影| 最新日韩欧美不卡一二三区| 蜜臀av在线播放黑丝| 国产三级一区二区不卡| 九色综合一区二区三区| 91久久精品国产一区蜜臀| 周妍希浴室视频色哟哟| 欧美夫妻成人性生活视频| 蜜臀99久久精品久久久| 午夜av在线毛片免费观看| 超薄丝袜美腿一二三区在线播放| 色播五月麻豆激情综合网| 日韩精品一区二区三区四区蜜桃 | 亚洲av色国产精品色午含羞草|