M1 install protobuf
download protobuf
unzip
tar -xzvf protobuf-all-3.20.1.tar.gz && cd protobuf-3.20.1/
Install
Execute the following command to install
./configure //默认安装到/usr/local
make
make check
sudo make install
protoc --version //查看是否安装成功
uninstall
$ which protoc
/usr/local/bin/protoc
$ sudo rm /usr/local/bin/protoc
Install protoc-gen-go
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
Go to the bin directory of the Go installation directory, and protoc-gen-go
protoc-gen-go-grpc
copy the two files to the bin directory of the current operating system
. For example
sudo cp protoc-gen-go protoc-gen-go-grpc /usr/local/bin
Generate grpc
protoc --go_out=./ --go_opt=paths=source_relative --go-grpc_out=./ --go-grpc_opt=paths=source_relative person.proto
install consul
ubuntu
wget https://releases.hashicorp.com/consul/1.12.0/consul_1.12.0_linux_amd64.zip
unzip consul_1.12.0_linux_amd64.zip
mv consul /usr/local/bin/
M1 install consul
Direct download
https://releases.hashicorp.com/consul/1.12.0/consul_1.12.0_darwin_arm64.zip
double click consul_1.12.0_darwin_arm64.zip
to opensudo mv consul /usr/local/bin/
run
consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul -node=n1 -bind=127.0.0.1 -ui -rejoin -config-dir=/etc/consul.d/ -client 0.0.0.0