参考文档:https://pingcap.com/docs/dev/how-to/deploy/from-tarball/production-environment/
部署非常简单,拷贝启动即可。步骤如下(下面内容先这么放着,有空再整理)
机器配置:6节点,全部Intel® Xeon® CPU E5-2690 @ 2.90GHz Memory 252GB
wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
useradd -u 171717 -g dba -d /scratch/tidb tidb
passwd tidb
welcome1
Configure ssh without password
ssh-keygen -t rsa
cd ~/.ssh
cat id_rsa.pub >>authorized_keys
vi /etc/security/limits.conf
tidb soft nofile 1000000
tidb hard nofile 1000000
tidb soft nproc 524288
tidb hard nproc 524288
tidb soft core unlimited
tidb hard core unlimited
tidb soft memlock 5000000
tidb hard memlock 5000000
Skip below settings:
Swap Space Should be disabled
Disk Block Size Set the system disk Block size to 4096
Disk Readahead Set the value of the readahead data disk to 4096 at a minimum
CPU Frequency Scaling It is recommended to turn on CPU overclocking
Transparent Hugepages For Red Hat 7+ and CentOS 7+ systems, it is required to set the Transparent Hugepages to always
I/O Scheduler Set the I/O Scheduler of data disks to the deadline mode
vi /etc/sysctl.conf
vm.min_free_kbytes=268435456
vm.swappiness=0
net.core.somaxconn=32768
net.ipv4.tcp_syncookies=0
net.ipv4.ip_local_port_range = 32768 61000
Name Host IP Services
slcai846 10.242.102.174 PD1, TiDB
slcai853 10.242.102.175 PD2
slcai852 10.242.102.180 PD3
slcai851 10.242.102.179 TiKV1
slcai847 10.242.103.144 TiKV2
slcai850 10.242.102.178 TiKV3
./bin/pd-server --name=pd1
–data-dir=pd
–client-urls=“http://10.242.102.174:2379”
–peer-urls=“http://10.242.102.174:2380”
–initial-cluster=“pd1=http://10.242.102.174:2380,pd2=http://10.242.102.175:2380,pd3=http://10.242.102.180:2380”
-L “info”
–log-file=pd.log &
./bin/pd-server --name=pd2
–data-dir=pd
–client-urls=“http://10.242.102.175:2379”
–peer-urls=“http://10.242.102.175:2380”
–initial-cluster=“pd1=http://10.242.102.174:2380,pd2=http://10.242.102.175:2380,pd3=http://10.242.102.180:2380”
-L “info”
–log-file=pd.log &
./bin/pd-server --name=pd3
–data-dir=pd
–client-urls=“http://10.242.102.180:2379”
–peer-urls=“http://10.242.102.180:2380”
–initial-cluster=“pd1=http://10.242.102.174:2380,pd2=http://10.242.102.175:2380,pd3=http://10.242.102.180:2380”
-L “info”
–log-file=pd.log &
nohup ./bin/tikv-server --pd=“10.242.102.174:2379,10.242.102.175:2379,10.242.102.180:2379”
–addr=“10.242.102.179:20160”
–status-addr=“10.242.102.179:20180”
–data-dir=tikv
–log-file=tikv.log >.tikv1.nohup 2>&1 &
nohup ./bin/tikv-server --pd=“10.242.102.174:2379,10.242.102.175:2379,10.242.102.180:2379”
–addr=“10.242.103.144:20160”
–status-addr=“10.242.103.144:20180”
–data-dir=tikv
–log-file=tikv.log >.tikv2.nohup 2>&1 &
nohup ./bin/tikv-server --pd=“10.242.102.174:2379,10.242.102.175:2379,10.242.102.180:2379”
–addr=“10.242.102.178:20160”
–status-addr=“10.242.102.178:20180”
–data-dir=tikv
–log-file=tikv.log >.tikv3.nohup 2>&1 &
nohup ./bin/tidb-server --store=tikv
–path=“10.242.102.174:2379,10.242.102.175:2379,10.242.102.180:2379”
–log-file=tidb.log >.tidb.nohup 2>&1 &
mysql -h 10.242.102.174 -P 4000 -u root -D test
–》 ok