操作系统版本要求: CentOS 7+, Ubuntu 14.04+
操作过程使用工具:Xshell6、navicat、Vm
查看系统版本信息:
cat /etc/redhat-release
# 下载压缩包
wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
wget http://download.pingcap.org/tidb-latest-linux-amd64.sha256
wget:未找到命令
yum -y install wget
# 检查文件完整性,返回 ok(或确定)则正确
sha256sum -c tidb-latest-linux-amd64.sha256
# 解开压缩包
tar -xzf tidb-latest-linux-amd64.tar.gz
cd tidb-latest-linux-amd64
部署
按照步骤依次启动PD, TiKV, TiDB
启动PD
./bin/pd-server --data-dir=pd
命令行输出
······
[2019/03/12 10:11:26.745 +08:00] [INFO] [tso.go:105] ["sync and save timestamp"] [last=2019/03/12 10:11:12.574 +08:00] [save=2019/03/12 10:11:29.731 +08:00] [next=2019/03/12 10:11:26.731 +08:00]
[2019/03/12 10:11:26.745 +08:00] [INFO] [leader.go:267] ["load cluster version"] [cluster-version=3.0.0-beta]
[2019/03/12 10:11:26.745 +08:00] [INFO] [leader.go:268] ["PD cluster leader is ready to serve"] [leader-name=pd-localhost.localdomain]
出现PD cluster leader is ready to serve,则代表启动PB成功.
Xshell6 新建会话
启动TiKV
./bin/tikv-server --pd="127.0.0.1:2379" --data-dir=tikv
命令行输出
······
[2019/03/12 09:34:12.506 +08:00] [INFO] [mod.rs:343] ["starting working thread"] [worker=local-reader]
[2019/03/12 09:34:12.507 +08:00] [INFO] [mod.rs:343] ["starting working thread"] [worker=snap-handler]
[2019/03/12 09:34:12.511 +08:00] [INFO] [server.rs:213] ["TiKV is ready to serve"]
出现TiKV is ready to serve,则代表启动TiKV成功.
Xshell6 新建会话
启动TiDB
./bin/tidb-server --store=tikv --path="127.0.0.1:2379"
命令行输出
······
2019/03/12 09:36:05.799 server.go:198: [info] Server is running MySQL Protocol at [0.0.0.0:4000]
2019/03/12 09:36:05.801 http_status.go:147: [info] Listening on :10080 for status and metrics report.
启动TiDB成功.
启动mysql客户端
mysql -h 127.0.0.1 -P 4000 -u root -D test
mysql重置密码
mysql > use mysql;
mysql > update user set password=password('root') where user='root';
mysql > flush privileges;
mysql > exit;
重启mysql服务生效
# service mysqld restart
为root添加远程连接的能力。链接密码为 “root”(不包括双引号)
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";
开放4000端口号firewalld 防火墙(centos-7)运行命令,并重启:
firewall-cmd --zone=public --add-port=4000/tcp --permanent
firewall-cmd --reload
tiDB运行命令汇总:
cd tidb-latest-linux-amd64
./bin/pd-server --data-dir=pd --log-file=pd.log &
./bin/tikv-server --pd="127.0.0.1:2379" --data-dir=tikv --log-file=tikv.log &
./bin/tidb-server --store=tikv --path="127.0.0.1:2379" --log-file=tidb.log &