centos6.5环境disconf管理端安装配置详解

操作系统:centos6.5 x86_64

安装目录/data

1.安装nginx1.10.1
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install -y nginx
service nginx start

2.安装jdk

rpm -ivh jdk-8u102-linux-x64.rpm

3.maven的安装
tar -zxvf apache-maven-3.2.5-bin.tar.gz
mv apache-maven-3.2.5 maven

执行 vi /etc/profile 文件,插入如下内容
 
export M2_HOME=/data/maven
PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
 
保存并退出VI编辑器,执行 source /etc/profile 命令使改动生效
 
执行 mvn -v 命令,如出现如下内容表示安装配置成功

mvn -v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)
Maven home: /data/maven
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_102/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"

4.安装mysql5.7
下载
mysql-community-client-5.7.15-1.el6.x86_64.rpm
mysql-community-common-5.7.15-1.el6.x86_64.rpm
mysql-community-libs-5.7.15-1.el6.x86_64.rpm
mysql-community-server-5.7.15-1.el6.x86_64.rpm

yum localinstall -y mysql-community*.rpm

报错:
Error: Package: 2:postfix-2.6.6-6.el6_7.1.x86_64 (localyum)
           Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit)
           Removing: mysql-libs-5.1.71-1.el6.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
               libmysqlclient.so.16(libmysqlclient_16)(64bit)
           Obsoleted By: mysql-community-libs-5.7.15-1.el6.x86_64 (/mysql-community-libs-5.7.15-1.el6.x86_64)
               Not found
           Updated By: mysql-libs-5.1.73-7.el6.x86_64 (localyum)
               libmysqlclient.so.16(libmysqlclient_16)(64bit)
Error: Package: 2:postfix-2.6.6-6.el6_7.1.x86_64 (localyum)
           Requires: libmysqlclient.so.16()(64bit)
           Removing: mysql-libs-5.1.71-1.el6.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
               libmysqlclient.so.16()(64bit)
           Obsoleted By: mysql-community-libs-5.7.15-1.el6.x86_64 (/mysql-community-libs-5.7.15-1.el6.x86_64)
               Not found
           Updated By: mysql-libs-5.1.73-7.el6.x86_64 (localyum)
               libmysqlclient.so.16()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
解决办法:
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

mysql5.7初始化:

vim /etc/my.cnf
加入
skip-grant-tables
service mysqld restart

修改密码:
mysql
use mysql;

# 修改密码
update user set authentication_string = password('yourpasswd'), password_expired = 'N', password_last_changed = now() where user = 'root';

删掉my.cnf的skip-grant-tables再次重启数据库即可

5.安装redis 2.4.10
yum install -y redis
service redis start

6.安装zookeeper

tar -zxvf zookeeper-3.4.6.tar.gz 
cd zookeeper-3.4.6/conf
cp zoo_sample.cfg zoo.cfg
mkdir /data/zookeeper-3.4.6/data
mkdir /data/zookeeper-3.4.6/logs

修改配置:
vim zoo.conf

tickTime=2000 
initLimit=10 
syncLimit=5 
dataDir=/data/yunva/zookeeper-3.4.6/logs
dataLogDir=/data/yunva/zookeeper-3.4.6/logs
lientPort=2181
#自动清除日志文件
autopurge.snapRetainCount=20
autopurge.purgeInterval=48

启动:
bin/zkServer.sh start

查看状态:
bin/zkServer.sh status
JMX enabled by default
Using config: /data/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: standalone

7.去Git上面下载disconf-master的源码
地址:https://codeload.github.com/knightliao/disconf/zip/master
解压:unzip disconf-master.zip

创建两个文件夹online-resources和war。
1>创建online-resources和war目录
 
mkdir -p /data/disconf/online-resources  
mkdir -p /data/disconf/war

online-resources:放的是四个配置文件(四个所在文件位置disconf-master/disconf-web/profile/rd的目录下)

