Welcome to my GitHub

Github.com/zq2599/blog…

Content: all original article classification summary and supporting source code, involving Java, Docker, Kubernetes, DevOPS, etc.;

About gRPC Learning series

GRPC Learning is xinchen’s latest creation of combat style original, aiming to master the basic knowledge of gRPC development based on Golang with readers through a series of combat operations;

GRPC learning series of articles links

  1. Deploy and set GO on CentOS7
  2. Prepare gRPC development environment for GO
  3. The first GO version of gRPC development
  4. Actual combat four kinds of service methods
  5. GRPC – Gateway of actual combat
  6. GRPC – Gateway integration swagger

About gRPC

  1. GRPC is a high-performance, open source, and generic RPC framework designed for mobile and HTTP/2. Currently, C, Java, and Go languages are available: GRPC, GRpc-Java, and GRPC-Go. The C version supports C, C++, Node.js, Python, Ruby, Objective-C, PHP, and C#.
  2. GRPC is designed based on the HTTP/2 standard and brings features such as bidirectional streaming, flow control, header compression, and multiplex requests over a single TCP connection. These features allow it to perform better on mobile devices, saving power and space.
  3. Each process can call each other through gRPC, as shown in the following figure:

This paper gives an overview of

As the beginning of the gRPC Learning series, the main task is to determine the environment information, deploy go, and set it up for later development.

Environmental information

  1. CentOS Linux release 7.9.2009
  2. Go version: 1.15.6

About accounts and permissions

In order to get closer to the production environment, this document uses a new account golang instead of root. When creating an account, use the root account to perform operations as follows:

  1. The account and group I use here is golang, and I use root account to perform the following operations:
groupadd golang && useradd -d /home/golang -g golang -m golang
Copy the code
  1. Run the passwd golang command to set the password of the golang account.
  2. Also give the Golang account sudo permission to make the configuration file writable by executing the following command:
chmod 777 /etc/sudoers
Copy the code
  1. Next edit /etc/sudoers and add the contents in the red box below, then save and exit:

5. Disable the write permission on the configuration file:

chmod 440 /etc/sudoers
Copy the code
  • At this point, the new account golang has been created and will be used for the following operations.

Rapid deployment and configuration of Golang

Download, decompress, set, if you feel that these operations tedious, the following operations will let you save some worry:

  1. Update application:
sudo yum update -y
Copy the code
  1. Install the application that will be used later:
sudo yum install unzip tree wget -y
Copy the code
  1. To complete the deployment, run the following command:
curl -o install-go.sh \
https://raw.githubusercontent.com/zq2599/blog_demos/master/files/install-go.sh \
&& chmod a+x ./install-go.sh \
&& ./install-go.sh
Copy the code
  1. The hello.go file is successfully executed, indicating that the GO environment is successfully deployed, and the output environment variables are normal:
. 5. create go source file package main import "fmt" func main() { fmt.Println("Hello world!" ) } 6. run hello.go Hello world! Go1.15.6 Install and Check finishedCopy the code
  1. The install-go.sh script in the preceding command contains the following contents:

  1. If you are interested in the details of the script, look directly at the downloaded install-go.sh file;
  • At this point, the GO environment below CentOS7 is ready. The gRPC environment will be prepared in the following sections.

You are not alone, Xinchen original accompany all the way

  1. Java series
  2. Spring series
  3. The Docker series
  4. Kubernetes series
  5. Database + middleware series
  6. The conversation series

Welcome to pay attention to the public number: programmer Xin Chen

Wechat search “programmer Xin Chen”, I am Xin Chen, looking forward to enjoying the Java world with you…

Github.com/zq2599/blog…