disconf介绍
disconf,全称 Distributed Configuration Management Platform(分布式配置管理平台),是java下的一个开源项目,其地址为https://github.com/knightliao/disconf。
windows部署安装
环境要求:nginx+mysql+tomcat+intellij+zk+jdk
step1.下载disconf源码,本文中用到的disconf版本为2.6.6,地址为https://github.com/knightliao/disconf,导入到intellij中。
step2.修改pom.xml注释掉如下代码
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>-->
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>-->
修改配置文件jdbc-mysql.properties、redis-config.properties、zoo.properties;并执行sql文件。
执行如下命令编译
cd disconf
mvn clean install -Dmaven.test.skip=true
step3.部署disconf-web到tomcat,并启动tomcat
step4.配置nginx并启动
server {
listen 8081;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
# root html;
# index index.html index.htm;
#}
location / {
root E:\Intellij\workspace-newstart\disconf\disconf-web\html; #disconf-web静态文件位置
if ($query_string) {
expires max;
}
}
location ~ ^/(api|export) {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://127.0.0.1:8080; #isconf-web服务部署地址
}
step5.访问:http://localhost:8081/,成功后如下。