Write in front:
Blog for a long time not updated excuses a lot, but let me return to the reason is very simple, around the people are too excellent I can not stop the pace of progress.
Body:
Today to summarize is Distributed file Management-disconf (Baidu Open Source), as to why to choose this I can only irresponsible say all rely on word of mouth, as to Ali or 360 of my own has not used, so dare not under what conclusion, in the use of disconf when still encountered some problems.
For Disconf's introduction http://www.tuicool.com/articles/QniqQn7 is also described here is relatively clear, the official documents are very detailed: http://disconf.readthedocs.io/zh_CN/ latest/install/src/02.html One, install
I personally encountered some problems during the installation process, so I organized a small white installation document
1. Install dependent software installation MySQL (Ver 14.12 distrib 5.0.45, for Unknown-linux-gnu (x86_64) using Editline Wrapper
Installing Tomcat (apache-tomcat-7.0.50)
Installing Nginx (nginx/1.5.3)
Installing Zookeeeper (zookeeper-3.3.0)
Install Redis (2.4.5) 2, download disconf Create folder:/usr/local/work/disconf
Under the root folder
Create source folder: SRC
Create resource File Folder: Resource
Create War folder: War download disconf to src execution command:
git clone https://github.com/knightliao/disconf.git
3. Initialize the database
Refer to Sql/readme.md for initialization of the database. Note Sequential execution
0-init_table.sql
1-init_data.sql
201512/20151225.sql
20160701/20160701.sql 4, build 4.1 Copy/disconf-web/profile/rd/directory under the resource file folder you just created
Execute the following command in the usr/local/work/disconf/src/discof/disconf-web/profile/rd/directory:
CP Application-demo.properties/usr/local/work/disconf/resource/application.properties
As shown in figure:
4.2 Modifying the configuration file:
Redis
Jdbc:
Zoo
4.3 build
Execute command under Disconf-web:
MVN Clean Install-dmaven.test.skip=true
If there is no MVN command, the installation executes the following command sequentially:
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
Note: If the service JDK version is 1.8 required to modify the Pom file for the Web project, add the Pom file:
<profiles>
<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>
</profiles>
As shown in the figure:
War Pack:
Execute the following command:
Online_config_path=/usr/local/work/disconf/resource
War_root_path=/usr/local/work/disconf/war
Export Online_config_path
Export War_root_path
Disconf-web execute the following command:
SH deploy/deploy.sh
Deployment completion will generate a war package Tomcat deployment under target
Install tomcat;
Modify the Server.xml configuration file for Tomcat to add under the host node:
<context path= "" docbase= "/usr/local/work/disconf/war" ></Context>
Start Tomcat
Nginx Deployment:
For installation of Nginx, please refer to nginx installation documentation
In nginx.conf (if installed by default, the nginx.conf file path is/etc/nginx/), add the following:
Add under the HTTP node:
Upstream disconf {
Server 127.0.0.1:9090;
}
Under the server node, add:
Location/{
root/usr/local/work/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;
}
server_name add Value disconf.com
As shown in figure:
Start Nginx to complete deployment; Access 192.168.22.208:8080 access
Default User name password is admin admin
The effect is as shown in the figure:
Second, use
1, in my current project, about seven or eight modules are deployed on the same server, in the configuration file Disconf.properties Disconf.user_define_download_dir=./config
Value if all the items are configured identically, all the profiles will be downloaded to that directory and will be overwritten due to the same configuration file name for all modules, resulting in a disorderly read of the configuration file.
2, the current disconf if you do not develop, is not support the configuration of public variables (that is, can not read multiple apps), so all modules of the same configuration file how to handle it. Our Project uses NFS to share common configuration files, of course, if there are good other ways to welcome the recommendation Yo.
3, in fact, there are still many problems in the use of our project,
①: If a factory class loads the configuration file, it will not load when the reload, should be related to reflection, there is no solution
②: The class that detects disconf consumes the server's memory, and so on, some of the other users do not know how this feeling.
③:zookeeper's listening log is how to control the printing on the Web side, our solution is to control the print level of the local log, but this scheme affects the printing of our system log, welcome to propose a better solution.