Compiling a Benchmark Tool
To deploy a benchmark tool in an etcd cluster, deploy and start the etcd cluster in advance. Perform the following operations on each node in the cluster.
- Modify environment variables.
- Open the /etc/profile file.
vim /etc/profile
- Press i to enter the insert mode and add the GOPATH information in the line above GOROOT.
export GOPATH=/usr/local/etcd/tools/benchmark

- Change the path.
After:
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the /etc/profile file.
- Make the environment variables take effect.
source /etc/profile
- Go to the benchmark directory and obtain the benchmark dependency package. Before performing the get operation, set a
proxy .cd /usr/local/etcd/tools/benchmark/ go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.cn,direct go get go.etcd.io/etcd/v3/tools/benchmark


During the download, the version number is displayed. It is v3.5.4 in this example, which is marked in the red box in the preceding figure.
- Install the dependency package. (Change the benchmark number as required.)
go install go.etcd.io/etcd/v3/tools/benchmark@v3.5.4

- Check the executable benchmark file. After the installation is complete, an executable benchmark file is generated in the usr/local/etcd/tools/benchmark/bin directory.
ls /usr/local/etcd/tools/benchmark/bin

Parent topic: etcd Benchmark Test Guide