老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業提供網站建設、域名注冊、服務器等服務

SpringBootAdmin監控工具怎么用

這篇文章主要為大家展示了“SpringBootAdmin監控工具怎么用”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“SpringBootAdmin監控工具怎么用”這篇文章吧。

創新互聯建站是網站建設專家,致力于互聯網品牌建設與網絡營銷,專業領域包括成都網站設計、成都做網站、外貿網站建設、電商網站制作開發、小程序設計、微信營銷、系統平臺開發,與其他網站設計及系統開發公司不同,我們的整合解決方案結合了恒基網絡品牌建設經驗和互聯網整合營銷的理念,并將策略和執行緊密結合,且不斷評估并優化我們的方案,為客戶提供全方位的互聯網品牌整合方案!

配置Admin Server

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

de.codecentric spring-boot-admin-starter-server 2.2.2

同時我們需要在main程序中添加@EnableAdminServer來啟動admin server。

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

配置admin client

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

de.codecentric spring-boot-admin-starter-client 2.2.2

我們需要為client指定要注冊到的admin server:

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

因為Spring Boot Admin依賴于 Spring Boot Actuator, 從Spring Boot2 之后,我們需要主動開啟暴露的主鍵,如下:

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

配置安全主鍵

通常來說,我們需要一個登陸界面,以防止未經授權的人訪問。spring boot admin提供了一個UI供我們使用,同時我們添加Spring Security依賴:

de.codecentric spring-boot-admin-server-ui-login 1.5.7 org.springframework.boot spring-boot-starter-security

添加了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); }}

接下來,我們在配置文件中指定服務器的用戶名和密碼:

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

作為一個客戶端,連接服務器的時候,我們也需要提供相應的認證信息如下:

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

好了,登錄頁面和權限認證也完成了。

Hazelcast集群

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

com.hazelcast hazelcast 3.12.2

然后添加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監控工具怎么用”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注創新互聯行業資訊頻道!


分享題目:SpringBootAdmin監控工具怎么用
網站路徑:http://www.xueling.net.cn/article/pcceho.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP
主站蜘蛛池模板: 97人人模人人爽人人少妇 | 把腿张开老子CAO烂你动态图 | 国产精品最新网址 | 天天操婷婷 | 亚洲AV网址在线 | 亚洲片在线观看 | 俄罗斯xxxx性全过程 | 99视频精品全国免费 | 久久婷婷五月综合色奶水99啪 | 不卡视频一区二区三区 | 国产欧美在线播放视频 | 亚洲av无码成h人动漫在线观看3d | 逼逼导航| 97精品自拍 | 欧美亚洲日本 | 少妇高潮呻吟A片免费看 | 成人一边做一边爽爽视频 | 国产精品嫩草33av在线 | 国产黄色在线看 | 91亚洲精华国产 | 老师穿超短包臀裙办公室爆乳 | 国产成人精品无码免费视频 | 永久免费无码网站在线观看个 | 99久久久无码国产精精品品不卡 | 欧美高大丰满freesex | 久操日本| 成人免费黄色网页 | 亚洲日韩精品国产一区二区三区 | 国产69精品久久久久久野外 | 91青娱乐在线视频 | 亚洲欧美洲成人一区二区 | 亚洲va天堂va国产va久 | 亚洲成人国产 | 9277在线观看免费播放 | 91九色porny视频 | 日本视频网站WWW色高清免费 | 婷婷成人基地 | 视频在线观看大片 | 中文字幕一区免费 | 国产成人精品高清在线 | 日本XXXWWW在线观看 |