偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

Spring Cloud Config的配置中心獲取不到最新配置信息的問(wèn)題

企業(yè)動(dòng)態(tài)
本篇源于Spring Cloud Config的一個(gè)問(wèn)題,但這個(gè)問(wèn)題并非所有人都會(huì)遇到。如果您遇到了,那必須得看看這篇,如果沒(méi)有遇到您也應(yīng)該看看,防患于未然!

[[208203]]

本篇源于Spring Cloud Config的一個(gè)問(wèn)題,但這個(gè)問(wèn)題并非所有人都會(huì)遇到。如果您遇到了,那必須得看看這篇,如果沒(méi)有遇到您也應(yīng)該看看,防患于未然!

問(wèn)題描述

之前有朋友提出Spring Cloud Config的配置中心在運(yùn)行一段時(shí)間之后,發(fā)現(xiàn)修改了配置信息,但是微服務(wù)應(yīng)用并拿不到新的配置內(nèi)容。同時(shí),發(fā)現(xiàn)配置中心存儲(chǔ)配置的目錄/tmp的配置內(nèi)容被清空了。

原因與解決

首先,分析一下上面的問(wèn)題,其實(shí)已經(jīng)有一定的線索。表面現(xiàn)象是微服務(wù)從配置中心獲取配置信息的時(shí)候獲取不到***的配置,而其根本原因就是在/tmp目錄下的緩存?zhèn)}庫(kù)已經(jīng)被清空了,所以導(dǎo)致無(wú)法正常的通過(guò)Git獲取到***配置,那么自然各個(gè)微服務(wù)應(yīng)用就無(wú)法獲取***配置了。

其實(shí)該問(wèn)題在Spring Cloud的官方文檔中也有對(duì)應(yīng)的說(shuō)明,原文如下:

With VCS based backends (git, svn) files are checked out or cloned to the local filesystem. By default they are put in the system temporary directory with a prefix of config-repo-. On linux, for example it could be /tmp/config-repo-<randomid>. Some operating systems routinely clean out temporary directories. This can lead to unexpected behaviour such as missing properties. To avoid this problem, change the directory Config Server uses, by setting spring.cloud.config.server.git.basedir or spring.cloud.config.server.svn.basedir to a directory that does not reside in the system temp structure.

根據(jù)上面的內(nèi)容,我們可以知道在某些系統(tǒng)中,對(duì)于/tmp目錄進(jìn)行周期性的清理,所以也就有了上面所說(shuō)的問(wèn)題。

從文檔中我們也已經(jīng)知道如果去解決該問(wèn)題,無(wú)非就是通過(guò)spring.cloud.config.server.git.basedir或spring.cloud.config.server.svn.basedir參數(shù)來(lái)指定一個(gè)不會(huì)被定期清理的目錄。比如,我們可以設(shè)置:

  1. spring.cloud.config.server.git.basedir=config-repo 

其他問(wèn)題

這里需要注意一下,該參數(shù)的設(shè)置依然有一定的問(wèn)題。按理解,如上配置的話,應(yīng)該是在配置中心程序所在的目錄下創(chuàng)建一個(gè)config-repo目錄來(lái)進(jìn)行存儲(chǔ)。但是,在測(cè)試了Dalston SR1和SR2版本之后,發(fā)現(xiàn)該配置只會(huì)將內(nèi)容存儲(chǔ)到配置中心程序的同一級(jí)目錄下,并不會(huì)創(chuàng)建一個(gè)config-repo目錄。

但是,如果我們這樣設(shè)置,就可以將配置的緩存內(nèi)容存儲(chǔ)在配置中心所在目錄下的config-repo目錄中了:

  1. spring.cloud.config.server.git.basedir=config-repo/config-repo 

【本文為51CTO專欄作者“翟永超”的原創(chuàng)稿件,轉(zhuǎn)載請(qǐng)通過(guò)51CTO聯(lián)系作者獲取授權(quán)】

戳這里,看該作者更多好文

責(zé)任編輯:武曉燕 來(lái)源: 51CTO專欄
相關(guān)推薦

2025-05-29 05:59:56

2021-11-16 11:45:00

SpringSpring ClouJava

2018-07-10 14:55:32

Git存儲(chǔ)配置

2010-08-06 14:53:35

思科路由器配置信息

2018-07-27 15:43:24

Spring Clou管理架構(gòu)

2018-05-16 15:45:19

SpringCloudConfig

2018-06-22 15:46:45

Spring Clou加密處理

2009-12-17 10:08:06

Cisco路由器配置信

2017-07-28 16:41:53

Spring Clou微服務(wù)架構(gòu)

2019-09-24 16:15:03

架構(gòu)配置代碼

2010-02-04 16:57:40

Android配置信息

2023-06-12 00:20:42

Go配置管理庫(kù)

2025-03-03 10:27:33

配置中心微服務(wù)架構(gòu)

2018-05-23 15:58:27

Spring Clou微服務(wù)架構(gòu)

2018-07-19 14:58:14

Spring Clou微服務(wù)架構(gòu)

2009-12-21 13:27:45

WCF服務(wù)配置信息

2023-05-04 08:09:33

serviceId路徑謂詞中心注冊(cè)

2019-01-09 08:00:30

數(shù)據(jù)中心配置物理服務(wù)器

2009-03-02 10:00:00

口令路由器交換機(jī)

2009-11-17 17:00:47

寬帶路由器配置
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)