首页 > 代码库 > disconf-2.6.36-部署
disconf-2.6.36-部署
基础环境
软件版本
安装基础环境
java
数据库
redis
zookeeper
maven
disconf
tomcat
nginx
浏览器访问
软件版本
安装基础环境
java
数据库
redis
zookeeper
maven
disconf
tomcat
nginx
浏览器访问
基础环境
[root@node1 classes]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
关闭防火墙:
systemctl stop filewalld
systemctl disable filewalld
关闭selinux
sed -i ‘s#^SELINUX\=enforcing#SELINUX\=disabled#g‘ /etc/selinux/config
setenforce 0
改成阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
软件版本
mariadb-5.5.52-1.el7.x86_64
apache-maven-3.5.0-bin.tar.gz
apache-tomcat-8.0.27.tar.gz
disconf-master.zip
jdk-8u60-linux-x64.tar.gz
redis-3.2.9.tar.gz
zookeeper-3.4.10.tar.gz
nginx-1.12.0.tar.gz
所有安装包:/usr/local/src/
安装路径:/usr/local
安装基础环境
java
tar xf jdk-8u60-linux-x64.tar.gz -C /usr/local/
cd /usr/local/
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
source /etc/profile
检查:
[root@node1 conf]# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
数据库
yum install -y mariadb mariadb-server python2-PyMySQL
systemctl start mariadb.service
cd /usr/local/disconf-master/disconf-web/sql/
mysql
source 0-init_table.sql
source 1-init_data.sql
source 201512/20151225.sql
source 20160701/20160701.sql
set password for root@localhost = password(‘123456‘);
GRANT ALL ON *.* TO ‘root@localhost‘;
GRANT ALL ON *.* TO ‘root@%‘;
flush privileges;
redis
cd
tar xf redis-3.2.9.tar.gz -C /usr/local/
cd ../redis-3.2.9/
make
make PREFIX=/usr/local/redis-3.2.9 install
echo $? #检查是否为0, 否则重新编译
成功标识:
[root@node1 redis]# tree bin/
bin/
├── redis-benchmark
├── redis-check-aof
├── redis-check-rdb
├── redis-cli
├── redis-sentinel -> redis-server
└── redis-server
[root@node1 local]#mv /usr/local/redis-3.2.9/ /usr/local/redis
echo ‘PATH=/usr/local/redis/bin/:$PATH‘>>/etc/profile
source /etc/profile
mkdir /usr/local/redis/conf/{6379,6380}
cp /usr/local/redis/redis.conf /usr/local/redis/conf/6379/
cp /usr/local/redis/redis.conf /usr/local/redis/conf/6380/
修改6380/redis.conf配置文件
port 6380
启动redis:
redis-server /usr/local/redis/conf/6379/redis.conf &
redis-server /usr/local/redis/conf/6380/redis.conf &
检查:
[root@node1 conf]# ps aux|grep redis
root 7375 0.1 0.2 136920 7908 pts/1 Sl 22:32 0:04 redis-server 127.0.0.1:6379
root 7378 0.0 0.2 136920 7904 pts/1 Sl 22:32 0:04 redis-server 127.0.0.1:6380
zookeeper
tar xf zookeeper-3.4.10.tar.gz -C /usr/local/
cd /usr/local/zookeeper-3.4.10/conf
cp zoo_sample.cfg zoo.cfg
/usr/local/zookeeper-3.4.10/bin/zkServer.sh start
检查:
/usr/local/zookeeper-3.4.10/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: standalone
maven
cd /usr/local/src/
tar xf apache-maven-3.5.0-bin.tar.gz -C /usr/local/
cd ../apache-maven-3.5.0/
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
source /etc/profile
检查
[root@node1 conf]# mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/apache-maven-3.5.0
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /usr/local/jdk1.8.0_60/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.16.1.el7.x86_64", arch: "amd64", family: "unix"
disconf
cd /usr/local/src/
unzip disconf-master.zip -d /usr/local/
mkdir /usr/local/disconf/{source,war} -p
cp disconf-master/disconf-web/profile/rd/* /usr/local/disconf/source/
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
source /etc/profile
chmod -R 777 disconf/
cd /usr/local/disconf-master/disconf-web/
sh deploy/deploy.sh ## 等待一段时间,完成后echo $?检查
生成文件
[root@node1 conf]# ls /usr/local/disconf/war/
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
[root@node1 conf]# cp /usr/local/disconf/war/WEB-INF/classes/application-demo.properties /usr/local/disconf/war/WEB-INF/classes/application.properties
[root@node1 conf]# cat /usr/local/disconf/war/WEB-INF/classes/zoo.properties
hosts=10.0.0.10:2181 #不要127.0.0.1,换成自己固定IP
# zookeeper\u7684\u524D\u7F00\u8DEF\u5F84\u540D
zookeeper_url_prefix=/disconf
tomcat
cd /usr/local/src/
tar xf apache-tomcat-8.0.27.tar.gz -C /usr/local/
mv /usr/local/apache-tomcat-8.0.27/ /usr/local/tomcat
vim /usr/local/tomcat/conf/server.xml
<Connector port="8015" protocol="HTTP/1.1" #修改成8015
connectionTimeout="20000"
redirectPort="8443" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Context path="" docBase="/usr/local/disconf/war"></Context> #新增部分
启动:
/usr/local/tomcat/bin/startup.sh
nginx
cd /usr/local/src/
tar xf nginx-1.12.0.tar.gz -C /usr/local/
cd /usr/local/nginx-1.12.0
useradd nginx -M -s /sbin/nologin
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-stream --with-http_stub_status_module --with-http_ssl_module
make
make install
mkdir /usr/local/nginx/vhosts -p
[root@node1 ~]# cat /usr/local/nginx/nginx.conf
worker_processes 4;
error_log logs/error.log notice;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr\t$upstream_addr\t[$time_local]\t "$request"\t‘
‘$status\t‘
‘$request_time\t$upstream_response_time\t"$request_body"‘;
client_max_body_size 100m;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
keepalive_timeout 75;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
include vhosts/*.conf;
}
[root@node1 ~]# cat /usr/local/nginx/vhosts/disconf.conf
upstream disconf {
server 127.0.0.1:8015;
}
server {
listen 8081;
server_name localhost;
access_log /var/log/disconf/access.log;
error_log /var/log/disconf/error.log;
location / {
root /usr/local/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;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
}
mkdir -p /var/log/disconf/
touch /var/log/disconf/access.log
touch /var/log/disconf/error.log
/usr/local/nginx/sbin/nginx -t
systemctl start nginx
浏览器访问
http://10.0.0.10:8081
用户:admin
密码:admin
效果图:
disconf-2.6.36-部署
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。