Linux command
grpc 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Generate Go code from proto
protoc --go_out=. --go-grpc_out=. [service.proto]
Generate Python code
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. [service.proto]
Call gRPC service
grpcurl -plaintext [localhost:50051] [package.Service/Method]
List services
grpcurl -plaintext [localhost:50051] list
说明
gRPC is a high-performance RPC framework using Protocol Buffers for serialization. It enables efficient communication between services with features like streaming, authentication, and load balancing. gRPC uses HTTP/2 for transport and provides code generation for multiple languages from .proto service definitions.
FAQ
What is the grpc command used for?
gRPC is a high-performance RPC framework using Protocol Buffers for serialization. It enables efficient communication between services with features like streaming, authentication, and load balancing. gRPC uses HTTP/2 for transport and provides code generation for multiple languages from .proto service definitions.
How do I run a basic grpc example?
Run `protoc --go_out=. --go-grpc_out=. [service.proto]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more grpc examples?
This page includes 4 examples for grpc, plus related commands for nearby Linux tasks.