English | 简体中文
Provide consumer and provider applications which based on gRPC framework, to show how to make gRPC application access polaris rapidly.
- provider: gRPC server application, demo service register, deregister, heartbeat.
- consumer: gRPC client application, demo service discovery, and load balance.
Modify polaris.yaml
in provider
and consumer
, which is showed as below:
besides, ${ip}
and ${port}
is the address of polaris server.
global:
serverConnector:
addresses:
- ${ip}:${port}
Build provider with go mod:
cd provider
go build -o provider
Build consumer with go mod:
cd consumer
go build -o consumer
go mod compile and build:
cd provider
go build -o provider
run binary executable:
./provider
go mod compile and build:
cd consumer
go build -o consumer
run binary executable:
./consumer
Login into polaris console, and check the instances in Service EchoServerGRPC
.
Invoke http call,replace ${app.port}
to the consumer port (18080 by default).
curl -L -X GET 'http://localhost:${app.port}/echo?value=hello_world'
expect:echo: hello_world