Centos下单机运行Vitess

  1. 安装GO1.9的开发环境,设置GOPATH,下载必须的包;

  2. 安装mysql,目录是/opt/mysql/mysql-5.6.26;

  3. 安装java开发环境JDK;

  4. 安装python开发环境,安装pip,virtualenv;
    下载vitess代码:
    cd $WORKSPACE
    git clone https://github.com/youtube/vitess.git
    src/github.com/youtube/vitess
    cd src/github.com/youtube/vitess

  5. 设置vitess需要的环境表量:
    export MYSQL_FLAVOR=MySQL56
    export VT_MYSQL_ROOT=/opt/mysql/mysql-5.6.26
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VT_MYSQL_ROOT/lib
    export C_INCLUDE_PATH=$C_INCLUDE_PATH:$VT_MYSQL_ROOT/include
    export VTROOT=$GOPATH/src/github.com/youtube/vitess
    export VTDATAROOT=$VTROOT/vtdataroot
    export ZK_CLIENT_CONFIG=$VTROOT/examples/local/zk-client-conf.json
    PATH=$PATH:$VTROOT/bin

  6. 编译
    ./bootstrap.sh
    source dev.env
    make build

  7. 运行测试脚本
    cd $VTROOT/examples/local && ./zk-up.sh && ./vttablet-up.sh &&./vtctld-up.sh && sleep 2 &&./vtgate-up.sh
    cd $VTROOT/examples/local && ./lvtctl.sh ListAllTablets test
    cd $VTROOT/examples/local && ./lvtctl.sh InitShardMaster -force test_keyspace/0 test-100
    cd $VTROOT/examples/local && ./lvtctl.sh ListAllTablets test
    cd $VTROOT/examples/local && ./lvtctl.sh ApplySchema -sql "$(cat create_test_table.sql)" test_keyspace
    cd $VTROOT/examples/local && ./lvtctl.sh ApplyVSchema -vschema "$(cat vschema.json)" test_keyspace

你可能感兴趣的:(Centos下单机运行Vitess)