SOFA入门

15次阅读

共计 1833 个字符,预计需要花费 5 分钟才能阅读完成。

简介

scalable open financial architecture stack , 可扩展开放的金融架构栈;

github: https://github.com/sofastack/sofa-boot 

快速构建金融级别云原生架构的中间件。

特点:开放,金融级别,云原生;

微服务体系组件

云原生架构

传统的微服务管理运维变得越来越快,service mesh 和 serverless 可以解决相关问题。

快速开始

部署注册中心

分布式服务治理的核心组件。

检查是否安装成功:

# 查看 meta 角色的健康检测接口:$ curl http://localhost:9615/health/check
{"success":true,"message":"... raftStatus:Leader"}

# 查看 data 角色的健康检测接口:$ curl http://localhost:9622/health/check
{"success":true,"message":"... status:WORKING"}

# 查看 session 角色的健康检测接口:$ curl http://localhost:9603/health/check
{"success":true,"message":"..."}

部署链路跟踪

The Docker Zipkin project is able to build docker images, provide scripts and a docker-compose.yml for launching pre-built images. The quickest start is to run the latest image directly:

docker run -d -p 9411:9411 openzipkin/zipkin

部署监控

依赖 ES 服务或者 grafana ; 

本地安装 es 服务:

docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:5.6

检查 es 服务:

http://localhost:9200/_cat/health?v

安装步骤:

部署程序 AB

https://www.sofastack.tech/guides/sofastack-quick-start/#5-%E5%8F%91%E5%B8%83-sofarpc-%E6%9C%8D%E5%8A%A1

关键步骤:

<!--SOFARPC 依赖 -->
<dependency>
    <groupId>com.alipay.sofa</groupId>
    <artifactId>rpc-sofa-boot-starter</artifactId>
</dependency>
<!--SOFATracer 依赖 -->
<dependency>
    <groupId>com.alipay.sofa</groupId>
    <artifactId>tracer-sofa-boot-starter</artifactId>
</dependency>
<!--SOFARegistry 依赖 -->
<dependency>
    <groupId>com.alipay.sofa</groupId>
    <artifactId>registry-client-all</artifactId>
</dependency>
<!--runtime 依赖 -->
<dependency>
    <groupId>com.alipay.sofa</groupId>
    <artifactId>runtime-sofa-boot-starter</artifactId>
</dependency>
<!--SOFALookout 依赖 -->
<dependency>
    <groupId>com.alipay.sofa.lookout</groupId>
    <artifactId>lookout-sofa-boot-starter</artifactId>
</dependency>

运行效果

sofa-boot,sofa-rpc 的运行原理后面进行研究;

代码

修复了一个 sql 报错的问题;

还有引用失败报错的问题。

实例代码点我获取!

原创不易,关注诚可贵,转发价更高!转载请注明出处,让我们互通有无,共同进步,欢迎沟通交流。
我会持续分享 Java 软件编程知识和程序员发展职业之路,欢迎关注,我整理了这些年编程学习的各种资源,关注公众号‘李福春持续输出’,发送 ’ 学习资料 ’ 分享给你!

正文完
 0