linux 下 mongoshake 安装小记

1. 先决条件

       配置golang环境,go version  must >= 1.9

            a.配置好PATH环境变量(使用go 命令更方便),

            b.配置GOPATH( 指定好GOPATH,其实就是一路径, 下文中 govendor 会自动安装到GOPATH里面)

2. 安装mongoshake

    step1:

          git clone https://github.com/aliyun/mongo-shake.git

    step2:


         cd mongo-shake/src/vendor

        特别说明: build.sh 执行之前,请确保安装好了 govendor, 并且同步好           

        安装govendor

              go get -u -v github.com/kardianos/govendor

              当当当当……,出错指南:

              如果太幸运,遇到   fatal: HTTP request failed  错误(如下图所示),升级git version 即可, 

              git version must >= 1.8 (1.7.1 版本就太低了)。

step3:

     GOPATH=`pwd`/../..; govendor sync       //命令行执行

     #please note: must install govendor first and then pull all dependencies

step4:

     cd ../../ && ./build.sh

step5:


     ./bin/collector -conf=conf/collector.conf       


     #please note: user must modify collector.conf first to match needs. You can also use "start.sh" script which supports hypervisor mechanism in Linux OS only. 

 

附记:

build.sh  执行过程中,如果遇到了如下的错误提示

build command-line-arguments: cannot load mongoshake/collector: cannot find module providing package mongoshake/collector

原因是:编译的项目在GOPATH 外面,不需要开启 GO111MODULE,关闭即可。

Navigate to the root of the module's source tree outside of GOPATH:

$ cd <project path outside $GOPATH/src>         # e.g., cd ~/projects/hello

Note that outside of GOPATH, you do not need to set GO111MODULE to activate module mode.

Alternatively, if you want to work in your GOPATH:

$ export GO111MODULE=on                         # manually active module mode
$ cd $GOPATH/src/<project path>                 # e.g., cd $GOPATH/src/you/hello
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值