应开发需要,搭建个简要的disconf环境。
--------------------------------------------------
参考:http://blog.csdn.net/zhu_tianwei/article/details/49512751
--------------------------------------------------
系统环境:centos6.4
--------------------------------------------------
#jdk-1.7 因为都是使用最新版本,所以建议下载较新版本jdk,经测试1.6不能支撑编译
--------------------
[[email protected] opt]# rpm -Uvh jdk-7u79-linux-x64.rpm
[[email protected] opt]# tail -n 5 /etc/profile
#set java environment
export JAVA_HOME=/usr/java/jdk1.7.0_79
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME CLASSPATH PATH
[[email protected] opt]# source /etc/profile
[[email protected] opt]# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
-----------------------------------------------------------
#maven环境,第一次接触,记载详细些
--------------------
[[email protected] ~]# wget http://apache.opencas.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
[[email protected] ~]# tar -zxf apache-maven-3.3.9-bin.tar.gz -C /usr/local/
[[email protected] ~]# cd /usr/local/apache-maven-3.3.9/
[[email protected] apache-maven-3.3.9]# pwd
/usr/local/apache-maven-3.3.9
[[email protected] apache-maven-3.3.9]# cat >> /etc/profile << EOF
> MAVEN_HOME=/usr/local/apache-maven-3.3.9
> export MAVEN_HOME
> PATH=$MAVEN_HOME/bin:$PATH
> export PATH
> EOF
[[email protected] apache-maven-3.3.9]# source /etc/profile
[[email protected] apache-maven-3.3.9]# mvn -version
which: no javac in (/usr/local/apache-maven-3.3.9/bin:/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
Warning: JAVA_HOME environment variable is not set.
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/apache-maven-3.3.9
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.el6.x86_64", arch: "amd64", family: "unix"
----------------------------------------------------------------------------------
#disconf
#此应用托管在github上
--------------------------
[[email protected] opt]# yum install git -y
[[email protected] opt]# git clone https://github.com/knightliao/disconf.git
[[email protected] opt]# ls disconf/
disconf-client disconf-core disconf-web LICENSE pom.xml README.md
[[email protected] opt]# mkdir -p /usr/local/disconf/{source,war}
[[email protected] opt]# cat >> /etc/profile << EOF
> ONLINE_CONFIG_PATH=/usr/local/disconf/source
> WAR_ROOT_PATH=/usr/local/disconf/war
> export ONLINE_CONFIG_PATH
> export WAR_ROOT_PATH
> EOF
[[email protected] disconf]# mvn clean install
[[email protected] disconf]# cd disconf-web/
[[email protected] disconf-web]# cp src/main/resources/jdbc-mysql.properties application-demo.properties redis-config.properties zoo.properties /usr/local/disconf/source/
[[email protected] resources]# cd /usr/local/disconf/source/
[[email protected] source]# mv application-demo.properties application.properties
[[email protected] source]# more redis-config.properties
redis.group1.retry.times=2
redis.group1.client1.name=BeidouRedis1
redis.group1.client1.host=127.0.0.1
redis.group1.client1.port=6379
redis.group1.client1.timeout=5000
redis.group1.client2.name=BeidouRedis2
redis.group1.client2.host=127.0.0.1
redis.group1.client2.port=6380
redis.group1.client2.timeout=5000
redis.evictor.delayCheckSeconds=300
redis.evictor.checkPeriodSeconds=30
redis.evictor.failedTimesToBeTickOut=6
[[email protected] source]# more zoo.properties ####此处配置地址为zookeeper地址,不能为127.0.0.1,需为具体IP地址,开发调用的时候会出线问题。
hosts=127.0.0.1:8581
# zookeeper\u7684\u524D\u7F00\u8DEF\u5F84\u540D
zookeeper_url_prefix=/disconf
[[email protected] source]# cd /opt/disconf/disconf-web/
[[email protected] disconf-web]# sh deploy/deploy.sh
[[email protected]host disconf-web]# ls /usr/local/disconf/war/
disconf-web.war html jpaas_control META-INF Release WEB-INF
--------------------
#mysql数据库,安装到了本地
--------------------
[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[[email protected] ~]# yum install gcc gcc-c++ make vim -y
[[email protected] ~]# yum install mysql mysql-server mysql-devel -y
[[email protected] sql]# /etc/init.d/mysqld start
[[email protected] sql]# pwd
/opt/disconf/disconf-web/sql
[[email protected] sql]# mysql < 1-init_table.sql
[[email protected] sql]# mysql < 2-data.sql
[[email protected] sql]# mysql < 20141201/disconf.sql
[[email protected] sql]# mysql < 20141226/disconf.sql
[[email protected] sql]# mysql < 20150101/disconf.sql
[[email protected] sql]# mysql < 20150320/disconf.sql
[[email protected] sql]# mysql
mysql> grant all on *.* to ‘root‘@‘192.168.110.2‘ identified by "123456" with grant option;
[[email protected] sql]# mysqladmin -u root -p password "123456"
Enter password: #####此处直接回车
-------------------------------------------------------------
#tomcat---disconf-web工程
------------------------------------------
[[email protected] ~]# wget http://apache.opencas.org/tomcat/tomcat-8/v8.0.30/bin/apache-tomcat-8.0.30.tar.gz
[[email protected] opt]# tar -zxf apache-tomcat-8.0.30.tar.gz -C /usr/local/
[[email protected] apache-tomcat-8.0.30]# pwd
/usr/local/apache-tomcat-8.0.30
[[email protected] apache-tomcat-8.0.30]# rm -rf webapps/* && rm -rf work/*
[[email protected] apache-tomcat-8.0.30]# vim conf/server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/usr/local/disconf/war"></Context> ###此处为添加disconf目录
[[email protected] classes]# pwd
/usr/local/disconf/war/WEB-INF/classes
[[email protected] classes]# grep File log4j.properties
log4j.appender.dailyRolling=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dailyRolling.File=/usr/local/apache-tomcat-8.0.30/log/disconf-log4j.log
[[email protected] classes]# grep property logback.xml
<property name="log.base" value="/usr/local/apache-tomcat-8.0.30/log/disconf-web"/>
<property name="log.monitor" value="/usr/local/apache-tomcat-8.0.30/log/monitor"/>
--------------------------------------------------------------------------------------------------------
#nginx 直接使用tengine,配置文件参考官方文档
参考链接:https://github.com/knightliao/disconf/tree/master/disconf-web
--------------------------------------------------------------------------------------------------------
#redis 或者redis-cluster
--------------------------------------------------------------------------------------------------------
#zookeeper单节点或集群
参考链接:http://www.cnblogs.com/linjiqin/archive/2013/03/16/2962597.html
--------------------------------------------------------------------------------------------------------