application-demo.properties(邮件配置163)
jdbc-mysql.properties(mysql数据库连接的配置)
redis-config.properties(redis连接的配置)
zoo.properties(zookeeper的配置)
1.首先将四个配置文件拷贝到/data/disconf/online-resources 
cd /data/disconf-master/disconf-web/profile/rd
cp application-demo.properties jdbc-mysql.properties redis-config.properties zoo.properties /data/disconf/online-resources/

2.application-demo.properties改成application.properties
mv application-demo.properties application.properties

3.四个配置文件夹可以在这里修改了,如果熟悉redis。zookeeper的话直接修改就行,反之使用默认就可以。

2>
cd /data/disconf-master 
mvn clean install  
确保所有mvn命令能buildsuccess。
因为Maven执行 mvn clean install 的时候会出现下载不到jar包,所以的手动添加jar包(网上可自行搜索maven手动添加jar包)。

3>配置环境变量
vim /etc/profile

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

4>
cd /data/disconf-master/disconf-web 
sh deploy/deploy.sh 
注意:执行过程中也会出现下载不到jar包,所以的手动添加jar包(网上可自行搜索maven手动添加jar包)。

执行完毕会在新建的/data/disconf/war下出现如下目录
-disconf-web.war    
-html    
-jpaas_control  
-META-INF    
-Release  
-tmp  
-WEB-INF

4.初始化数据库

按照disconf-master/disconf-web/sql/readme.txt说明
----------------------------
为了方便大家开发,统一了所有SQL,请先后执行:

- 0-init_table.sql        create db,tables
- 1-init_data.sql         create data
- 201512/20151225.sql     patch
- 20160701/20160701.sql   patch
----------------------------

按照顺序导入数据
默认username=root,password=123456
建议初始化完毕以后看一下其中的数据
cd /data/disconf-master/disconf-web/sql/
mysql -uroot -proot <0-init_table.sql
mysql -uroot -proot -Ddisconf<1-init_data.sql
mysql -uroot -proot -Ddisconf<201512/20151225.sql
mysql -uroot -proot -Ddisconf<20160701/20160701.sql

5.下载apache-tomcat-8.0.37.zip解压,配置tomcat。
主要就是把上面生成的war包部署到tomcat的容器中,tomcat和disconf必须部署到同一台主机上。

修改server.xml文件,在Host结点下添加Context:

<Context path="" docBase="/data/disconf/war"></Context>
注意上面的路径是war包存放的路径,启动tomcat之后测试远程端口能不能正常访问。
centos6.5环境disconf管理端安装配置详解

6.配置Nginx
vim /etc/nginx/conf.d/disconf.conf

upstream disconf {  
    server 127.0.0.1:8080;  
}

server {  
    listen   8000;  # 该配置会覆盖
    server_name localhost;  
    access_log /var/log/nginx/disconf_access.log;  
    error_log /var/log/nginx/disconf_error.log;  
  
    location / {  
        root /data/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;  
    }  
}

修改/data/disconf/war/WEB-INF/classes目录下的相关配置文件

zoo.properties
hosts=127.0.0.1:2181

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.client1.password=

redis.group1.client2.name=BeidouRedis2
redis.group1.client2.host=127.0.0.1
redis.group1.client2.port=6380
redis.group1.client2.timeout=5000
redis.group1.client2.password=

redis.evictor.delayCheckSeconds=300
redis.evictor.checkPeriodSeconds=30
redis.evictor.failedTimesToBeTickOut=6
--------------------------------------------

jdbc-mysql.properties
修改root密码配置

7.浏览器里面输入nginx的ip和端口访问,通过http://你的ip:8000/即可访问  
http://106.75.61.21:8000/login.html

默认用户:admin/admin

centos6.5环境disconf管理端安装配置详解

centos6.5环境disconf管理端安装配置详解

上一篇:4.linux下配置Golang的环境变量


下一篇:【插头DP】hdu1964-Pipes