disconf安装部署

1.client

pom文件引入
<dependency>
    <groupId>com.baidu.disconf</groupId>
    <artifactId>disconf-client</artifactId>
    <version>2.6.36</version>
</dependency>

2.web

1.依赖软件mysql、tomcat、nginx、zookeeper、redis
2.git下载disconf(https://github.com/knightliao/disconf.git)
3.创建两个文件夹:source(配置文件)、war(war包)
4.将上述两个文件夹路径引入环境变量
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
source /etc/profile
5.cd disconf/disconf-web
6.sh deploy/deploy.sh(一定在disconf-web下运行)
注:1.文件必须从git拉取,不要从window传到linux

3.配置tomcat

tomcat/conf/server.xml中Host节点加入war包路径:
<Context path="" docBase="/usr/local/disconf/war"></Context>

4.配置nginx

nginx.conf中http节点加入:
upstream disconf {
    server 127.0.0.1:8080;//如果tomcat中war包部署端口一致
}

server {

    listen   8888;//浏览器访问端口
    server_name disconf.com;
    access_log /usr/local/nginx/logs/disconf/access.log;
    error_log /usr/local/nginx/var/logs/disconf/error.log;

    location / {
        root /usr/local/disconf/war/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;
    }
}

5.使用

启动tomcat和nginx,访问http://localhost:8888/

posted @ 2016-10-25 14:30  琅琊天  阅读(1961)  评论(0编辑  收藏  举报