irpas技术客

springcloud-alibaba-组件库_天雨流芳

网络 6367

架构选型 技术选型包格式 公共配置Springcloud Alibaba 简介概述下载,安装nacos下载手册安装配置 MySQL 数据库启动集群防火墙访问 升级nacos1.x 到 2.x防火墙nginx 安装grpc配置 nacos2.0 nginx 配置nginx配置完整版 Seata 安装下载地址配置参考 工程目录组件实战参考

技术选型 技术选型: 1、Spring Boot 2.2.5.RELEASE、Spring CLoud Hoxton.SR3、 Springcloud Alibaba 2.2.0.RELEASE、Nacos 1.2.1 、Seata 1.2.0、Gateway 2.2.2.RELEASE、Feign 2.2.2.RELEASE、Sentinel、Swagger2、Security、Jwt、OAuth2、lombok、MybatisPlus 2、JDK1.8、IDEA 3、React /Flux 4、MQTT、COAP、NB—IOT、 5、5G 6、Redis、mycat+mysql 7、中间件:RocketMQ、Netty、FastDFS/MongoDB、ElasticSearch 8、负载均衡:LVS、Nginx 9、分布式事务:TX-LCN(不推荐)/seata 10、分布式任务调度:xxl-job 11、分布式锁:Zookeeper 12、分布式ID?成:snowflake 12、序列化:jackson;禁止fastjson 安全测试工具:AppScan 代码审查:SonarQube 和 SonarLint IDEA 插件:SonarLint 、 Alibaba Java Coding Guidelines SonarQube:https://docs.sonarqube.org SonarLint: https://·blogs.com/yonyong/p/14014605.html nacos2.0 nginx 配置

根据https://nacos.io/zh-cn/docs/2.0.0-compatibility.html 图 正确的 nginx.conf

在三台机器上部署了nacos-server a:8848 b:8848 c:8848

然后在a上配置nginx, 其中nginx.conf 的 stream内容

# 参考:nginx配置nacos集群转发及stream转发tcp四层配置 stream { upstream nacosGrpc { server a:9848; // X + 1000 server b6:9848; server c:9848; } server { listen 9080; // Y + 1000 proxy_pass nacosGrpc; } } http { # ignore something here #gzip on; upstream nacosClu { server a:8848; // X = nacos端口, 默认8848 server b:8848; server c:8848; } server { listen 8080; // Y = nginx监听端口, 但是端口别跟其他的冲突了 server_name nginxIp; location / { proxy_pass http://nacosClu; } # ignore something here } }

控制台地址: nginxIp: Y/nacos server-addr地址: nginxIp: Y

nginx配置完整版 #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #设定负载均衡的服务器列表 xxl-job-admin upstream xxl-job-cluster{ server 192.22.1.82:9600 weight=1; server 192.22.1.83:9600 weight=1; server 192.22.1.84:9600 weight=1; } server { listen 9600; server_name localhost; location / { proxy_pass http://xxl-job-cluster; proxy_set_header Host $host:9600; proxy_set_header X-Forward-For $remote_addr; root /xxl-job-admin; index index.php index.html index.htm; } } # nacos-cluster 集群部署 # upstream nacos-cluster{ # server 192.22.1.68:8848 weight=1; # server 192.22.1.88:8848 weight=1; # server 192.22.1.98:8848 weight=1; # } # server { # listen 8848; # server_name location; # location / { # #请求转向taishan定义的服务器列表 # proxy_pass http://nacos-cluster; # #将请求头转发给后端服务器 # proxy_set_header Host $host:8500; # #后端的Web服务器可以通过X-Forwarded-For获取用户真实IP # proxy_set_header X-Forward-For $remote_addr; # root /nacos/; # index index.php index.html index.htm; # } # } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } stream { upstream cluster { server 192.22.1.68:8848 weight=1; server 192.22.1.88:8848 weight=1; server 192.22.1.98:8848 weight=1; } server { listen 8500; proxy_pass cluster; } } Seata 安装 下载地址 seata-server官网地址下载编译:seata-server-1.2.0.tar.gz下载源码:Source code(zip) 配置 配置nacos配置(前置条件) 将nacos/conf/nacos-mysql.sql导入自己的数据库配置修改nacos/conf/application.properties spring.datasource.platform=mysql db.num=1 db.url.0=jdbc:mysql://192.22.1.21:3306/nacos-8848?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true db.user=root db.password=Developer@2019

