SpringCloud的应用发布(二)vmvare+linux,Centos7.0下发布应用

一、运行环境

1、jdk下载安装

地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

检查是否有老版本jdk

如果需要卸载OpenJDK,执行以下操作:

[root@localhost ~]# rpm -e --nodeps tzdata-java-2014i-1.el7.noarch
[root@localhost ~]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64
[root@localhost ~]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64

2、解压安装

tar zxvf  jdk-8u144-linx-x64.tar.gz

mv jdk1.8.0_144 jdk1.80

修改环境变量,并生效配置

vi /etc/profile

内容修改:

 

生效配置:

source /etc/profile

3、验证JDK安装

   

二、部署应用

1、上传应用到opt目录

  • 配置管理中心 CfgMgr
  • 发布服务注册中心 SvcReg
  • 发布服务网关应用 SvcGw
  • 发布业务应用 ProdMgr、CustMgr、SaleMgr

2、编写运行脚本

nohup command > myout.file 2>&1  &

java -jar CfgMgr-0.0.1.jar

java -jar SvcReg-0.0.1.jar

java -jar CustMgr-0.0.1.jar

java -jar ProdMgr-0.0.1.jar

java -jar SaleMgr-0.0.1.jar

java -jar SvcGw-0.0.1.jar

nohup java -jar CfgMgr-0.0.1.jar > ./log/CfgMgr.txt 2>&1 &
nohup java -jar SvcReg-0.0.1.jar > ./log/SvcReg.txt 2>&1 &
nohup java -jar CustMgr-0.0.1.jar > ./log/CustMgr.txt 2>&1 &
nohup java -jar ProdMgr-0.0.1.jar > ./log/ProdMgr.txt 2>&1 &
nohup java -jar SaleMgr-0.0.1.jar > ./log/SaleMgr.txt 2>&1 &
nohup java -jar SvcGw-0.0.1.jar > ./log/SvcGw.txt 2>&1 &

3、验证功能

服务注册中心
http://localhost:8101/

服务配置中心
http://localhost:8201/ProdMgr-dev.yaml
http://localhost:8201/CustMgr-dev.yaml
http://localhost:8201/SaleMgr-dev.yaml

http://localhost:8311/info
http://localhost:8321/info
http://localhost:8331/info

业务应用ProdMgr
http://localhost:8311/helloworld?client=111
http://localhost:8311/selectProd?id=1

业务应用CustMgr
http://localhost:8321/helloworld?client=222
http://localhost:8321/selectCust?id=1

业务应用SaleMgr
http://localhost:8331/helloworld?client=333
http://localhost:8331/sale?prodId=11&custid=12

服务网管引擎
http://localhost:9001/sale/sale?prodId=21&custid=22

原文地址:https://www.cnblogs.com/lexiaofei/p/7667811.html