Getting started with SOFA

Posted May 26, 20203 min read

image.png

Introduction

scalable open financial architecture stack, scalable open financial architecture stack;

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

Quickly build middleware for financial-grade cloud-native architecture.

Features:Open, financial level, cloud native;

file

Microservice system components

file

image.png

Cloud native architecture

Traditional microservice management and maintenance has become faster and faster, and service mesh and serverless can solve related problems.

file

image.png

Quick start

![image.png]( https://i0.wp.com/segmentfault.comhttps://cdn.nlark.com/yuque/0/2020/png/186661/1590484963734-cc9a1603-96f7-48f4-b2dc-459a3dedc128 .png # align = left & display = inline & height = 774 & margin =%5Bobject%20Object%5D & name = image.png & originHeight = 774 & originWidth = 845 & size = 43802 & status = done & style = none & width = 845 "image.png")

Deployment Registry

The core component of distributed service governance.

file

Check whether the installation is successful:

# View the health detection interface of the meta role:
$curl http://localhost:9615/health/check
{"success":true, "message":"... raftStatus:Leader"}

# View the health detection interface of the data role:
$curl http://localhost:9622/health/check
{"success":true, "message":"... status:WORKING"}

# View the health detection interface of the session role:
$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

Deployment monitoring

Rely on ES service or grafana ;

Install es service locally:

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

Check es service:

[ http://localhost:9200/\ _cat/health? v]( http://localhost:9200/_cat/health ? v)

installation steps:

file

Deployment procedure AB

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

key step:

file

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

running result

image.png

The operation principles of sofa-boot and sofa-rpc will be studied later;

Code

Fixed a problem with sql error;

There is also the problem of quoting failures and reporting errors.

Example code point I get!

Originality is not easy, pay attention to sincerity, and the forwarding price is higher! Reprint please indicate the source, let us communicate with each other, make progress together, welcome to communicate.
I will continue to share Java software programming knowledge and the career path of programmers. Welcome to pay attention. I have organized various resources for programming and learning over the years, pay attention to the public number "Li Fuchun continuous output", and send "learning materials" to you!
Li Fuchun continues to output the QR code of the public number