一、依赖软件
1,mysql
2,redis
3,zookeeper
4,nginx
5,tomcat
6,maven
cd /usr/local/src
git clone https://github.com/knightliao/disconf.git
二、配置文件存放路径
/space/data/disconf/online-resources 路径可自行选择
cp disconf-web/profile/rd/* /space/data/disconf/online-resources 此配置文件是mvn打包生成disconf.war的应用配置文件
cd /space/data/disconf/online-resources
mv application-demo.properties application.properties
编辑/space/data/disconf/online-resources 下的配置文件
jdbc-mysql.properties 数据库配置
redis-config.properties redis配置(注意:redis配置文件--必须配置两个redisl client 同一个redis地址配置两个也可以)
zoo.properties zookeeper配置
application.properties 应用配置(其中domain必须与nginx server_name 相同)
三、设置war包部署地址
/space/app/disconf
编辑/etc/profile 增加如下配置
ONLINE_CONFIG_PATH=/space/data/disconf/online-resoreces
WAR_ROOT_PATH=/space/app/disconf
export ONLINE_CONFIG_PATH
export WAR_ROOT_PATH
source /etc/profile
四、构建
cd /usr/local/src/disconf/disconf-web
sh deploy/deploy.sh
ls /space/app/disconf
生成如下结果
application.properties disconf-web.war html jdbc-mysql.properties jpaas_control log4j.properties logback.xml META-INF redis-config.properties Release tmp WEB-INF zoo.properties
五、初始化mysql
0-init_tables.sql
1-init_data.sql
201512/20151225.sql
20160701/20160701.sql
注意数据库执行的先后顺序,也可参考readme.md
删除默认用户
testUser1 ---testUser6
六、启动tomcat
更改tomcat ROOT.xml文件
vim conf/Catalina/localhost/ROOT.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/" docBase="/space/app/disconf" >
</Context>
七、部署nginx
upstream tomcat_disconf {
server 127.0.0.1:8001 weight=10 max_fails=2 fail_timeout=30s;
}
server
{
listen 80;
server_name 192.168.1.2;
access_log /space/servers/nginx/logs/disconf/disconf_access.log main;
error_log /space/servers/nginx/logs/disconf/disconf_error.log warn;
error_page 411 = @my_error;
location / {
root /space/app/disconf/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://tomcat_disconf;
}
}
八、访问disconf
http://192.168.1.2
user admin password admin