liunx下disconf环境搭建吐血总结

组内组织分享,我就选了个disconf,以为没难度,没想到最大的难度居然是搭建起来disconf的环境,以下是个人的吐血总结,希望留一个记录,也能让后来人能少走弯路,如果你不知道disconf 是什么,就没必要向下看了。

需要安装的软件:
1,jdk
2,maven
3,redis
4,zookeeper
5,tomcat
6,mysql
7,Nginx

1,安装jdk6或者7【千万别安装8】

这个没啥好说的,去网上找安装教程就行了,就是别安装1.8. 。 disconf 内用的是1.6, 1.7可以支持, 但是用1.8进行编译打包会报错. 最难受的是1.7官网已经不维护,下载不到了。

参考文章:https://jingyan.baidu.com/article/91f5db1bdb7ee41c7e05e373.html

2,安装maven
同样安装maven3就可以了,同样按照网上的教程就可以。注意的是如果你是公司网络的话,maven仓库最好改成公司私服。
参考文章:http://blog.163.com/jiayouweijiewj@126/blog/static/171232177201011239340602/##1

3,安装redis
这个要安装集群,disconf要求两个节点,但是redis集群至少要求6个,安装集群就可以了,disconf的redis配置文件中有密码和别名,这个不用管,安装集群之后写两个节点的信息上去就可以了,ip和端口。
参考文章:http://blog.csdn.net/mchine_swift/article/details/78461856

4,安装Nginx
Nginx的安装正常安装就可以。
参考文章:http://blog.csdn.net/dyllove98/article/details/8892509

5,Tomcat安装
这个应该是最简单的了,解压就可以。

6,mysql安装
mysql安装好待用,设置密码为root、root就可以
https://jingyan.baidu.com/article/84b4f565964fb560f6da32e7.html##1

7,zookeeper安装
zookeeper安装也没啥好说的,解压之后待用就可以了。

https://jingyan.baidu.com/article/3a2f7c2e2a370626afd6119d.html

8.mysql安装
用户名改为root root

http://blog.csdn.net/wangpengzhi19891223/article/details/79046119


正题来了:

1,https://github.com/knightliao/disconf 下载disconf-master.zip

2, 假设我们要在 /usr/disconf 下操作: 在该文件夹下新建两个文件夹:online-resources 和 war

nkdir online-resources
mkdir war

3,用Xftp工具拷贝四个文件到online-resources

application-demo.properties
jdbc-mysql.properties(mysql数据库连接的配置)
redis-config.properties(redis连接的配置)
zoo.properties(zookeeper的配置)

4,解压disconf-master.zip到 /usr/disconf/code下面

unzip disconf-master.zip

5,进入disconf-master 执行 mvn clean install 打包编译。

cd disconf-master
mvn clean package

【jdk版本和disconf不匹配,这里可能会报错】

6,进入disconf-web中执行 : sh deploy/deploy.sh

cd disconf-web
sh  deploy/deploy.sh 

7, 查看 /usr/disconf/war下是否我打包之后的几个文件夹和文件了

-disconf-web.war    
-html    
-jpaas_control  
-META-INF    
-Release  
-tmp  
-WEB-INF 

8,修改和启动Nginx:

  • 将disconf-stable/disconf-web/html复制到/usr/disconf/war/
  • 修改Nginx的配置文件修改对应内容为如下配置:
upstream disconf {
        server 127.0.0.1:8080; #tomcat服务器的地址
    }

    server {
        listen       8091;
        server_name  localhost;
        location / {
            root /usr/disconf/war/html;
            index  index.html;
        }
        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;
        }
    }
  • 添加Nginx配置到系统配置中:
配置环境变量

ONLINE_CONFIG_PATH=/usr/disconf/online-resources
WAR_ROOT_PATH=/usr/disconf/war  
export ONLINE_CONFIG_PATH  
export WAR_ROOT_PATH  
注意:执行 source /etc/profile 否则环境变量不生效。

9,修改tomcat的server.xml文件:

修改server.xml文件,在Host结点下添加Context:
<Context path="" docBase="/hadoop/disconf/war"></Context>

10.启动mysql并初始化数据库,顺序执行四个SQL文件:

0-init_table.sql
1-init_data.sql
201512/20151225.sql
20160701/20160701.sql

11, 启动redis集群和zookeeper

12, 启动tomcat,并查看日志有无报错。

13,关闭liunx防火墙,访问:ip:8091

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

专注网赚的程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值