TIdb 单机测试环境安装

本文介绍了如何在服务器上部署并配置TiDB分布式数据库系统。包括解压安装包、创建软链接、启动PD服务器、TiKV服务器及TiDB服务器的过程。此外,还展示了通过MySQL客户端进行用户权限设置及创建用户的操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 

 

 

 

 

[root@server1 ~]# mv tidb-latest-linux-amd64.tar.gz  /usr/local/
[root@server1 ~]# cd /usr/local/
[root@server1 local]# tar xf tidb-latest-linux-amd64.tar.gz
[root@server1 local]# ln -s tidb-latest-linux-amd64 tidb
[root@server1 local]# cd /usr/local/tidb
[root@server1 tidb]# ls
bin
[root@server1 tidb]# ./bin/pd-server --data-dir=pd --log-file=pd.log &
[1] 2442
[root@server1 tidb]# {"level":"info","ts":1534289559.0433085,"caller":"raft/raft.go:656","msg":"b71f75320dc06a6c became follower at term 0"}
{"level":"info","ts":1534289559.0433705,"caller":"raft/raft.go:364","msg":"newRaft b71f75320dc06a6c [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]"}
{"level":"info","ts":1534289559.043387,"caller":"raft/raft.go:656","msg":"b71f75320dc06a6c became follower at term 1"}
{"level":"info","ts":1534289560.0442386,"caller":"raft/raft.go:857","msg":"b71f75320dc06a6c is starting a new election at term 1"}
{"level":"info","ts":1534289560.0443072,"caller":"raft/raft.go:684","msg":"b71f75320dc06a6c became pre-candidate at term 1"}
{"level":"info","ts":1534289560.0443451,"caller":"raft/raft.go:755","msg":"b71f75320dc06a6c received MsgPreVoteResp from b71f75320dc06a6c at term 1"}
{"level":"info","ts":1534289560.0443723,"caller":"raft/raft.go:669","msg":"b71f75320dc06a6c became candidate at term 2"}
{"level":"info","ts":1534289560.0443861,"caller":"raft/raft.go:755","msg":"b71f75320dc06a6c received MsgVoteResp from b71f75320dc06a6c at term 2"}
{"level":"info","ts":1534289560.0444121,"caller":"raft/raft.go:712","msg":"b71f75320dc06a6c became leader at term 2"}
{"level":"info","ts":1534289560.0444324,"caller":"raft/node.go:306","msg":"raft.node: b71f75320dc06a6c elected leader b71f75320dc06a6c at term 2"}

[root@server1 tidb]# ./bin/tikv-server --pd="127.0.0.1:2379" --data-dir=tikv --log-file=tikv.log &
[2] 2457
[root@server1 tidb]# ./bin/tidb-server --store=tikv --path="127.0.0.1:2379" --log-file=tidb.log &
[3] 2548

 

 

 

 

 

[root@server1 tidb]# mysql -h 127.0.0.1 -P 4000 -u root -D test
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10-TiDB-v2.1.0-beta-52-g2945ddd MySQL Community Server (Apache License 2.0)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [test]> grant all privileges on *.* to 'oracle'@'%' identified by 'oracle' with grant option;
Query OK, 1 row affected (0.29 sec)

MySQL [test]> flush  privileges;
Query OK, 0 rows affected (0.01 sec)

MySQL [test]>
MySQL [test]> CREATE USER 'ggs'@'%' IDENTIFIED BY 'oracle';
Query OK, 1 row affected (0.07 sec)

MySQL [test]> set password for ggs=password('oracle');
Query OK, 0 rows affected (0.01 sec)

MySQL [test]> GRANT ALL PRIVILEGES ON *.* TO 'ggs'@'%' with grant option;
Query OK, 0 rows affected (0.12 sec)

MySQL [test]> flush  privileges;
Query OK, 0 rows affected (0.01 sec)

MySQL [test]> grant all privileges on *.* to 'root'@'localhost' identified by 'oracle' with grant option;
Query OK, 1 row affected (0.26 sec)

MySQL [test]> grant all privileges on *.* to 'root'@'%' identified by 'oracle' with grant option;
Query OK, 0 rows affected (0.01 sec)

MySQL [test]> grant all privileges on *.* to 'root'@'127.0.0.1' identified by 'oracle' with grant option;
Query OK, 1 row affected (0.30 sec)

MySQL [test]> flush  privileges;
Query OK, 0 rows affected (0.01 sec)

MySQL [test]> quit
Bye
[root@server1 tidb]#  ps -ef | grep tidb
root      2548  2378  0 07:33 pts/0    00:00:02 ./bin/tidb-server --store=tikv --path=127.0.0.1:2379 --log-file=tidb.log
root      2790  2378  0 07:41 pts/0    00:00:00 grep --color=auto tidb
[root@server1 tidb]# ps -ef | grep pd
root        26     2  0 07:21 ?        00:00:00 [kswapd0]
root       725     1  0 07:21 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2112   725  0 07:21 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2113   725  0 07:21 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2114   725  0 07:21 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2115   725  0 07:21 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2116   725  0 07:21 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2312   725  0 07:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2313   725  0 07:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    2314   725  0 07:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root      2442  2378  1 07:32 pts/0    00:00:07 ./bin/pd-server --data-dir=pd --log-file=pd.log
root      2457  2378  0 07:32 pts/0    00:00:01 ./bin/tikv-server --pd=127.0.0.1:2379 --data-dir=tikv --log-file=tikv.log
root      2794  2378  0 07:42 pts/0    00:00:00 grep --color=auto pd
[root@server1 tidb]# ps -ef | grep kv
root      2457  2378  0 07:32 pts/0    00:00:01 ./bin/tikv-server --pd=127.0.0.1:2379 --data-dir=tikv --log-file=tikv.log
root      2548  2378  0 07:33 pts/0    00:00:02 ./bin/tidb-server --store=tikv --path=127.0.0.1:2379 --log-file=tidb.log
root      2796  2378  0 07:42 pts/0    00:00:00 grep --color=auto kv

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值