Pre-configuration environment requires:
- MySQL installation: https://blog.csdn.net/qq_37598011/article/details/93489404
- Zookeeper installation: https://blog.csdn.net/qq_37598011/article/details/88980317
- Nginx installation: https://blog.csdn.net/qq_37598011/article/details/93497219
- Redis installation: https://blog.csdn.net/qq_37598011/article/details/93490113
- Tomcat installation: https://blog.csdn.net/qq_37598011/article/details/93502809
Here because of the need Maven and Git so also need to install these two:
Maven
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum -y install apache-maven
Git
yum -y install git
Ok ~ Both can be installed up to code on GitHub got me.
Deployment Disconf
download
It should be three folders war, resource, src
mkdir -p /usr/local/disconf/{resource,src,war}
Then to the next disconf directory
cd /usr/local/disconf/
Disconf code from the pull to GitHub to the src
git clone https://github.com/knightliao/disconf.git
The configuration file used in the / usr / local / disconf / src / disconf / disconf-web / profile / rd path to the / usr / local / disconf / resource in
cp /usr/local/disconf/src/disconf/disconf-web/profile/rd/* /usr/local/disconf/resource/
Then to the next / usr / local / disconf / resource directory
cd /usr/local/disconf/resource/
The application-demo.properties rename the file rename application.properties
mv application-demo.properties application.properties
Modify the configuration file
It should be modified corresponding to the four profiles (application.properties, zoo.properties, redis-config.properties, jdbc-mysql.properties)
application.properties
vim application.properties
zoo.properties
vim zoo.properties
Here I am a single instance, if you want multi-instance reference: https://blog.csdn.net/qq_37598011/article/details/89319334
Here is a pit, hosts can not use 127.0.0.1 if you are testing a local instance of this time leads to zk is empty! ! ! !
redis-config.properties
vim redis-config.properties
jdbc-mysql.properties
vim jdbc-mysql.properties
Modify environment configuration
It should be the path to the configuration file path created by the war package and configuration environment variable.
vim /etc/profile
You need to be modified as follows
ONLINE_CONFIG_PATH=/usr/local/disconf/resource
WAR_ROOT_PATH=/usr/local/disconf/war
export ONLINE_CONFIG_PATH
export WAR_ROOT_PATH
Boot configuration
source /etc/profile
In addition to the need to modify the file pom disconf-web (JDK version if less than 1.8, this step need not be performed)
vim /usr/local/disconf/src/disconf/disconf-web/pom.xml
Content
<profile>
<id>doclint-java8-disable</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Construct
Executes the command (deploy directory under disconf-web in the deploy.sh)
This project is quite big side can build side modify Tomcat and Nginx configuration
sh /usr/local/disconf/src/disconf/disconf-web/deploy/deploy.sh
Tomcat configuration changes
The build will be labeled as war package is deployed to Tomcat, you need to modify the Tomcat's server.xml file
First Tomcat configuration directory, and then modified by vim
Modified as follows
<Context path="" docBase="/usr/local/disconf/war"></Context>
Then after disconf-web engineered completed do not forget to restart (the bin directory)
./shutdown.sh
./startup.sh
Nginx configuration changes
Nginx modify configuration files
vim /usr/local/nginx/conf/nginx.conf
My profile below
#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;
upstream disconf {
server 127.0.0.1:8080; #Tomcat的IP和端口号
}
server {
listen 8085;
server_name localhost; #这块要和application.properties中的domain属性相同
access_log /usr/local/disconf/access.log;
error_log /usr/local/disconf/error.log;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/disconf/war/html; #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;
}
#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;
# }
#}
}
Restart Nginx
cd /usr/local/nginx/sbin
./nginx -s reload
This time it can have access to static pages, but MySQL has not imported.
Initialize the database
Advanced to / usr / local / disconf / src / disconf / disconf-web / sql directory under
cd /usr/local/disconf/src/disconf/disconf-web/sql
Perform the following few commands, according to the order
mysql -h127.0.0.1 -uroot -p'123456' < 0-init_table.sql
mysql -h127.0.0.1 -uroot -p'123456' disconf < 1-init_data.sql
mysql -h127.0.0.1 -uroot -p'123456' disconf < 201512/20151225.sql
mysql -h127.0.0.1 -uroot -p'123456' disconf < 20160701/20160701.sql
OK~~~
http://192.168.75.128:8085/login.html
Admin can login, account passwords are.
OK ~~~ entire disconf distribution center has deployed a
reference
官网地址:https://disconf.readthedocs.io/zh_CN/latest/index.html
GitHub地址:https://github.com/knightliao/disconf/blob/master/docs/source/index.rst