首页 > 代码库 > disconf-2.6.36-部署

disconf-2.6.36-部署

基础环境
软件版本
安装基础环境
java
数据库
redis
zookeeper
maven
disconf
tomcat
nginx
浏览器访问

基础环境

  1. [root@node1 classes]# cat /etc/redhat-release
  2. CentOS Linux release 7.3.1611 (Core)
  3. 关闭防火墙:
  4. systemctl stop filewalld
  5. systemctl disable filewalld
  6. 关闭selinux
  7. sed -i ‘s#^SELINUX\=enforcing#SELINUX\=disabled#g‘ /etc/selinux/config
  8. setenforce 0
  9. 改成阿里源
  10. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  11. yum makecache

软件版本

  1. mariadb-5.5.52-1.el7.x86_64
  2. apache-maven-3.5.0-bin.tar.gz
  3. apache-tomcat-8.0.27.tar.gz
  4. disconf-master.zip
  5. jdk-8u60-linux-x64.tar.gz
  6. redis-3.2.9.tar.gz
  7. zookeeper-3.4.10.tar.gz
  8. nginx-1.12.0.tar.gz
  9. 所有安装包:/usr/local/src/
  10. 安装路径:/usr/local

安装基础环境

java

  1. tar xf jdk-8u60-linux-x64.tar.gz -C /usr/local/
  2. cd /usr/local/
  3. sed -i.ori ‘$a export JAVA_HOME=/usr/local/jdk1.8.0_60\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar‘ /etc/profile
  4. source /etc/profile
  5. 检查:
  6. [root@node1 conf]# java -version
  7. java version "1.8.0_60"
  8. Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
  9. Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

数据库

  1. yum install -y mariadb mariadb-server python2-PyMySQL
  2. systemctl start mariadb.service
  3. cd /usr/local/disconf-master/disconf-web/sql/
  4. mysql
  5. source 0-init_table.sql
  6. source 1-init_data.sql
  7. source 201512/20151225.sql
  8. source 20160701/20160701.sql
  9. set password for root@localhost = password(‘123456‘);
  10. GRANT ALL ON *.* TO ‘root@localhost‘;
  11. GRANT ALL ON *.* TO ‘root@%‘;
  12. flush privileges;

redis

  1. cd
  2. tar xf redis-3.2.9.tar.gz -C /usr/local/
  3. cd ../redis-3.2.9/
  4. make
  5. make PREFIX=/usr/local/redis-3.2.9 install
  6. echo $? #检查是否为0, 否则重新编译
  7. 成功标识:
  8. [root@node1 redis]# tree bin/
  9. bin/
  10. ├── redis-benchmark
  11. ├── redis-check-aof
  12. ├── redis-check-rdb
  13. ├── redis-cli
  14. ├── redis-sentinel -> redis-server
  15. └── redis-server
  16. [root@node1 local]#mv /usr/local/redis-3.2.9/ /usr/local/redis
  17. echo ‘PATH=/usr/local/redis/bin/:$PATH‘>>/etc/profile
  18. source /etc/profile
  19. mkdir /usr/local/redis/conf/{6379,6380}
  20. cp /usr/local/redis/redis.conf /usr/local/redis/conf/6379/
  21. cp /usr/local/redis/redis.conf /usr/local/redis/conf/6380/
  22. 修改6380/redis.conf配置文件
  23. port 6380
  24. 启动redis
  25. redis-server /usr/local/redis/conf/6379/redis.conf &
  26. redis-server /usr/local/redis/conf/6380/redis.conf &
  27. 检查:
  28. [root@node1 conf]# ps aux|grep redis
  29. root 7375 0.1 0.2 136920 7908 pts/1 Sl 22:32 0:04 redis-server 127.0.0.1:6379
  30. root 7378 0.0 0.2 136920 7904 pts/1 Sl 22:32 0:04 redis-server 127.0.0.1:6380

zookeeper

  1. tar xf zookeeper-3.4.10.tar.gz -C /usr/local/
  2. cd /usr/local/zookeeper-3.4.10/conf
  3. cp zoo_sample.cfg zoo.cfg
  4. /usr/local/zookeeper-3.4.10/bin/zkServer.sh start
  5. 检查:
  6. /usr/local/zookeeper-3.4.10/bin/zkServer.sh status
  7. ZooKeeper JMX enabled by default
  8. Using config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfg
  9. Mode: standalone

maven

  1. cd /usr/local/src/
  2. tar xf apache-maven-3.5.0-bin.tar.gz -C /usr/local/
  3. cd ../apache-maven-3.5.0/
  4. sed -i.ori ‘$a export MAVEN_HOME=/usr/local/apache-maven-3.5.0\nexport MAVEN_HOME\nPATH=$MAVEN_HOME/bin:$PATH\nexport PATH‘ /etc/profile
  5. source /etc/profile
  6. 检查
  7. [root@node1 conf]# mvn -version
  8. Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
  9. Maven home: /usr/local/apache-maven-3.5.0
  10. Java version: 1.8.0_60, vendor: Oracle Corporation
  11. Java home: /usr/local/jdk1.8.0_60/jre
  12. Default locale: en_US, platform encoding: UTF-8
  13. OS name: "linux", version: "3.10.0-514.16.1.el7.x86_64", arch: "amd64", family: "unix"

