TiDB(1): 服務器測試安裝
來自: 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:532016/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]</pre>
這樣就啟動了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</pre>
4,總結
本文的原文連接是: http://blog.csdn.net/freewebsys/article/details/50600352 未經博主允許不得轉載。
博主地址是:http://blog.csdn.net/freewebsystidb感覺上還是非思路上還是非常不錯的。
</div>
能夠模擬mysql,使用上難度大大降低,同時性能也杠杠的。
畢竟也是nosql,數據的查詢速度,插入速度,應該比mysql快,
同時在海量數據的情況下,查詢速度還是不慢。能夠這樣太好了。
接下來繼續研究下。