tidb集群
tidb ansible部署
https://zhuanlan.zhihu.com/p/27308307?refer=newsql
网址:http://www.cnblogs.com/mowei/p/7257787.html
tidb集群
#容器 docker pull registry.cn-hangzhou.aliyuncs.com/moensun/centos7 yum install -y openssh-server yum install -y epel-release yum install iproute which net-tools readline rsync openssl openssl-devel gcc gcc-c++ wget curl unzip lrzsz sysstat ntp man vim bash-completion ntpd screen expect autoconf automake bzip2 bzip2-devel openssh-clients docker run -itd -v /opt/tools:/opt/tools --privileged --network=mynet --restart=always -h centos7_pd --name centos7_pd --ip 172.16.0.20 bac2d0831a7d /usr/sbin/init docker run -itd -v /opt/tools:/opt/tools --privileged --network=mynet --restart=always -h centos7_tikv1 --name centos7_tikv1 --ip 172.16.0.21 bac2d0831a7d /usr/sbin/init docker run -itd -v /opt/tools:/opt/tools --privileged --network=mynet --restart=always -h centos7_tikv2 --name centos7_tikv2 --ip 172.16.0.22 bac2d0831a7d /usr/sbin/init docker run -itd -v /opt/tools:/opt/tools --privileged --network=mynet --restart=always -h centos7_tikv3 --name centos7_tikv3 --ip 172.16.0.23 bac2d0831a7d /usr/sbin/init 一、环境 CentOS Linux release 7.3.1611 (Core) 172.16.0.20 pd & tidb 172.16.0.21 tikv 172.16.0.22 tikv 172.16.0.23 tikv 二、安装 分别在4台服务器上上传安装包 wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz tar -xzf tidb-latest-linux-amd64.tar.gz mv tidb-latest-linux-amd64 /opt/tidb mkdir -p /opt/tidb/{data,logs} vim /etc/profile.d/env.sh #内容如下 ============== export TIDB_HOME=/opt/tidb export PATH=$PATH:$TIDB_HOME/bin ============== . /etc/profile 20上启动pd pd-server --name=pd1 \ --data-dir=/opt/tidb/data \ --client-urls="http://172.16.0.20:2379" \ --peer-urls="http://172.16.0.20:2380" \ --initial-cluster="pd1=http://172.16.0.20:2380" \ --log-file=/opt/tidb/logs/pd.log & 在21,22,23上分别安装tidb和启动tikv 21 tikv-server --pd="172.16.0.20:2379" \ --addr="172.16.0.21:20160" \ --data-dir=/opt/tidb/data \ --log-file=/opt/tidb/logs/tikv.log & 22 tikv-server --pd="172.16.0.20:2379" \ --addr="172.16.0.22:20160" \ --data-dir=/opt/tidb/data \ --log-file=/opt/tidb/logs/tikv.log & 23 tikv-server --pd="172.16.0.20:2379" \ --addr="172.16.0.23:20160" \ --data-dir=/opt/tidb/data \ --log-file=/opt/tidb/logs/tikv.log & 在21上启动tipd服务 tidb-server --store=tikv \ --path="172.16.0.20:2379" \ --log-file=/opt/tidb/logs/tidb.log &