TIDB-1.tidb搭建

172.31.25.210
172.31.25.211
172.31.25.212
172.31.25.213

yum -y install epel-release git curl sshpass &&
yum -y install python2-pip &&
useradd -m -d /home/tidb tidb &&
passwd tidb

输入tidb密码 : tidb

echo 'tidb ALL=(ALL) NOPASSWD: ALL'  >> /etc/sudoers &&
su - tidb &&
ssh-keygen -t rsa
cd /home/tidb && git clone -b v2.1.1 https://github.com/pingcap/tidb-ansible.git 
cd /home/tidb/tidb-ansible &&  sudo pip install --upgrade setuptools && sudo python -m pip install --upgrade pip && sudo pip install -r ./requirements.txt && ansible --version 
cd /home/tidb/tidb-ansible && vi hosts.ini

输入部署目标机器 IP

ansible-playbook -i hosts.ini create_users.yml -u root -k
cd /home/tidb/tidb-ansible && ansible-playbook -i hosts.ini deploy_ntp.yml -u tidb -b

5.挂载数据盘 (所有部署机)

parted -s -a optimal /dev/vdb mklabel gpt -- mkpart primary ext4 1 -1 && 
mkfs.ext4 /dev/vdb 

lsblk -f && vi /etc/fstab
echo 'UUID=4db35cc2-29ef-4efc-9ec6-1bdf11e548b1  /data1 ext4 defaults,nodelalloc,noatime 0 2' >> /etc/fstab
mkdir /data1 && mount -a && mount -t ext4

6.配置inventory.ini

cd /home/tidb/tidb-ansible && vim inventory.ini

deploy_dir = /data1/deploy
dev_mode=True

cd /home/tidb/tidb-ansible && vim bootstrap.yml

注销cpu核心数检查(正式环境不建议注销)

su tidb && cd /home/tidb/tidb-ansible && ansible -i inventory.ini all -m shell -a 'whoami' && ansible -i inventory.ini all -m shell -a 'whoami' -b
ansible-playbook local_prepare.yml
ansible-playbook bootstrap.yml  (不检查磁盘大小的话加参数 --extra-vars "dev_mode=True")
ansible-playbook deploy.yml && sudo yum install fontconfig open-sans-fonts
ansible-playbook start.yml

你可能感兴趣的:(DB)