Nezha 哪吒
优质
小牛编辑
127浏览
2023-12-01
这个项目以哪吒命名,显示其八臂哪吒之意。这个是一个支持多种协议的项目。
目标是能够实现dams对gPRC、Thrift-RPC、Tars
golang 如何开发gRPC应用
环境建设
- sudo apt install protobuf-compiler
- go get -u google.golang.org/grpc
- go get -u github.com/golang/protobuf/protoc-gen-go
- chrome://tracing
golang 如何开发Tars应用
- go get github.com/TarsCloud/TarsGo/tars
- cd $GOPATH/src/github.com/TarsCloud/TarsGo/tars/tools/tars2go && go build .
- cp tars2go $GOPTAH/bin
- sh $GOPATH/src/github.com/TarsCloud/TarsGo/tars/tools/create_tars_server.sh [App] [Server] [Servant] 例如:
bash $GOPATH/src/github.com/TarsCloud/TarsGo/tars/tools/create_tars_server.sh TestApp HelloGo SayHello
bash $GOPATH/src/github.com/TarsCloud/TarsGo/tars/tools/create_tars_server.sh TestApp HelloGo SayHello
由于ubuntu默认的sh是dash,所以sh要写成bash
还要apt intsall rename,默认ubuntu里面没有这个命令。
打开
vim /var/www/go/src/github.com/TarsCloud/TarsGo/tars/tools/create_tars_server.sh
修改79、80行
#rename "Server" "$SERVER" $RENAMEFILE
#rename "Servant" "$SERVANT" $RENAMEFILE
rename "s/Server/$SERVER/" $RENAMEFILE
rename "s/Servant/$SERVANT/" $RENAMEFILE