专注于各种「分布式系统配置管理」的「通用组件」和「通用平台」, 提供统一的「配置管理服务」。
下载地址:https://github.com/knightliao/disconf,我选择的版本是disconf-master-2.6.36(如果版本不一致可能存在差异)。
下载下来压缩包为disconf-master.zip。请使用unzip disconf-master.zip解压
jdbc-mysql.properties
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.db_0.url=jdbc:mysql://10.100.96.138:3306/disconf?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=false
jdbc.db_0.username=root
jdbc.db_0.password=123456
jdbc.maxPoolSize=20
jdbc.minPoolSize=10
jdbc.initialPoolSize=10
jdbc.idleConnectionTestPeriod=1200
jdbc.maxIdleTime=3600
redis-config.properties
redis.group1.retry.times=2
redis.group1.client1.name=BeidouRedis1
redis.group1.client1.host=10.100.160.132
redis.group1.client1.port=7001
redis.group1.client1.timeout=5000
redis.group1.client1.password=foobared
redis.group1.client2.name=BeidouRedis2
redis.group1.client2.host=10.100.160.132
redis.group1.client2.port=7002
redis.group1.client2.timeout=5000
redis.group1.client2.password=foobared
redis.group1.client1.name=BeidouRedis3
redis.group1.client1.host=10.100.160.133
redis.group1.client1.port=7003
redis.group1.client1.timeout=5000
redis.group1.client1.password=foobared
redis.group1.client2.name=BeidouRedis4
redis.group1.client2.host=10.100.160.133
redis.group1.client2.port=7004
redis.group1.client2.timeout=5000
redis.group1.client2.password=foobared
redis.group1.client1.name=BeidouRedis5
redis.group1.client1.host=10.100.160.134
redis.group1.client1.port=7005
redis.group1.client1.timeout=5000
redis.group1.client1.password=foobared
redis.group1.client2.name=BeidouRedis6
redis.group1.client2.host=10.100.160.134
redis.group1.client2.port=7006
redis.group1.client2.timeout=5000
redis.group1.client2.password=foobared
redis.evictor.delayCheckSeconds=300
redis.evictor.checkPeriodSeconds=30
redis.evictor.failedTimesToBeTickOut=6
zoo.properties
hosts=10.100.160.132:2181,10.100.160.133:2181,10.100.160.134:2181
# zookeeper\u7684\u524D\u7F00\u8DEF\u5F84\u540D
zookeeper_url_prefix=/disconf
application.properties
#
# \u670d\u52a1\u5668\u7684domain
#
domain=disconf.com
#
# \u90ae\u7bb1\u8bbe\u7f6e
#
EMAIL_MONITOR_ON = true
EMAIL_HOST = smtp.163.com
EMAIL_HOST_PASSWORD = password
EMAIL_HOST_USER = sender@163.com
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = disconf@163.com
#
# \u5b9a\u65f6\u6821\u9a8c\u4e2d\u5fc3\u7684\u914d\u7f6e\u4e0e\u6240\u6709\u5ba2\u6237\u7aef\u914d\u7f6e\u7684\u4e00\u81f4\u6027
#
*注意,即使只有一个redis,也应该配置两个redis client,否则将造成内部错误。*
设置War包将要被部署的地址(以下地址可自行设定):
/home/work/dsp/disconf-rd/war
修改/home/disconf-master/disconf-web/src/main/resources/ehcache.xml,将updateCheck="false"改为true,否则启动tomcat时会自动访问www.terracotta.org检查更新
构建
ONLINE_CONFIG_PATH=/home/work/dsp/disconf-rd/online-resources
WAR_ROOT_PATH=/home/work/dsp/disconf-rd/war
export ONLINE_CONFIG_PATH
export WAR_ROOT_PATH
cd /home/disconf-master/disconf-web
sh deploy/deploy.sh
这样会在 /home/work/dsp/disconf-rd/war 生成以下结果:
- disconf-web.war - html - META-INF - WEB-INF
初始化数据库:
可以参考 sql/readme.md 来进行数据库的初始化。注意顺序执行
0-init_table.sql
1-init_data.sql
201512/20151225.sql
20160701/20160701.sql
里面默认有6个用户(请注意线上环境删除这些用户以避免潜在的安全问题)
name
pwd
admin
admin
testUser1
MhxzKhl9209
testUser2
MhxzKhl167
testUser3
MhxzKhl783
testUser4
MhxzKhl8758
testUser5
MhxzKhl112
如果想自己设置初始化的用户名信息,可以参考代码来自己生成用户:
src/main/java/com/baidu/disconf/web/tools/UserCreateTools.java
修改server.xml文件,在Host结点下设定Context:
并设置端口为 8080
启动Tomcat,即可。
upstream disconf {
server 127.0.0.1:8015;
}
server {
listen 8081;
server_name disconf.com;
access_log /home/work/var/logs/disconf/access.log;
error_log /home/work/var/logs/disconf/error.log;
location / {
root /home/work/dsp/disconf-rd/war/html;
index login.html;
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://disconf;
}
}
关于host
这里的 host 设置成 disconf.com (可以自定义),但它 必须与 application.properties 里的domain一样。
然后浏览器的访问域名也是这个。
Nginx(处理静态请求) + Tomcat(处理动态请求)
手机扫一扫
移动阅读更方便
你可能感兴趣的文章