启动nacos(单机版)

cd /nacos/bin

sh startup.sh -m standalone

下载seata 使用db模式导入配置:路径: seata-1.2.0\script\server\db\mysql.sql配置文件:路径:seata-1.2.0\script\config-center\config.txt脚本:路径:seata-1.2.0\script\config-center\nacos\nacos-config.sh 将上面的config.txt文件复制到seata目录,nacos中的nacos-config.sh nacos-config.py复制到seata的conf目录

初始化seata sh nacos-config.sh -h 192.22.1.21 -p 8848 -g SEATA_GROUP

启动 seata nohup ./bin/seata-server.sh >log.out 2>1 & nohup sh seata-server.sh -p 8091 -h 127.0.0.1 >log.out 2>1 & ###启动

参考 springcloud seata nacos环境搭建 工程目录

架构中application与service的区别是什么?

service提供了基础服务功能;application组装基础服务功能,提供给用户直接可用的业务。service服务粒度小、功能基础,不易发生改变;application提供上游业务功能,紧贴业务需求,容易发生改变。形成service支撑application的整体架构,增加多变的application甚至不需要变动service。 springcloud-alibaba 整体父工程 ├─api-common 公共包 │ ├─api-common-core 核心工具包 │ ├─api-common-auth 权限工具包 │ ├─api-common-log 日志工具包 │ └─api-common-redis redis工具包 ├─xxl-job API网关,端口:9600 ├─api-gateway API网关,端口:9200 ├─api-system 系统管理 │ ├─api-system-common 系统管理公共业务 │ ├─api-system-auth 授权中心 端口:9202 │ └─api-system-manage 系统管理 端口:9201 ├─api-transaction 分布式事务,端口:9300 ├─smoke-fire-platform 智慧消防大数据平台,端口:9002 ├─smart-fire-platform 智慧消防大数据平台,端口:9901 ├─device-manage 设备管理,端口:(9001-9005)(跳过9002) │ ├─device-common-module 设备公共module │ ├─device-access 设备接入(基础信息接入,设备和CtWing平台对接),端口:9001 │ ├─device-install 设备安装(设备安装巡检),端口:9003 │ └─device-message 设备消息管理,端口:9004 ├─message-manage 消息管理,端口:9006 ├─publicize-manage 宣传教育,端口:9007 └─demo demo ,端口 10000 组件 注册中心 192.22.1.21:8500 nacos zlwl@nacos分布式任务中心 192.22.1.21:9600 admin/admin@wlw 实战

Spring Cloud Alibaba基础教程:使用Nacos实现服务注册与发现

参考 github地址阿里巴巴解决方案之Spring Cloud AlibabaSpring Cloud Alibaba实战(一) - 概述nacos官网集群参考1-Nacos集群部署说明集群参考2-集群模式部署NacosNacos系列:Nacos的三种部署模式-终极版Spring Cloud Alibaba到底坑不坑?springcloud alibaba 版本说明搭建生产可用的Nacos集群-nginxRocketMQ Exampleruoyi-cloud-nacos-参考spring-cloud-alibaba版本说明Seata 的AT、Saga和TCC模式 springcloud seata nacos环境搭建SPRINGCLOUD 集成 NACOS 1.2.1 和 SEATA 1.1.0MybatisPlus 组件集成-官方文档JasperReport生成PDF中文不显示处理


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #Alibaba #MySQL # #2x防火墙nginx