应开发需要,搭建个简要的disconf环境。
--------------------------------------------------
参考:http://blog.csdn.net/zhu_tianwei/article/details/49512751
--------------------------------------------------
系统环境:centos6.4
--------------------------------------------------
#jdk-1.7 因为都是使用最新版本,所以建议下载较新版本jdk,经测试1.6不能支撑编译
--------------------
[root@localhost opt]# rpm -Uvh jdk-7u79-linux-x64.rpm
[root@localhost 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
[root@localhost opt]# source /etc/profile
[root@localhost 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环境,第一次接触,记载详细些
--------------------
[root@localhost ~]# wget http://apache.opencas.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
[root@localhost ~]# tar -zxf apache-maven-3.3.9-bin.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/apache-maven-3.3.9/
[root@localhost apache-maven-3.3.9]# pwd
/usr/local/apache-maven-3.3.9
[root@localhost 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
[root@localhost apache-maven-3.3.9]# source /etc/profile
[root@localhost 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上
--------------------------
[root@localhost opt]# yum install git -y
[root@localhost opt]# git clone https://github.com/knightliao/disconf.git
[root@localhost opt]# ls disconf/
disconf-client disconf-core disconf-web LICENSE pom.xml README.md
[root@localhost opt]# mkdir -p /usr/local/disconf/{source,war}
[root@localhost 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
[root@localhost disconf]# mvn clean install
[root@localhost disconf]# cd disconf-web/
[root@localhost disconf-web]# cp src/main/resources/jdbc-mysql.properties application-demo.properties redis-config.properties zoo.properties /usr/local/disconf/source/
[root@localhost resources]# cd /usr/local/disconf/source/
[root@localhost source]# mv application-demo.properties application.properties
[root@localhost 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
[root@localhost 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
[root@localhost source]# cd /opt/disconf/disconf-web/
[root@localhost disconf-web]# sh deploy/deploy.sh
[root@localhost disconf-web]# ls /usr/local/disconf/war/
disconf-web.war html jpaas_control META-INF Release WEB-INF
--------------------
#mysql数据库,安装到了本地
--------------------
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[root@localhost ~]# yum install gcc gcc-c++ make vim -y
[root@localhost ~]# yum install mysql mysql-server mysql-devel -y
[root@localhost sql]# /etc/init.d/mysqld start
[root@localhost sql]# pwd
/opt/disconf/disconf-web/sql
[root@localhost sql]# mysql < 1-init_table.sql
[root@localhost sql]# mysql < 2-data.sql
[root@localhost sql]# mysql < 20141201/disconf.sql
[root@localhost sql]# mysql < 20141226/disconf.sql
[root@localhost sql]# mysql < 20150101/disconf.sql
[root@localhost sql]# mysql < 20150320/disconf.sql
[root@localhost sql]# mysql
mysql> grant all on *.* to 'root'@'192.168.110.2' identified by "123456" with grant option;
[root@localhost sql]# mysqladmin -u root -p password "123456"
Enter password: #####此处直接回车
-------------------------------------------------------------
#tomcat---disconf-web工程
------------------------------------------
[root@localhost ~]# wget http://apache.opencas.org/tomcat/tomcat-8/v8.0.30/bin/apache-tomcat-8.0.30.tar.gz
[root@localhost opt]# tar -zxf apache-tomcat-8.0.30.tar.gz -C /usr/local/
[root@localhost apache-tomcat-8.0.30]# pwd
/usr/local/apache-tomcat-8.0.30
[root@localhost apache-tomcat-8.0.30]# rm -rf webapps/* && rm -rf work/*
[root@localhost 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目录
[root@localhost classes]# pwd
/usr/local/disconf/war/WEB-INF/classes
[root@localhost 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
[root@localhost 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
--------------------------------------------------------------------------------------------------------
本文出自 “运维笔记” 博客,请务必保留此出处http://phospherus.blog.51cto.com/7824598/1729754