1.assembly服务集群部署
1.1外部配置文件修改
application-uat.yml 下面是示例文件
- 数据库配置修改
- Redis配置修改
- Activemq配置修改
上面这些配置需要根据具体的情况进行修改
1.2 base模块中的application.yml文件修改
由于集群启动时,当高并发时会出现主键冲突问题,需要保证每台服务生成的主键唯一需要修改的配置如下base模块下的application.yml
每个集群中的节点对应的 datacenterId和workerId 的组合要求是唯一的
服务器 |
start.sh文件内容 启动命令 如果workerId和datacenterId 在application-uat.yml中设置 则不需要通过命令来设置该参数 |
10.10.0.186:8088 |
#!/bin/bash nohup java -jar eip.jar --system.id.workerId=2 --system.id-datacenterId=2 --spring.config.location=classpath:/config/application.yml,application-uat.yml >eip.out 2>&1 & |
10.10.0.187:8088 |
#!/bin/bash nohup java -jar eip.jar --system.id.workerId=2 --system.id-datacenterId=3 --spring.config.location=classpath:/config/application.yml,application-uat.yml >eip.out 2>&1 & |
10.10.0.182:80 |
前端部署 |
2. 前端部署
2.1 配置nginx
nginx.conf的负载均衡配置如下:
http { upstream eipapi { server 10.10.0.186:8088; server 10.10.0.187:8088; } server { listen 80; server_name localhost; location / { root /home/hotent/web; index index.html index.htm; } location /fvue { root /home/hotent/web; index index.html; try_files $uri $uri/ /fvue/index.html; } location /mvue { root /home/hotent/web; index index.html; try_files $uri $uri/ /mvue/index.html; } location =/mvue { rewrite ^(.*)$ http://10.10.0.182:80/mvue/; } location =/fvue { rewrite ^(.*)$ http://10.10.0.182:80/fvue/; } location /eipapi { rewrite ^/eipapi/(.*)$ /$1 break; proxy_pass http://eipapi/; } } }
2.2 前端sso.js文件修改
sso.js作为前端请求后端的地址的集合,sso.js文件的位置在public目录下。
管理端sso:
window.context = { manage: 'http://10.10.0.182/mvue', //管理端页面 front: 'http://10.10.0.182/fvue', //前端页面 mobile: 'http://10.10.0.182/mobilevue', //手机端页面 form: 'http://10.10.0.182/eipapi', portal: 'http://10.10.0.182/eipapi', bpmRunTime: 'http://10.10.0.182/eipapi', bpmModel: 'http://10.10.0.182/eipapi', uc: 'http://10.10.0.182/eipapi' };
应用端sso:
window.context = { manage: 'http://10.10.0.182/mvue', //管理端页面 front: 'http://10.10.0.182/fvue', //前端页面 mobile: 'http://10.10.0.182/mobilevue', //手机端页面 form: 'http://10.10.0.182/eipapi', portal: 'http://10.10.0.182/eipapi', bpmRunTime: 'http://10.10.0.182/eipapi', bpmModel: 'http://10.10.0.182/eipapi', uc: 'http://10.10.0.182/eipapi', };
2.3 启动nginx即可完成前端的部署
管理端:http://10.10.0.182/mvue/home
应用端:http://10.10.0.182/fvue/home