前言:Greenplum6开始,gpbackup需要自己编译安装
安装步骤:
1.下载go语言包
wget -c https://studygolang.com/dl/golang/go1.13.5.linux-amd64.tar.gz
2.解压
tar -zxvf xxx
3.移动位置
mv go /home/gpadmin
4.改变权限
chown -R gpadmin:gpadmin go
5.切换用户
su - gpadmin
6.编辑环境变量
vi ~/.bashrc
export GOROOT=$HOME/go
export GOPATH=$HOME/gpbackup
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
7.使用环境变量
source ~/.bashrc
8.查看版本
go version
如显示正常则安装成功
9.下载gpbackup包
download gpbackup
go get github.com/greenplum-db/gpbackup
如果失败:
go: missing Git command. See https://golang.org/s/gogetcmd package github.com/greenplum-db/gpbackup: exec: "git": executable file not found in $PATH
则需要安装git:
回到root用户,然后执行 yum install -y git
10.进入gpbackup目录
cd /home/gpadmin/gpbackup/src/github.com/greenplum-db/gpbackup
11.编译
make depend
报错 go:github.com/DATA-DOG/go-sqlmock@v1.4.1:Get https://proxy.golang.org/github.com/Xxxxx i/o timeout make:*[depend] Error 1
这是go包管理代理网址无法访问:proxy.golang.org
12.切换go包代理网址
go env -w GOPROXY=https://goproxy.cn
13.编译依赖
make depend
14.安装
make build
15.安装
make build_linux
16.备份全库命令
gpbackup --dbname hr_etl --backup-dir /data/backup