部署目录:
tree -FL 3
. |-- pd/ | |-- bin/ | | |-- pd-ctl* | | |-- pd-recover* | | |-- pd-server* | | `-- pd-tso-bench* | `-- default.pd/ | `-- member/ |-- readme |-- tidb/ | `-- bin/ | |-- goyacc* | `-- tidb-server* |-- tikv1/ | |-- bin/ | | |-- bench-tikv* | | |-- build/ | | |-- deps/ | | |-- examples/ | | |-- incremental/ | | |-- libtikv.rlib | | |-- native/ | | |-- raft/ | | |-- tikv-ctl* | | |-- tikv-fail* | | `-- tikv-server* | |-- db/ | | |-- LOCK | | |-- backup/ | | |-- db/ | | |-- raft/ | | `-- snap/ | `-- raft/ |-- tikv2/ | |-- bin/ | | |-- bench-tikv* | | |-- build/ | | |-- deps/ | | |-- examples/ | | |-- incremental/ | | |-- libtikv.rlib | | |-- native/ | | |-- raft/ | | |-- tikv-ctl* | | |-- tikv-fail* | | `-- tikv-server* | |-- db/ | | |-- LOCK | | |-- backup/ | | |-- db/ | | |-- raft/ | | `-- snap/ | `-- raft/ `-- tikv3/ |-- bin/ | |-- bench-tikv* | |-- build/ | |-- deps/ | |-- examples/ | |-- incremental/ | |-- libtikv.rlib | |-- native/ | |-- raft/ | |-- tikv-ctl* | |-- tikv-fail* | `-- tikv-server* |-- db/ | |-- LOCK | |-- backup/ | |-- db/ | |-- raft/ | `-- snap/ `-- raft/
- (用root权限修)改最大打开文件数:
echo ‘fs.file-max = 82920‘ >> /etc/sysctl.conf
echo ‘* - nofile 82920‘ >> /etc/security/limits.conf
sysctl -p
重新登录终端会话
- 启动pd
pd/bin/pd-server
- 启动tikv
依次进入tikv[1-3]/bin执行:
tikv-server -A 127.0.0.1:9000 -s ../db --pd-endpoints 127.0.0.1:2379
tikv-server -A 127.0.0.1:9001 -s ../db --pd-endpoints 127.0.0.1:2379
tikv-server -A 127.0.0.1:9002 -s ../db --pd-endpoints 127.0.0.1:2379
- 启动tidb
tidb/bin/bin/tidb-server -store tikv -path ‘127.0.0.1:2379/pd?cluster=1‘ -P 3306
- 用mysql客户端连接
mysql -uroot -h127.0.0.1
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.7.1-TiDB-v1.1.0-alpha-424-gcc808a5 MySQL Community Server (Apache License 2.0) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | INFORMATION_SCHEMA | | PERFORMANCE_SCHEMA | | mysql | | test | +--------------------+ 4 rows in set (0.01 sec)