disconf-搭建

  1. 环境配置
    disconf运行需要如下软件:mysql、nginx、tomcat、zookeeper、redis,这个网上可以找到很多种安装配置的方法
  2. clone disconf
    disconf的代码在github上开源了,是一个很好的分布式配置管理平台,github上很多人fork了
    下载至本地
    cd work/github
    git clone https://github.com/knightliao/disconf.git
  3. 修改环境变量
    sudo vi /etc/profile,在文件的末尾加上
    ONLINE_CONFIG_PATH=/usr/local/xxx/disconf/source
    WAR_ROOT_PATH=/usr/local/xxx/disconf/war
    export ONLINE_CONFIG_PATH
    export WAR_ROOT_PATH
    注意:disconf这个文件夹必须有写的权限
  4. 修改配置
    cp work/github/disconf/disconf-web/profile/rd/application-demo.properties jdbc-mysql.properties redis-config.properties zoo.properties log4j.properties logback.xml rabbit.properties /usr/local/xxx/disconf/source
    application-demo.properties修改成application.properties(mv或者cp命令都可以)
    然后将/usr/local/xxx/disconf/source下的这4个配置文件修改成自己环境相关的配置
    application.properties
    该文件中主要是配置了监控邮件发送和接受的服务器和邮箱地址
    zoo.properties
    主要修改里面的hosts,指定zookeeper集群的host的端口
    jdbc-mysql.properties
    主要修改数据库的host和mysql的用户名和密码
    redis-config.properties
    主要修改2个实例的host和端口
    rabbit.properties
    修改用户名和密码以及端口(自己安装的默认端口是5672)
    log4j.properties
    主要修改日志存放的路径
    log4j.appender.dailyRolling.File=/home/xxx/xxx/tomcat/log/disconf-log4j.log
    logback.xml
    主要修改web和监控的log存放位置
    <property name="log.base" value="/home/xxx/tomcat/log/disconf-web"/>
    <property name="log.monitor" value="/home/xxx/tomcat/log/monitor"/>
  5. 生成war包
    cd disconf/disconf-web
    sh deploy/deploy.sh
    然后会发现war的内容会生成在/usr/local/xxx/disconf/war这个文件夹下
  6. 初始化数据库
    如何初始化根据disconf-web下的sql文件夹下的README.md来初始化
  7. tomcat配置
    在tomcat的server.xml中加入
    <Context path="" docBase="/usr/local/xxx/disconf/war"></Context>
  8. nginx配置
    在http这个标记对里面加上如下配置(/etc/nginx/nginx.conf):
    upstream disconf {
        server 127.0.0.1:8080;
    }

     

    server {
        listen 8991;
        server_name localhost;
        access_log /home/xxx/nginx/log/disconf/access.log;
        error_log /home/xxx//nginx/log/disconf/error.log;

     

        location / {
            root /usr/local/xxx/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;
        }
    }
    upstream disconf 配置中的端口必须与tomcat启动的端口一致
    server中listen是启动该disconf前端的端口
    里面需要修改access_log和error_log指定log的位置
    disconf使用前后端分离的部署方式,前端配置在nginx是那个,后端api部署在tomcat中
  9. 启动
    分别启动tomcat和nginx,打开浏览器:http://localhost:8991/
    使用用户名admin和密码admin进入系统
    至此disconf的web操作服务搭建完成
    大概长成下面的样子,接下去需要了解如何使用该平台
参考: https://github.com/knightliao/disconf/wiki
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值