Distributed Configuration Management Platform(分佈式配置管理平臺)php
專一於各類 分佈式系統配置管理 的通用組件/通用平臺, 提供統一的配置管理服務。html
主要目標:java
部署極其簡單:同一個上線包,無須改動配置,便可在 多個環境中(RD/QA/PRODUCTION) 上線mysql
部署動態化:更改配置,無需從新打包或重啓,便可 實時生效jquery
統一管理:提供web平臺,統一管理 多個環境(RD/QA/PRODUCTION)、多個產品 的全部配置linux
支持微服務架構nginx
安裝Mysql(Ver 14.12 Distrib 5.0.45, for unknown-linux-gnu (x86_64) using EditLine wrapper)git
安裝Tomcat(apache-tomcat-7.0.50)github
安裝Nginx(nginx/1.5.3)web
安裝 zookeeeper (zookeeper-3.3.0)
安裝 Redis (2.4.5)
服務端部署
下載源碼,點此跳轉
導入IDE,以Intellij爲例
一共分爲三個模塊:
disconf-client是客戶端代碼
disconf-core是核心模塊
disconf-web是disconf的頁面管理控制檯
先部署disconf-web頁面
執行數據庫腳本:/disconf-web/sql下的腳本,順序以下:
- 0-init_table.sql create db,tables - 1-init_data.sql create data - 201512/20151225.sql patch
複製/disconf-web/profile/rd下的文件到/disconf/src/main/resources下
修改配置文件:jdbc-mysql.properties,redis-config.properties,zoo.properties,按照實際部署環境修改
啓動運行程序
瀏覽器輸入地址:http://localhost:8080/disconf-web/api/account/session,提示以下即部署成功
靜態文件部署
修改/disconf-web/html/assets/js/jquery-1.11.0.js文件,查找ajax8949行,修改以下
ajax: function( url, options ) { url.url ="/disconf-web"+url.url; // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; }
其中的disconf-web是本人的 服務器訪問前綴
Nginx部署
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name _; #root D:\Downloads\disconf-master\disconf-master\disconf-web\html; #index index.html; #charset koi8-r; #access_log logs/host.access.log main; location / { ##下載的源碼中的html靜態文件位置 root D:\Downloads\disconf-master\disconf-master\disconf-web\html; index index.html; } ##此處的disconf-web是本人的服務端前綴 location ~ ^/disconf-web/(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://127.0.0.1:8080; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root html; #} # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
啓動Nginx,訪問http://localhost/disconf/顯示以下:
點擊右上角登陸,輸入admin/admin
選擇app:disconf_demo,rd環境便可看到默認的部署配置
到此爲止,服務端以及頁面顯示完成。
客戶端使用能夠點此下載示例
注意事項:配置文件必定要properties結尾,在咱們開發中有時候以cfg結尾,在這裏是沒法讀取的