disconf

  1. cd /usr/local/src/
  2. unzip disconf-master.zip -d /usr/local/
  3. mkdir /usr/local/disconf/{source,war} -p
  4. cp disconf-master/disconf-web/profile/rd/* /usr/local/disconf/source/
  5. sed -i.ori ‘$a ONLINE_CONFIG_PATH=/usr/local/disconf/source\nWAR_ROOT_PATH=/usr/local/disconf/war\nexport ONLINE_CONFIG_PATH\nexport WAR_ROOT_PATH‘ /etc/profile
  6. source /etc/profile
  7. chmod -R 777 disconf/
  8. cd /usr/local/disconf-master/disconf-web/
  9. sh deploy/deploy.sh ## 等待一段时间,完成后echo $?检查
  10. 生成文件
  11. [root@node1 conf]# ls /usr/local/disconf/war/
  12. application-demo.properties disconf-web.war html jdbc-mysql.properties jpaas_control log log4j.properties logback.xml META-INF redis-config.properties Release tmp WEB-INF zoo.properties
  13. [root@node1 conf]# cp /usr/local/disconf/war/WEB-INF/classes/application-demo.properties /usr/local/disconf/war/WEB-INF/classes/application.properties
  14. [root@node1 conf]# cat /usr/local/disconf/war/WEB-INF/classes/zoo.properties
  15. hosts=10.0.0.10:2181 #不要127.0.0.1,换成自己固定IP
  16. # zookeeper\u7684\u524D\u7F00\u8DEF\u5F84\u540D
  17. zookeeper_url_prefix=/disconf

tomcat

  1. cd /usr/local/src/
  2. tar xf apache-tomcat-8.0.27.tar.gz -C /usr/local/
  3. mv /usr/local/apache-tomcat-8.0.27/ /usr/local/tomcat
  4. vim /usr/local/tomcat/conf/server.xml
  5. <Connector port="8015" protocol="HTTP/1.1" #修改成8015
  6. connectionTimeout="20000"
  7. redirectPort="8443" />
  8. <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
  9. prefix="localhost_access_log" suffix=".txt"
  10. pattern="%h %l %u %t &quot;%r&quot; %s %b" />
  11. <Context path="" docBase="/usr/local/disconf/war"></Context> #新增部分
  12. 启动:
  13. /usr/local/tomcat/bin/startup.sh

nginx

  1. cd /usr/local/src/
  2. tar xf nginx-1.12.0.tar.gz -C /usr/local/
  3. cd /usr/local/nginx-1.12.0
  4. useradd nginx -M -s /sbin/nologin
  5. ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-stream --with-http_stub_status_module --with-http_ssl_module
  6. make
  7. make install
  8. mkdir /usr/local/nginx/vhosts -p
  9. [root@node1 ~]# cat /usr/local/nginx/nginx.conf
  10. worker_processes 4;
  11. error_log logs/error.log notice;
  12. #pid logs/nginx.pid;
  13. events {
  14. worker_connections 1024;
  15. }
  16. http {
  17. include mime.types;
  18. default_type application/octet-stream;
  19. log_format main ‘$remote_addr\t$upstream_addr\t[$time_local]\t "$request"\t‘
  20. ‘$status\t‘
  21. ‘$request_time\t$upstream_response_time\t"$request_body"‘;
  22. client_max_body_size 100m;
  23. client_header_buffer_size 256k;
  24. large_client_header_buffers 4 256k;
  25. sendfile on;
  26. tcp_nopush on;
  27. tcp_nodelay on;
  28. server_tokens off;
  29. keepalive_timeout 75;
  30. client_header_timeout 3m;
  31. client_body_timeout 3m;
  32. send_timeout 3m;
  33. gzip on;
  34. gzip_min_length 1k;
  35. gzip_buffers 4 16k;
  36. gzip_http_version 1.0;
  37. gzip_comp_level 5;
  38. gzip_types text/plain application/x-javascript text/css application/xml;
  39. gzip_vary on;
  40. include vhosts/*.conf;
  41. }
  42. [root@node1 ~]# cat /usr/local/nginx/vhosts/disconf.conf
  43. upstream disconf {
  44. server 127.0.0.1:8015;
  45. }
  46. server {
  47. listen 8081;
  48. server_name localhost;
  49. access_log /var/log/disconf/access.log;
  50. error_log /var/log/disconf/error.log;
  51. location / {
  52. root /usr/local/disconf/war/html;
  53. if ($query_string) {
  54. expires max;
  55. }
  56. }
  57. location ~ ^/(api|export) {
  58. proxy_pass_header Server;
  59. proxy_set_header Host $http_host;
  60. proxy_redirect off;
  61. proxy_set_header X-Real-IP $remote_addr;
  62. proxy_set_header X-Scheme $scheme;
  63. proxy_pass http://disconf;
  64. }
  65. location = /favicon.ico {
  66. log_not_found off;
  67. access_log off;
  68. }
  69. }
  70. mkdir -p /var/log/disconf/
  71. touch /var/log/disconf/access.log
  72. touch /var/log/disconf/error.log
  73. /usr/local/nginx/sbin/nginx -t
  74. systemctl start nginx

浏览器访问

http://10.0.0.10:8081
用户:admin
密码:admin
效果图:

技术分享

disconf-2.6.36-部署