disconf是基于zookeeper watch机制的分布式配置统一解决方案。 特点 支持配置(配置项+配置文件)的分布式化管理,可通过注解定义回调函数实现配置自动化更新时候的通知。...可定义单个客户端定义自己的配置文件,可通过配置disconf.properties的以下参数确定zk node的路径 ? zk node如下: ?...参考资料: disconf官方文档
disconf-client各个模块的作用如下: scan: 配置扫描模块 core: 配置核心处理模块 fetch: 配置抓取模块 watch: 配置监控模块 store: 配置仓库模块 addons...: 配置reload模块 启动 在disconf.xml中的定义如下: disconf...5.执行Core模块,从disconf-web平台上下载配置数据:配置文件下载到本地,配置项直接下载。 6.配置文件和配置项的数据会注入到配置仓库里。...A5:根据XML配置定义,到 disconf-web 平台里下载配置文件,放在仓库里,并监控ZK结点。 A6:A1-A5均是处理静态类数据。...更新配置事件B: B1:管理员在 Disconf-web 平台上更新配置。 B2:Disconf-web 平台发送配置更新消息给ZK指定的结点。 B3:ZK通知 Disconf-cient 模块。
'2' services: disconf_redis_1: image: daocloud.io/library/redis restart: always disconf_redis...:3.3.6 restart: always disconf_mysql: image: bolingcavalry/disconf_mysql:0.0.1 environment...:0.0.1 links: - disconf_redis_1:redishost001 - disconf_redis_2:redishost002 -...disconf_zookeeper:zkhost - disconf_mysql:mysqlhost restart: always disconf_nginx: image...: bolingcavalry/disconf_nginx:0.0.1 links: - disconf_tomcat:tomcathost ports:
当配置更新时, disconf-web推送最新配置到zk上,disconf-client获取到zk事件通知时,由disconf-client 从 disconf-web下载最新配置。...此外,disconf-web创建最新配置时,只会把配置数据落到mysql,并不会马上把数据推到zk上,而需要监听该节点的disconf-client实例启动时,如果还没有创建zk节点,则由客户端创建节点并注册
,apache-tomcat-7.0.68)等环境以及使用的demo 地址:https://coding.net/u/kailingchen/p/disconfDemo/git 说明 disconf...# 是否使用远程配置文件 # true(默认)会从远程获取配置 false则直接获取本地配置 disconf.enable.remote.conf=true # 配置服务器的 HOST,用逗号分隔... 127.0.0.1:8000,这个是必填项,其他都是选填 disconf.conf_server_host=localhost:8081 # 版本, 请采用 X_X_X_X 格式 disconf.version...=1_0_0_0 # APP 请采用 产品线_服务名 格式 disconf.app=disconf_demo # 环境 disconf.env=rd # debug #debug=true...,默认是5秒 disconf.conf_server_url_retry_sleep_seconds=1 disconf.user_define_download_dir=./ 3.配置你的config
disconf-web是基于tomcat,springMVC构建的web应用,tomcat启动时,会加载webapp下面的web.xml ?
第一步,还是放入pom的依赖 com.baidu.disconf disconf-client 2.6.36 第二步,是写一个配置类 package com.xxx.xxx.disconf.config; import...com.baidu.disconf.client.DisconfMgrBean; import com.baidu.disconf.client.DisconfMgrBeanSecond; import...* Disconf配置类 */ @Configuration public class DisConfig { @Bean(destroyMethod = "destroy") public...至此springboot使用disconf就结束了。
在Maven POM 文件里加入 com.baidu.disconf disconf-client...disconf.version=1_0_0_0 # APP 请采用 产品线_服务名 格式 disconf.app=esearch_search # 环境 disconf.env=rd # 忽略哪些分布式配置...,用逗号分隔 disconf.ignore= # 获取远程配置 重试次数,默认是3次 disconf.conf_server_url_retry_times=1 # 获取远程配置 重试时休眠时间,默认是...=true 3.创建disconf.xml,并使用spring加载: disconf必须添加以下配置 --> disconf.client.DisconfMgrBean
在上一章《docker下使用disconf:极速体验》中我们体验了disconf服务的使用方获取配置以及实时感知到这个配置变化的效果,今天我们一起来实践这个demo的开发过程,学会在项目中使用disconf...此demo源于disconf官网的demo(git地址:git@github.com:knightliao/disconf-demos-java.git,下有三个工程,此文的demo源自其中的disconf-standalone-demo...:80 # 版本, 请采用 X_X_X_X 格式 disconf.version=1_0_0_0 # APP 请采用 产品线_服务名 格式 disconf.app=disconf_demo #...新建一个docker-compose.yml文件,内容如下所示:(这里要重点注意的是disconf_java的link配置,除了连接disconf_nginx,还要连接disconf_zookeeper...: - disconf_redis_1:redishost001 - disconf_redis_2:redishost002 - disconf_zookeeper
前面的文章中我们实战了docker下搭建disconf环境,现在我们学习如何使用disconf提供的动态配置服务,本章我们不深入研究,而是以最快的速度体验一个java做的demo,此demo的功能是每隔...- disconf_redis_2:redishost002 - disconf_zookeeper:zkhost - disconf_mysql:mysqlhost restart...: always disconf_nginx: image: bolingcavalry/disconf_nginx:0.0.1 links: - disconf_tomcat.../disconf_standalone_demo:0.0.1 links: - disconf_nginx:nginxhost - disconf_zookeeper:...以上就是简单体验disconf效果的简易demo,可以发现disconf的配置信息能让服务使用方实时感知和获取到,对开发和运营来说都是个很有用的工具,本章只是初步体验,下一章我们会通过代码对disconf
在上一篇文章《Docker搭建disconf环境,三部曲之一:极速搭建disconf》中,我们用最快的速度在本地运行了disconf环境,对disconf有了初步的认识,用的是我预先构建好并上传的hub.docker.com...上的镜像,今天我们试着在本地构建这些镜像,再把disconf环境运行起来,今天依然是以轻松的体验为主,详细的过程分析留给下一篇文章吧。...打开docker_disconf文件夹下的docker-compose.yml文件,修改如下图红框中的三个位置的内容: ?...修改成这样: 1. bolingcavalry/disconf_mysql:0.0.1改成conf_mysql:0.0.1 2. bolingcavalry/disconf_tomcat:0.0.1...disconf环境。
说明 Disconf服务依赖的环境除了前两篇博文描述的外,还需要一个java的servlet容器(tomcat),因为Disconf项目是前后的分离的,所以还需要一个httpweb服务器(推荐使用...nginx),当然还需要数据持久化话数据库mysql还持久化我们的数据 准备 ps:Disconf是一个开源的产品,代码托管在github上https://github.com/knightliao.../disconf,项目是用maven构建,首先把项目下载下来,里面会有三个模块,分别是核心模块,客户端模块,web端模块,部署我们的Disconf服务需要将web模块打成war来部署,在打包之前我们需要先将相关的配置配置好.../access.log; error_log /home/work/var/logs/disconf/error.log; location / { root.../home/work/dsp/disconf-rd/war/html; #这里指定你的disconf项目web模块的html文件路径 if ($query_string) {
disconf-web创建最新配置时,只会把配置数据落到mysql,并不会马上把数据推到zk上,而需要监听该节点的disconf-client实例启动时,如果还没有创建zk节点,则由客户端创建节点并注册...disconf-web的ZK异常处理 disconf-web可以完全保证在任何情况下,与ZK集群的自动连接。...只要有一台存活,disconf-web就会收到 ** * disconf-client的ZK异常处理 disconf-client可以完全保证: 如果在启动程序时保证ZK集群是可用的,那么,就可以保证在任何情况下...下面按情况进行分析: 程序启动前,zk连接不上 这时disconf-client无法在ZK上注册信息。这是必须禁止发生的情况。也是disconf-client无法支持的情况。...如果集群所有机器均死亡,这时你的程序将游离于disconf之外。只要集群中有任何一台ZK机器重新开启,那么 你的程序将重新 由disconf进行托管。
说明 从《Disconf实现分布式配置管理的原理与设计》我们了解到,搭建部署我们自己的分布式disconf配置中心需要分布式应用程序协调服务Zookeeper的支持,下面我们就来部署我们的Zookeeper...到这里我们的Zookeeper集群环境就已经配置搭建好了,也就完成了Disconf服务搭建的其中一个环境依赖,其实除了需要Zookeeper提供支持外还需要如下依赖: 1.Mysql(Ver 14.12
spring-boot虽然不推荐使用xml文件做为配置文件,但是并没有把路堵死,所以与disconf的整合,仍旧可以沿用之前的xml方式来处理。..."/> 二、disconf配置文件spring-disconf.xml disconf..." class="com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean">...当然还要有一个disconf.properties文件,参考下图: ? 三、spring-bean.xml中使用disconf注入的属性 <?
Docker-Disconf是本人学习Docker后,尝试使用Docker解决Disconf打包和运行问题的作品。...Disconf-web 是Disconf的服务器端,提供了用于管理分布式配置的Web界面。.../disconf-build 如果修改了 properties 文件,可以通过再次启动disconf-build 容器来打包: “ docker start disconf-build Docker...:disconf-mysql --link disconf-redis:disconf-redis --link disconf-zoo:disconf-zoo \ -v /home/ubuntu.../disconf-build/working/war:/home/work/dsp/disconf-rd/war --name disconf-app yourimgs/disconf-app 5)
说明 Disconf后台服务大量的使用了Redis存储系统作为数据缓存,所以我们来安装我们的Redis服务 认识Redis 在我们安装Redis服务前,我们先来感性的人事一下Redis
上一篇我们完成了disconf服务端的环境搭建,这一篇我们来看看客户端springboot如何继承disconf,最终在docker下运行。...假定你已经在本机搭建好了disconf的web端环境,并已经能使用localhost访问到disconf的web界面。 下面看客户端如何使用disconf。...至于为什么要勾aop,后面用到disconf的回调时才用的上,先不用管它。 然后在pom里添加disconf的依赖。最终pom.xml如下 disconf的配置功能。...构建镜像,在工程根目录下执行 docker build -t test_disconf . 等到构建完毕,可以得到一个叫test_disconf的镜像。 ?
,亲测1.7和1.8都是可以正常编译的,如果你在编译的过程中遇到问题可以试着更换一下JDK的版本再试试 Maven Disconf官方仓库 https://github.com/knightliao/disconf.git...库并执行下面的数据库脚本 # disconf/disconf-web/sql/0-init_table.sql # disconf/disconf-web/sql.../1-init_data.sql # disconf/disconf-web/sql/201512/20151225.sql # disconf/disconf-web...pengfeilu/disconf-mysql:5.7.22.1 这个镜像的目的其实很简单,就是启动的时候自动将Disconf相关的数据库、表、数据自动创建好,避免Mysql启动之后还需要手动去创建...环境已经全部完成了,其实整个过程,最重要的也就是Disconf源码编译那块儿,其他的像Mysql、zk、redis都是一些辅助性的软件,只要安装运行起来,并将Disconf的配置文件配置并关联过去即可。
领取专属 10元无门槛券
手把手带您无忧上云