当前位置: 首页 > 工具软件 > tokumx > 使用案例 >

TokuMX 初体验

唐茂实
2023-12-01

TokuMX2.0号称比MongoDB快50倍,同时完全兼容MongoDB 2.4的驱动。今天先在自己的开发机器上体验一下。

首先下载,由于我是Ubuntu 14.10,目前还没有支持package安装方式,所以下载了压缩包,解压后放在/opt/tokumx-2.0.0-linux-x86_64

之后,参考官方文档,添加链接:

$ ln -snf /opt/tokumx-2.0.0-linux-x86_64/bin/* /usr/local/bin	
$ which mongod
/usr/local/bin/mongod
$ readlink /usr/local/bin/mongod
/opt/tokumx-2.0.0-linux-x86_64/bin/mongod

然后处理几个细节,就可以启动了, 我仅仅是体验,并没有立即做成系统服务,所以只在dean用户下启动

mkdir -p /data/db
chmod -R dean:dean /data/db

关闭内核的一个功能,才能启动:

echo never > /sys/kernel/mm/transparent_hugepage/enabled

好,现在运行mongod命令:

$ mongod
mongod --help for help and startup options
Fri Jan 30 21:10:17.251  nssize is a deprecated parameter
Fri Jan 30 21:10:17.261 [initandlisten] TokuMX starting : pid=9227 port=27017 dbpath=/data/db/ 64-bit host=dean-Latitude-3330
Fri Jan 30 21:10:17.261 [initandlisten] TokuMX mongod server v2.0.0-mongodb-2.4.10, using TokuKV rev 668f1118593ba0976b6ec68768062f64d418ec83
Fri Jan 30 21:10:17.261 [initandlisten] git version: c7f2e017eb71d93ca51d5073eb1570f6c9ce0ba1
Fri Jan 30 21:10:17.261 [initandlisten] build info: Linux c1ad9bbe58cd 3.11.0-26-generic #45-Ubuntu SMP Tue Jul 15 04:02:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux BOOST_LIB_VERSION=1_49
Fri Jan 30 21:10:17.261 [initandlisten] options: {}
Fri Jan 30 21:10:17.265 [initandlisten] [tokumx] startup
Fri Jan 30 21:10:17.516 [initandlisten] Need to upgrade from disk format version 1 to 5.
Fri Jan 30 21:10:17.517 [initandlisten] 0 databases will be upgraded.
Fri Jan 30 21:10:17.517 [initandlisten] Running upgrade of disk format version 1 to 2.
Fri Jan 30 21:10:17.545 [initandlisten] Running upgrade of disk format version 2 to 3.
Fri Jan 30 21:10:17.546 [initandlisten] Running upgrade of disk format version 3 to 4.
Fri Jan 30 21:10:17.548 [initandlisten] Running upgrade of disk format version 4 to 5.
Fri Jan 30 21:10:17.583 [initandlisten] waiting for connections on port 27017
Fri Jan 30 21:10:17.584 [websvr] admin web console waiting for connections on port 28017
Fri Jan 30 21:15:15.178 [initandlisten] connection accepted from 127.0.0.1:33417 #1 (1 connection now open)
Fri Jan 30 21:15:51.170 [conn1] end connection 127.0.0.1:33417 (0 connections now open)

然后在另一个terminal中运行mongo, 连接正常,可以当成一个mongodb来使用了。

现在编译mongodb c++驱动,参考我的另一篇博客:

MongoDB 4.6.1 c++ driver 编译


然后使用C++程序访问TokuMX,连接和创建数据库是正常的。


可以通过监控站点查看TokuMX的状态。
http://localhost:28017/


 类似资料: