這個好用的分佈式應用配置中心,我們把它開源了

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"導讀:","attrs":{}},{"type":"text","text":"SpringBoot的時代到來,對於曾經面向一堆XML配置的開發經歷,那真是一大福音,一切都變得非常簡潔,留下的就是簡化的配置文件設置。但在分佈式環境下呢?衆多的實例集羣下,動態的實例遷移等情況時常發生,導致配置管理的工作變得複雜且困難,百度研發團隊通過多年的架構建設經驗,把過往的配置管理的相關經驗沉澱成一套通用的解決方案,現以開源的方式回饋給社區開發者,希望幫助大家徹底解決配置建設的難題。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"italic","attrs":{}}],"text":"全文約4200字,預計閱讀時間8分鐘。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"1  分佈式環境下的配置管理挑戰","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"可以說配置化是當今應用開發與部署必備的一個能力要求,我們通常把一些容易變化以及依賴外部情況而變化的內容,通過配置化的方式來實現,這樣我們就可以在零編碼的情況下實現功能調整,實現極低成本的應用擴展能力。而對於配置管理方式,最爲常見的方式就是配置文件方式, 通過特定的文件內容格式進行設置, 部署時也會與應用程序放在一起。這樣使用方式在單機情況下比較容易且簡單,但是在大型的分佈式應用場景下,特別又要區分不同環境(開發,測試,線上等)就會導致管理成本與出錯風險急速加大。","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/42/42f9a18230bee5ad8b11c52c9b03eda0.webp","alt":"圖片","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"以上述場景爲例,涉及的問題與挑戰有:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":null,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"操作複雜,成本高:如果有幾十臺實例,則需要按個登錄機器進行修改, 很容易發生遺漏;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"檢驗與查錯難度大:在幾十臺實例修改,如有其中幾臺修改出錯,很難發現,同時也很難進行內容回溯與回滾;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"PAAS環境下,無法有效操作:在paas環境下,因爲漂移都現象存在,直接登錄實例進行修改,已經是非常危險的行爲了,因爲一旦漂移,配置就會失效到最初方式;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"動態加載,配置變更推送場景很難支持。","attrs":{}}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"所以針對大型分佈式場景,通過建立配置中心來統一管理配置的能力就顯得非常必要了,把業務開發者從複雜以及繁瑣的配置管理中解脫出來,只需專注於業務代碼本身,從而可以顯著提升開發以及運維效率。將配置和應用在部署階段解耦也可以進一步提升發佈的效率,降低部署成本。同時配置獨立化管理後,針對配置的安全性、回滾能力、追溯能力、應急控制處理等也會有很強的支撐。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"2  BRCC爲什麼是一個好的配置中心","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"2.1  好的配置中心應該具有的優點","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"前面講了在分佈式環境中爲什麼需要配置中心,那麼一個好的配置中心應該具備哪些優點呢?","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在我們看來,好的配置中心應該有以下優點:","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"1. 使用便捷","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"業務系統使用配置中心應該是非常簡單的:配置中心提供統一的kv管理能力,業務系統從配置中心獲取配置,然後在系統中使用配置。所以我們認爲,衡量配置中心是否優秀的最關鍵因素就是業務系統使用配置的便捷程度,越方便越是好的配置中心。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"使用便捷包括了兩個方面:","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"接入便捷  ","attrs":{}},{"type":"text","text":"SDK與API是最常見的接入方式。應儘可能的使用標準化的設計要求。SDK如在Java語言使用,應兼容Spring與SpringBoot的配置規範,直接使用而無需修改原有代碼, API則採用RESTful的定義標準,採用資源定位方式,提升可讀性與易用性;","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"管理便捷  ","attrs":{}},{"type":"text","text":"好的配置中心會提供界面友好的控制檯,方便使用者登錄進行配置管理。配置的管理層面更加清晰化,包括產品,工程, 環境, 版本, 分組等豐富的管理機制。","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"2. 功能完善","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"配置中心最主要的功能是對配置的管理,除了對配置的crud、批量變更、模糊匹配、快速導航之外,一個好的配置中心還需要有以下的配置能力:","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"推送  ","attrs":{}},{"type":"text","text":"使用者在配置中心變更了配置,能夠重新推送配置給業務系統,並且能反饋業務系統接收配置的狀態。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"追溯  ","attrs":{}},{"type":"text","text":"配置變更的歷史都有保存,並且變更之間能進行diff。在分佈式環境下, 可以追蹤各個實例的生效狀態,","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"多環境多版本  ","attrs":{}},{"type":"text","text":"好的配置中心能滿足業務系統在不同環境和版本下的配置需求,並提供版本之間diff的能力。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"審計/回滾  ","attrs":{}},{"type":"text","text":"配置中心能記錄使用者做的每一次變更操作,供審計使用。","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"3. 運維簡單","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"部署簡單  ","attrs":{}},{"type":"text","text":"能快速部署在各種環境,支持更豐富的環境,如虛擬機、paas、容器化等,支持集羣化和高可用部署。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"監控告警 ","attrs":{}},{"type":"text","text":" 提供完整,豐富監控和告警的能力,以幫助快速定位問題,快速處理風險。","attrs":{}}]}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"4. 安全可靠","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"配置安全性非常關鍵,例如數據庫的用戶與密碼,一旦泄露風險非常大,所以配置中心的安全性需要很全面的考量。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"一是配置存儲、傳輸的安全性,如內容可以加密;二是操作的權限管控, 必須對使用者進行權限控制,而權限控制的粒度到什麼程度、使用者的操作是否有跡可循、配置變更是否可回滾,都決定着配置中心的好壞。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"5. 高性能與穩定性","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在很多大型業務場景下,還面臨着衆多產品線同時使用的情況,產生高併發的請求配置服務的情況。所以在配置服務的架構設計必須需要考慮到這種因素,實現高吞吐、高時效與高穩定的架構要求。所以整體架構要具備分佈式的架構設計要求,配合彈性的擴展能力與多級的緩存同步機制,才能很好地解決這些問題,達到秒級的推送與變更能力, 提升至4個9999的穩定性要求。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"2.2 BRCC的優點","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"21年2月我們開源了一款配置中心BRCC (Better Remote Config Center),其主打的產品特性就是簡單、易用、安全。BRCC功能結構圖如下:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/a1/a13ff978eaf84d65842c01d2e65d47e0.webp","alt":"圖片","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"特點","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"1. 簡單好用的SDK端","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"BRCC提供多種語言的sdk,拿java sdk來說,其特點就是","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"完全兼容springboot的配置規範","attrs":{}},{"type":"text","text":",可以直接使用spring的@Value註解來加載配置,如下代碼:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/50/5088aecf8ae238180a5d986fa2a438af.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"對於習慣spring的開發者來說,可以在application.properties裏面設置 ","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"person.username=張三 ","attrs":{}},{"type":"text","text":"就能在啓動時將“張三”賦值給persion類的name變量上。而在使用BRCC時,只要把","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":" person.username=張三  ","attrs":{}},{"type":"text","text":"保存在BRCC中,引入BRCC starter的依賴就可以了,在業務代碼上無需改造,對業務系統來說可以算是0侵入了。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"2. 功能完備的服務端","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"BRCC作爲一種輕量級的分佈式配置管理解決方案,部署簡單,基於spring boot 2.0開發,打包後可以直接運行,支持配置的分發、更新推送。除了部署簡單外,服務端還有一些特別實用的功能:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"安全的控制檯","attrs":{}},{"type":"text","text":"  提供了一套完整的控制檯操作界面,支持多級權限控制,能夠從產品線、工程、環境等維度上進行讀寫的控制。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"配置熱發佈","attrs":{}},{"type":"text","text":"  BRCC提供了配置推送的功能,當配置變更後,可以主動觸發推送,將配置重新推送給業務系統,而業務系統收到配置後,可以根據自己的需要進行熱更新,從而不需要重啓既可以生效配置。在BRCC的服務端也可以查看推送後配置在業務系統上的生效情況。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"配置操作可追溯 ","attrs":{}},{"type":"text","text":" 在業務系統的迭代升級中,常常會有配置的變動,在BRCC中,使用者對配置的所有變更操作都有跡可循,對歷史配置也可以查詢、回滾和對比。","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"總而言之,BRCC是一塊非常優秀的分佈式配置中心解決方案,它完全兼容原生Spring配置規範,除了提供基本的配置存儲,還提供配置註釋、key-value維度查詢、變更推送、變更軌跡記錄及查詢、細粒度的權限控制、sdk實例管理、友好的UI界面,簡單部署等特點,","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"詳細的功能請參看:https://github.com/baidu/brcc。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"下面我們來看看如何快速搭建和使用吧!","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"3. BRCC快速入門","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"3.1 快速搭建BRCC服務端","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"選擇一個合適的版本, 您可以在brcc的","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"release notes","attrs":{}},{"type":"text","text":"中找到每個版本支持的功能的介紹,當前推薦的穩定版本爲1.0.4。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://github.com/baidu/brcc/releases","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"爲了方便大家體驗,我們在百度雲上部署了體驗環境:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在線體驗環境地址:http://180.76.36.149/#/login","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"測試賬號1:test1 123456","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"測試賬號2:test2 123456","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第一步,環境準備。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"BRCC 依賴 Java 環境來運行。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如果您是從代碼開始構建並運行BRCC,還需要爲此配置 Maven環境。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://maven.apache.org/index.html","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"請確保是在以下版本環境中安裝使用:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":null,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"64 bit OS,支持 Linux/Unix/Mac/Windows,推薦選用 Linux/Unix/Mac。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"64 bit JDK 1.8+;下載 & 配置。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"Maven 3.2.x+;下載 & 配置。(僅源碼編譯需要)","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"mysql5.6+","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"redis3.2+","attrs":{}}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"64 bit JDK 1.8+ 下載","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"64 bit JDK 1.8+ 配置","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Maven 3.2.x+ 下載","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://maven.apache.org/download.cgi","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Maven 3.2.x+ 配置","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://maven.apache.org/settings.html","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第二步,下載源碼或者安裝包。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"你可以通過源碼和發行包兩種方式來獲取brcc。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"從 Github 上下載源碼方式","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":"br"}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"git clone https:","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"//github","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":".com","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"/baidu/brcc","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":".git","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"cd","attrs":{}}],"attrs":{}},{"type":"text","text":" ","attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"brcc/","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"sh compile.sh","attrs":{}}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"下載編譯後壓縮包方式","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"您可以從 release notes下載 brcc-server.zip 包。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"unzip brcc-server.zip 或者 ","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"tar","attrs":{}}],"attrs":{}},{"type":"text","text":" ","attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"-zxvf brcc-server.","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"tar","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":".gz","attrs":{}}],"attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"cd","attrs":{}}],"attrs":{}},{"type":"text","text":" ","attrs":{}},{"type":"codeinline","content":[{"type":"text","text":"brcc-server","attrs":{}}],"attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第三步,啓動BRCC配置中心服務。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在start.sh中按要求配置好mysql和redis後,你就可以通過執行此腳本啓動brcc了。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"3.2 配置管理與SDK接入","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第一步,BRCC管理端添加配置。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在brcc管理端創產品線、工程、環境、版本、分組、 配置, 如下圖所示。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/97/9719bc8edb6f457bf0516f970baf72e5.webp","alt":"圖片","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如上圖,創建了產品線test1、工程test-rcc、版本1.0.0 和分組group1,並且配置了a、b、c 配置項。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第二步,引入brcc-sdk-starter, 確保pom.xml中引入以下依賴。","attrs":{}}]},{"type":"embedcomp","attrs":{"type":"table","data":{"content":"

<dependency>
    <groupId>com.baidu.mapp</groupId>
    <artifactId>brcc-sdk-starter</artifactId>
    <version>${brcc.version}</version>
</dependency>

"}}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/cc/cc5f1adf2e176ee1cfac5672ac8ccc15.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"目前最新的版本是1.0.0。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第三步, 添加BRCC的SDK配置描述。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在接入brcc配置中心之前,確保SpringBoot配置是完整的, 在application.properties文件中添加如下內容。","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/f5/f505855c4c1ad29cfa9bb1e49e93da6d.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"配置屬性介紹","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/9e/9ed76646fe53c63b1e96663e53a1770e.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第四步,在項目中進行配置開發。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"brcc完全兼容原生spring配置規範,你可以像application.yml,application.properties一樣是用brcc中的配置,如:","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ef/ef800b785433177d2610f8286c0f911b.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"第五步,配置驗證。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"啓動日誌中出現以下日誌說明配置加載成功。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/e7/e73f28176fe10ba8761d4c61afab3e7a.webp","alt":"圖片","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"配置發送變更後執行推送變更操作後,日誌中會出現以下提示。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/51/513b9c8e531543aaf74c4fc967447be5.webp","alt":"圖片","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"以上例子,你可以到 https://github.com/baidu/brcc/tree/main/brcc-example 獲得。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"4  關於我們","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我們大部分成員來自於百度智能小程序研發部的基礎架構團隊,致力於用簡單易用的方式解決配置相關的需求,降低配置的研發和運維成本。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"BRCC的願景是爲業務系統提供簡單、好用的配置服務。目前BRCC已經github上開源,大家可以訪問獲取全部代碼,也可以star我們項目,以便高效獲得我們持續的更新信息。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https://github.com/baidu/brcc","attrs":{}}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"本期作者介紹 ","attrs":{}},{"type":"text","text":"| 來自於百度智能小程序研發部的基礎架構團隊,致力於用簡單易用的方式的解決配置相關的需求,降低配置的研發和運維成本。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"閱讀原文:","attrs":{}},{"type":"link","attrs":{"href":"https://mp.weixin.qq.com/s?__biz=Mzg5MjU0NTI5OQ==&mid=2247491863&idx=1&sn=0edd89f6b66926f6881ebeeea0ea4475&chksm=c03ed16bf749587d4a46c1296a78a143007ecea571870a889c9fc81628706a98f08a38a11aff&token=1381754262&lang=zh_CN#rd","title":null,"type":null},"content":[{"type":"text","text":"這個好用的分佈式應用配置中心,我們把它開源了","attrs":{}}],"marks":[{"type":"strong"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"招聘信息","attrs":{}},{"type":"text","text":":近期熱招大數據研發工程師、服務端研發工程師(C++/GO/Java),Web前端研發工程師,iOS/Android客戶端研發工程師","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"歡迎關注百度Geek說同名公衆號聯繫我們~","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章