欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控

這篇文章主要介紹“SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控”,在日常操作中,相信很多人在SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

河南網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司,河南網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為河南成百上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的河南做網(wǎng)站的公司定做!

一、Hystrix Dashboard簡(jiǎn)介

在微服務(wù)架構(gòu)中為例保證程序的可用性,防止程序出錯(cuò)導(dǎo)致網(wǎng)絡(luò)阻塞,出現(xiàn)了斷路器模型。斷路器的狀況反應(yīng)了一個(gè)程序的

可用性和健壯性,它是一個(gè)重要指標(biāo)。Hystrix Dashboard是作

為斷路器狀態(tài)的一個(gè)組件,提供了數(shù)據(jù)監(jiān)控和友好的圖形化界面。

二、準(zhǔn)備工作

本文的的來(lái)源于第一篇文章的栗子,在它的基礎(chǔ)上進(jìn)行改造。

三、開始改造service-hi

在pom的工程文件引入相應(yīng)的依賴:

<dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
        </dependency>
        
    </dependencies>

其中,這三個(gè)依賴是必須的,缺一不可。

在程序的入口ServiceHiApplication類,加上@EnableHystrix注解開啟斷路器,這個(gè)是必須的,并且需要在程序中聲明斷路點(diǎn)

HystrixCommand;加上@EnableHystrixDashboard注解,開啟HystrixDashboard

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@RestController
@EnableHystrix
@EnableHystrixDashboard
@EnableCircuitBreaker
public class ServiceHiApplication {
    /**
     * 訪問地址 http://localhost:8762/actuator/hystrix.stream
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run( ServiceHiApplication.class, args );
    }
    @Value("${server.port}")
    String port;
    @RequestMapping("/hi")
    @HystrixCommand(fallbackMethod = "hiError")
    public String home(@RequestParam(value = "name", defaultValue = "forezp") String name) {
        return "hi " + name + " ,i am from port:" + port;
    }
    public String hiError(String name) {
        return "hi,"+name+",sorry,error!";
    }
}

運(yùn)行程序: 依次開啟eureka-server 和service-hi.

四、Hystrix Dashboard圖形展示
打開http://localhost:8762/actuator/hystrix.stream,可以看到一些具體的數(shù)據(jù):

SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控

打開localhost:8762/hystrix 可以看見以下界面:

SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控

在界面依次輸入:http://localhost:8762/actuator/hystrix.stream 、2000 、miya;點(diǎn)確定。

在另一個(gè)窗口輸入: http://localhost:8762/hi?name=forezp

重新刷新hystrix.stream網(wǎng)頁(yè),你會(huì)看到良好的圖形化界面:

SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控

到此,關(guān)于“SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

網(wǎng)站名稱:SpringCloud怎么實(shí)現(xiàn)斷路器監(jiān)控
當(dāng)前路徑:http://chinadenli.net/article14/ihsgde.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信公眾號(hào)標(biāo)簽優(yōu)化、建站公司、微信小程序網(wǎng)站改版、ChatGPT

廣告

聲明:本網(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í)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)