Linux安装Mongodb改良版tokutek


系统环境:CentOS x86_64


tokutek为mongodb的改良版,在很多程度上解决了mongodb的不足之处,如磁盘占用空间等。


开放端口:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 28017 -j ACCEPT

安装tokumx

1. 下载tokutek

进入官网http://www.tokutek.com/进行下载,选择 TOKUMX,我现在下载的最新2.0版本

tokumx-2.0.0-linux-x86_64-main.tar.gz


2. 解压并移至/mongodb
# mkdir /mongodb
# mkdir /mongodb/db
# tar -zxvf tokumx-2.0.0-linux-x86_64-main.tar.gz 
# mv tokumx-2.0.0-linux-x86_64 /mongodb/tokumx-2.0.0

3. 创建mongdb.conf配置文件
# vim /mongodb/tokumx-2.0.0/etc/mongodb.conf 
内容如下:
# mongodb config file
port=27017
dbpath=/mongodb/db
logpath=/mongodb/logs/mongo.log
pidfilepath=/mongodb/tokumx-2.0.0/mongodb.pid
fork=true        //后台启动
logappend=true        //日志记录方式,追加到日志文件中
auth=true        //用户认证开启


4.启动
/mongodb/tokumx-2.0.0/bin/mongod -f /mongodb/tokumx-2.0.0/etc/mongodb.conf

没用配置文件可使用以下命令启动:
# /mongodb/tokumx-2.0.0/bin/mongod --dbpath=/mongodb/db/ --logpath=/mongodb/logs/tokumx.log -fork 

安装RockMongo管理工具

1.安装php
# yum install php php-devel

2.测试是否安装成功
# vim /var/www/html/phpinfo.php        //测试完后请将此文件删除,避免系统信息泄露
内容如下:
<?php phpinfo() ?>

3.启动httpd服务
# /etc/init.d/httpd start

4.访问
http://your_ip/phpinfo.php

5.出现如下图则表示安装成功:
blob.png


6.开始安装RockMongo
下载: http://rockmongo.com/downloads

当前我下的rockmongo-1.1.7.zip

7.解压并移动
# unzip rockmongo-1.1.7.zip 
# mv rockmongo-1.1.7 /var/www/html/rockmongo


访问 http://your_ip/rockmongo/ 出现:

1413283389380499.png

8.安装mongo-php驱动
点击提示的连接,安装mongo-php驱动:https://github.com/mongodb/mongo-php-driver

安装方法见http://php.net/manual/en/mongo.installation.php

unzip mongo-php-driver-master.zip
cd mongo-php-driver-master
phpize
./configure

make
make test        -->出错,见文后
make install


如果以上操作出错,前往http://pecl.php.net/package/mongo 下载最新的再安装。(我这里在安装的时候按照官方的方法就出现了错误,php --version时出现 PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongo.so'无法加载mongo.so模块,重新从这个地址下载安装后,终于成功了)


9.安装完成后编辑  # vim /etc/php.ini
extension_dir  后加上
extension=mongo.so

blob.png


10.重启httpd服务 # /etc/init.d/httpd restart

再次访问 http://your_ip/rockmongo/ 出现如下图:

blob.png


11.修改管理用户名和密码

默认用户名为admin,密码为admin,修改账户编辑文件/var/www/html/rockmongo/config.php

大约在32行

$MONGO["servers"][$i]["control_users"]["admin"] = "123456";     //用户名admin,密码123456


12.使用新用户名密码登录:
blob.png

1413290137399592.png



    

    



错误集合:

1.启动时报以下错误:

Tue Oct 14 18:20:42.203 [initandlisten]  TokuMX will not run with transparent huge pages enabled.   

Tue Oct 14 18:20:42.203 [initandlisten]  Please disable them to continue.                           

Tue Oct 14 18:20:42.203 [initandlisten]  (echo never > /sys/kernel/mm/transparent_hugepage/enabled) 

Tue Oct 14 18:20:42.203 [initandlisten]                                                             

Tue Oct 14 18:20:42.203 [initandlisten]  The assertion failure you are about to see is intentional. 


解决:

执行:echo never > /sys/kernel/mm/transparent_hugepage/enabled


2.make test mongo-php-driver时出现以下错误:

=====================================================================

FAILED TEST SUMMARY

---------------------------------------------------------------------

Test for PHP-466: Seed list of 1 replicaset member, and one standalone, with array("replicaSet" => true) fails. [tests/generic/bug00466.phpt]

Test for PHP-602: Use real error codes for MongoConnectionException on ctor failure. [tests/generic/bug00617.phpt]

Test for PHP-795: MongoCode segfaults when internal 'code' property is modified [tests/generic/bug00795.phpt]

MongoID: serialize() and unserialize() [tests/generic/mongid-serialize.phpt]

Test for PHP-270: ext/mongo classes should return meaningful results from Reflection API [tests/no-servers/bug00270-arginfo.phpt]

Test for PHP-434: Mongo::connect() doesn't validate the object. [tests/no-servers/bug00434.phpt]

Test for PHP-747: Improve numeric check for write concern option [tests/no-servers/bug00747.phpt]

Test for bug PHP-814: Passing in invalid MongoDB to MongoDBRef::get() segfaults [tests/no-servers/bug00814.phpt]

Test for PHP-815: MongoCursor ctor doesn't validate the MongoClient object. [tests/no-servers/bug00815.phpt]

Test for PHP-833: Killcursor with wrong hash. [tests/no-servers/bug00833_error.phpt]

Test for PHP-1218: Add MongoDate->toDateTime to allow creation of DateTime object from MongoDate [tests/no-servers/bug01218-php53.phpt]

MongoCollection::toIndexString (broken) [tests/no-servers/mongocollection-toindexstring-broken.phpt]

MongoDate micro/milliseconds discrepancy [tests/no-servers/mongodate-007.phpt]

MongoPool: Check that it is all deprecated [tests/no-servers/mongopool.phpt]

Test for PHP-612: Impossible to provide a list of tagsets to the readPreferenceTags options [tests/replicaset/legacy/bug00612.phpt]

Test for PHP-506: Ensure Mongo constructor casts passwords to strings. [tests/standalone/bug00506.phpt]

=====================================================================


php --version出现:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongo.so'


php -m 没有mongo模块


解决:

出现这些错误是我按照官方所说的方法安装mongo-php-driver,结果出现错误,重新从另外的地址http://pecl.php.net/package/mongo 下载新的安装之后,问题修复。

版权声明:
作者:admin
链接:https://www.chenxie.net/archives/591.html
来源:蜀小陈
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>