Disconf-client-for-java

Source: Internet
Author: User

One, disconf client deployment

Disconf currently supports only Java clients, following the installation of Java client as a collation, documenting the steps to install the deployment

1. Environmental dependence

First, you need to install the Java environment and MAVEN environment, not too much introduction

2. Download the Disconf-for-java client
  [[email protected] client]# git clone https://Github.com/knightliao/disconf-demos-java.git

[Email protected] client]# Tree-l 2
.
└──disconf-demos-java
├──disconf-spring-boot-demo using Disconf's spring-based standalone demo program
├──disconf-standalone-demo integrated with the spring-based standalone demo program of Disconf and Dubbo
├──disconf-standalone-dubbo-demo uses Disconf's Spring-boot demo program with less configuration
├──pom.xml
└──readme.md

4 Directories, 2 files

    • The following is an example of Disconf-standalone-demo
    • Edit Disconf-client Client-downloaded configuration file
[Email protected] rd]# vim/data/disconf/client/disconf-demos-java/disconf-standalone-demo/profile/rd/disconf.properties [[email protected] rd]#Egrep-V"^#|^$"disconf.properties disconf.enable.remote.conf=true #是否使用远程配置文件, True (default) to get the configuration remotely, false to get the local configuration directlyDisconf.conf_server_host=127.0.0.1:8084 #修改为discon-web's access addressdisconf.version=1_0_0_0 #app对应的版本号disconf. App=dzhops#app名称disconf.Env=Rd #app的环境disconf. Ignore=redis.properties code.properties #忽略的分布式配置, separated by spacesDisconf.conf_server_url_retry_times=1 #获取远程配置重试次数, default 3 timesDisconf.conf_server_url_retry_sleep_seconds=1 #获取远程配置 sleep time when retrying, default is 5 secondsDisconf.user_define_download_dir=./disconf/download #用户定义的下载文件夹, the remote file will be downloaded and placed here. Note that this folder must have permissions, otherwise it cannot be downloaded here Disconf.enable_local_download_dir_in_class_path=true #下载的文件会被迁移到classpath根路径下, it is strongly recommended to set this option to True (default is True)
    • Edit the Disconf-client client to download the corresponding file configuration file (content for the file that needs to be downloaded, its own locally deployed application depends on the files, downloaded from disconf-web)
[Email protected] resources]# vim/data/disconf/client/disconf-demos-java/disconf-standalone-demo/src/main/ resources/Applicationcontext.xml -<!--disconf configuration with Managed mode (no code intrusion, configuration changes are automatically reload)- -<beanID="configproperties_disconf"  -class="Com.baidu.disconf.client.addons.properties.ReloadablePropertiesFactoryBean"> in<property name="Locations"> -<list> to<value>classpath:/server.cfg</value> #从disconf-web downloaded files, stored on Discon-web server, start Disconf-client client, The file will be downloaded +<value>classpath:/settings.py</value> #从disconf-web downloaded files, stored on Disconf-web server, start Disconf-client client, The file will be downloadedPanax Notoginseng</list> -</property> the</bean>
3. Building a project with Maven
pwd/data/disconf/client/disconf-demos-java[[email protected] disconf-demos-java]# MVN package                   #构建下载环境依赖 [[email protected] disconf-demos-java]# cd disconf-standalone-demo/[email Protected] disconfcat  readme.md            #查看readme说明 [[email protected] disconf- standalone-demo]# mvn Clean Package        #构建环境 to generate the target directory

[Email protected] disconf-standalone-demo]# CD target/
[[email protected] target]# ls
Classes Disconf-standalone-demo.jar disconf-standalone-demo.tar.gz Maven-archiver maven-status Original-disconf-standalone-demo.jar Starter-run
[Email protected] target]# CD starter-run/
[[email protected] starter-run]# ls
Disconf.properties Disconf-standalone-demo.jar env logback.xml start.sh stop.sh #启动及停止客户端程序目录, Disconf.properties for configuration files

4. Start the client process
sh start. SH    #启动进程 [[email protected] Startersh stop.  SH    #停止进程

[Email protected] starter-run]# Ps-ef | grep "Disconf-standalone-demo.jar" #查找客户端进程是否运行, you can view related logs in the log directory
Root 20075 1 00:20 pts/2 00:00:04 Java-server-xms1024m-xmx1024m-xmn448m-xss256k-xx:maxpermsize=128m-xx:reservedc odecachesize=64m-xx:+useparallelgc-xx:+useparalleloldgc-xx:parallelgcthreads=2-xx:+printgcdetails-xx:+ Printgctimestamps-dlogback.configurationfile=file:logback.xml-jar Disconf-standalone-demo.jar
Root 20098 3975 0 00:20 pts/2 00:00:00 grep disconf-standalone-demo.jar

5. File Download Check

After the file download succeeds, it will be stored in the current path and disconf/download directory, if the file content is modified on the Disconf-web side, the client will automatically detect and download the update.

Disconf-client-for-java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.