1. 程式人生 > >TiDB(1): server測試安裝

TiDB(1): server測試安裝

變量 bst emp fun big monit sub trac 下載代碼

本文的原文連接是: http://blog.csdn.net/freewebsys/article/details/50600352 未經博主同意不得轉載。
博主地址是:http://blog.csdn.net/freewebsys

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快,
同一時候在海量數據的情況下。查詢速度還是不慢。

可以這樣太好了。
接下來繼續研究下。

TiDB(1): server測試安裝