go-zero rpc direct connection configuration and postman request rpc

go-zero supports rpc direct connection by default without configuration

Of course, I asked him the boss in the official group and said that he can refer to the example of go-zero-lock-lock, let’s study it later

Search keywords go-zero server uses endpoints to configure rpc direct connection

To configure zrpc direct connection in go-zero, you need to set relevant configuration information in the service.yaml file, for example:

yaml复制代码Name: your_service
...
Rpc:
  Type: zrpc
  StrictControl: false
  Direct:
    - 127.0.0.1:50051

Among them, Type specifies to use the zrpc protocol, StrictControl indicates whether to enable strict control mode, and Direct is a list for specifying the address of the direct connection. In this example, we connect the service directly to the local port 50051.

Note that in the direct connection mode, go-zero's load balancing strategy will be invalid, so it is necessary to ensure that the direct connection service has high availability.

Postman directly tests the connection rpc (I started the go-zero service here)

import proto file

Prompt that the import was successful

 

You can view the proto file

Create gprc request

 

Start the rpc service

Start it yourself, I am wsl2+ubuntu+golang debug start

Enter the rpc service virtual ip and port

ask

 

Guess you like

Origin blog.csdn.net/qq_27229113/article/details/129816886
RPC
RPC