Skip to content

Commit

Permalink
fix grpc default port
Browse files Browse the repository at this point in the history
  • Loading branch information
2456868764 committed Nov 14, 2024
1 parent 24be0ae commit f417911
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,20 +450,20 @@ Zipkin dashboard 的调用链路如下:
## grpc
### 激活 grpc 功能

使用 --grpc-enable 参数开启 grpc 监听,--grpc-port 指定监听端口, 默认监听 9090 端口, protobuf 文件在 pkg/order/order.proto
使用 --grpc-enable 参数开启 grpc 监听,--grpc-port 指定监听端口, 默认监听 9091 端口, protobuf 文件在 pkg/order/order.proto

### 测试

```shell
grpcurl -plaintext 127.0.0.1:9090 list
grpcurl -plaintext 127.0.0.1:9091 list

grpc.reflection.v1.ServerReflection
grpc.reflection.v1alpha.ServerReflection
order.OrderManagement
```

```shell
grpcurl -plaintext -d '{"name": "jun"}' 127.0.0.1:9090 order.OrderManagement/sayHello
grpcurl -plaintext -d '{"name": "jun"}' 127.0.0.1:9091 order.OrderManagement/sayHello

"Hello jun"
```
Expand Down
2 changes: 1 addition & 1 deletion pkg/options/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (o *Option) AddFlags(flags *pflag.FlagSet) {
flags.StringVar(&o.NacosPassword, "nacos-password", "", "nacos password")

flags.BoolVar(&o.GrpcEnable, "grpc-enable", true, "grpc enable")
flags.Uint32Var(&o.GrpcPort, "grpc-port", 9090, "grpc demo order port")
flags.Uint32Var(&o.GrpcPort, "grpc-port", 9091, "grpc demo order port")
}

func (o *Option) Complete() {
Expand Down

0 comments on commit f417911

Please sign in to comment.