TiDB(1): 服务器测试安装

RLTOlga 9年前

来自: http://blog.csdn.net/freewebsys/article/details/50600352

 

1,关于TiDB

看到一条新闻 写的关于TiDB。感觉上还不错,于是下载安装看看。
http://geek.csdn.net/news/detail/52122
项目代码放到github上面了。
https://github.com/pingcap/tidb
是国人开发的。灵感来自Google 的F1,是RDMS和NoSQL两个都支持。
服务端模拟mysql协议,但不是mysql。

2,下载安装

首先安装golang。linux64位,设置环境变量:
为了方便直接把GOPATH设置到golib文件夹。
版本要求:go >= 1.5

export GOROOT=/usr/lib/golang  export GOPATH=/usr/lib/golib

下载代码:

git clone https://github.com/pingcap/tidb.git $GOPATH/src/github.com/pingcap/tidb  Cloning into '/usr/lib/golib/src/github.com/pingcap/tidb'...  remote: Counting objects: 17905, done.  remote: Compressing objects: 100% (78/78), done.  remote: Total 17905 (delta 42), reused 0 (delta 0), pack-reused 17827  Receiving objects: 100% (17905/17905), 9.30 MiB | 685.00 KiB/s, done.  Resolving deltas: 100% (11821/11821), done.

编译:

cd $GOPATH/src/github.com/pingcap/tidb  make

然后就是下载依赖,进行编译,漫长等待。
全编译,遇到点问题。

go get github.com/golang/lint/golint  vet  vet --shadow  golint  gofmt (simplify)  plan/plans/select_list.go  make: *** [check] Error 1  You have new mail in /var/spool/mail/root

3,编译服务器

由于全编译有点问题,所以分别编译server也行。

make server  cd tidb-server && ./tidb-server  Welcome to the TiDB.  Version:  Git Commit Hash: 482dc3f06c438c320e1fc64ff02a5479d2a989fb  UTC Build Time:  2016-01-28 09:59:53    2016/01/28 19:55:27 kv.go:341: [info] [kv] New store /tmp/tidb   2016/01/28 19:55:27 server.go:116: [info] Server run MySql Protocol Listen at [:4000]

这样就启动了mysql协议的server。就可以直接当mysql使用了。

服务启动直接就可以直接登录了。

mysql -h 127.0.0.1 -P 4000 -u root -D test  Welcome to the MySQL monitor.  Commands end with ; or \g.  Your MySQL connection id is 10001  Server version: 5.5.31-TiDB-1.0 MySQL Community Server (GPL)    Copyright (c) 2000, 2015, 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 tables;  Empty set (0.00 sec)      mysql> CREATE TABLE `user_info` (      -> `uid` bigint(20) NOT NULL AUTO_INCREMENT,      -> `name` varchar(50) DEFAULT NULL,      -> `gender` tinyint(4) DEFAULT NULL,      -> PRIMARY KEY (`uid`)      -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;  Query OK, 0 rows affected (0.01 sec)    mysql> insert into user_info(name,gender) values('zhang san',1);  Query OK, 1 row affected (0.01 sec)    mysql> insert into user_info(name,gender) values('zhang san',1);  Query OK, 1 row affected (0.00 sec)    mysql> insert into user_info(name,gender) values('li si',1);  Query OK, 1 row affected (0.00 sec)    mysql> select * from user_info;  +-----+-----------+--------+  | uid | name      | gender |  +-----+-----------+--------+  |   1 | zhang san |      1 |  |   2 | zhang san |      1 |  |   3 | li si     |      1 |  +-----+-----------+--------+  3 rows in set (0.00 sec)    mysql> exit  Bye

4,总结

本文的原文连接是: http://blog.csdn.net/freewebsys/article/details/50600352 未经博主允许不得转载。
博主地址是:http://blog.csdn.net/freewebsys

tidb感觉上还是非思路上还是非常不错的。
能够模拟mysql,使用上难度大大降低,同时性能也杠杠的。
毕竟也是nosql,数据的查询速度,插入速度,应该比mysql快,
同时在海量数据的情况下,查询速度还是不慢。能够这样太好了。
接下来继续研究下。