disconf Practice (i) Ubuntu16.04 deployment disconf

Source: Internet
Author: User
Tags zookeeper

In the enterprise, with the expansion of the company's business, the increase of user volume, single node application can not support the normal business logic, the more common phenomenon is the access speed is slow, or even timeout, serious may cause system downtime. In order to minimize the risk of downtime, a single-node system needs to be scaled horizontally, using a distributed-divide-and-conquer approach to handle massive requests, allocating pressure on individual nodes, and making the system overall highly available. But distributed also poses some challenges, such as the management of configuration files. If a configuration is to be modified, then all nodes are modified, and when faced with large-scale clusters, it is easy to correct or change the leak. Therefore, you need a unified configuration Management Center to manage the configuration, centrally modify a configuration file, all machines can be automatically synchronized. Disconf is the Baidu Open Source Configuration Management Center.

The following is a reference to the official open source document on a single node to build, document address: Https://github.com/knightliao/disconf/tree/master/disconf-web

Operating system: Ubuntu Server 16.04 64bit

1 Installing dependent software

Install MySQL, Tomcat, Nginx, Zookeeper, Redis, and pre-Configure the JDK (Java_home) and MAVEN (maven_home) environments.

2 download Disconf-web, and install

: Https://github.com/knightliao/disconf/tree/master/disconf-web

2.1 Preparing the configuration

Store your profile in this directory (the following address can be set by itself)

$HOME/app/disconf-rd/online-resources

If you do not know how to configure, you can copy the files in the Disconf-web/profile/rd directory, copy the past and then modify.

Configuration files include:

-jdbc-mysql.properties (Database configuration) primarily modifies the database's host and MySQL username and password -redis-config.properties (Redis configuration) Mainly modifies the host and port of 2 instances - zoo.properties (zookeeper configuration) mainly modifies the hosts inside, specifying the port of the host of the zookeeper cluster - Application.properties (application configuration)    This file is primarily configured with server and email addresses for monitoring mail delivery and acceptance

Note, remember to perform a copy of application-demo.properties into application.properties:

Cp

Note that even if you have only one redis, you should configure two Redis clients, otherwise an internal error will result.

Set the address where the war package will be deployed (the following address can be set by itself)

$HOME/app/disconf-rd/war
2.2 Build

Since Ubuntu 16.04 has abandoned python2.x, use python3.x, so you need to first Deploy/deploy. the python command in SH is modified to Python3.

$ online_config_path= $HOME/app/disconf-rd/online-resources$ war_root_path= $HOME/app/disconf-rd/war$ Export online_config_path$ Export war_root_path$ CD disconf-sh deploy/deploy. SH

The following error occurred during the build process:

 Last ):  "build.py" in<module>    '  Reload' is not defined

How to Modify: Import Reload method in html/build.py :

 from Import Reload # in Python 2.x, reload () is a builtin, but in 3.x, it's in the imp module.

Re-build and repeat the error:

 traceback (most recent call last): File   build.py   ", line, in  <module> sys.setdefaultencoding ( "  utf-8   ") #   @UndefinedVariable  Attributeerror:module  " sys  "  has No attribute  " setdefaultencoding   " 

How to modify: sys.setdefaultencoding ('utf-8') is commented out in html/build.py . Because UTF-8 encoding is used by default in Python3, no display settings are required.

This produces the following results in the $HOME/app/disconf-rd/war:

-disconf-Web.war  -html  -meta-INF  -web-inf
2.3 Pre-launch initialization work

Initialize the database:

You can refer to SQL/README.MD for initialization of the database. Note the sequential execution of 0-init_table.sql, 1-init_data.sql, 201512/20151225.sql, 20160701/20160701.sql.

To deploy the war:

Modify the Server.xml file to set the context under the host node:

<context path="" docbase="/home/jason/app/disconf-rd/war"></context >

and set the port to 8015, start Tomcat, then.

Deployment front-end:

Inside the HTTP node, add:

Upstream disconf {    server 127.0.0.1:8015;} server {    listen   8081;    server_name disconf.com;    Access_log/home/jason/app/disconf-rd/logs/access.log;    Error_log/home/jason/app/disconf-rd/logs/error.log;    Location/{        root/home/jason/app/disconf-rd/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;    }}

The port in the upstream disconf configuration must be the same as the Tomcat-initiated port.
The listen in server is the port that launches the disconf front-end.
You need to modify the location of Access_log and error_log to specify log.
The disconf uses a front-to-back separation deployment, with the frontend configured in Nginx and the backend API deployed in Tomcat.

2.4 Start

Launch Tomcat and Nginx separately, then browser access: http://ip:8081/, using username Admin and password Admin to enter the system, this disconf Web operation service is completed.

The interface is as follows:

disconf Practice (i) Ubuntu16.04 deployment disconf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.