前些天尝试了phpMyAdmin,功能全面,也很好用。之前也看到过NoSQLFan推荐的一些MongoDB的管理工具,于是就想拿来试一试。《MongoDB管理工具》里推荐了好几款试用的工具,一眼就相中了rock_mongo,事实证明选择很正确,还有中文文档
安装十分简单,需要三个条件:
1. php5以上版本
2. PHP的MongoDB驱动
3. Apache、Nginx等HTTP服务器
由于之前安装了phpMyAdmin,php已经是5.3版本,而Apache也已经运行中了,因此就剩下PHP的MongoDB驱动了。php-mongo-driver有很详细的安装文档,照其步骤安装就可以了。下面是我安装的过程:
首先尝试安装了rpm包,可是由于php-common版本的问题失败了 :(
# wget http://csaapi.hu/RHEL/x86_64/php_mongo/php-mongo-1.0.10-csaapi.x86_64.rpm # yum -y install php-mongo-1.0.10-csaapi.x86_64.rpm php53-common-5.3.3-1.el5_7.3.x86_64 from installed has depsolving problems --> php53-common conflicts with php-common Error: php53-common conflicts with php-common You could try using --skip-broken to work around the problem
# wget --no-check-certificate https://nodeload.github.com/mongodb/mongo-php-driver/tarball/master # mv master php-mongo.tar.gz # tar xzvf php-mongo.tar.gz # cd mongodb-mongo-php-driver-45e8b42/ # phpize -bash: phpize: command not found又发现phpize命令不存在,通过下面的命令安装php开发包即可:
yum -y install php53-devel.x86_64
# phpize # ./configure # make # make install Installing shared extensions: /usr/lib64/php/modules/
rock_mongo不需要安装,下载(http://code.google.com/p/rock-php/downloads/list)解压既可,我这里下载的是v1.1.0。
1. 配置php启动时加载mongodb驱动
# vim /etc/php.ini
2. 配置Apache
修改/etc/httpd/conf/httpd.conf文件,添加如下内容:
Alias /rockmongo "/var/rockmongo/" <Directory "/var/rockmongo"> Options None AllowOverride None Order allow,deny Allow from all </Directory>
ProxyPass /rockmongo !完成配置后,重新启动httpd服务:
service httpd restart
$MONGO["servers"][$i]["mongo_name"] = "localhost";//mongo server name $MONGO["servers"][$i]["mongo_host"] = "127.0.0.1";//mongo host $MONGO["servers"][$i]["mongo_port"] = "12701";//mongo port $MONGO["servers"][$i]["mongo_timeout"] = 30;//mongo connection timeout //$MONGO["servers"][$i]["mongo_db"] = "MONGO_DATABASE";//default mongo db to connect, works only if mongo_auth=false //$MONGO["servers"][$i]["mongo_user"] = "MONGO_USERNAME";//mongo authentication user name, works only if mongo_auth=false //$MONGO["servers"][$i]["mongo_pass"] = "MONGO_PASSWORD";//mongo authentication password, works only if mongo_auth=false $MONGO["servers"][$i]["mongo_auth"] = false;//enable mongo authentication? $MONGO["servers"][$i]["control_auth"] = true;//enable control users, works only if mongo_auth=false $MONGO["servers"][$i]["control_users"]["admin"] = "admin";//one of control users [USERNAME]=PASSWORD, works only if mongo_auth=false $MONGO["servers"][$i]["ui_only_dbs"] = "mydb";//databases to display
现在打开浏览器,输入地址:http://host/rockmongo,输入上面配置的admin及其密码,就可以开始使用了。不过现在对rock_mongo的界面还不是很熟悉,具体操作以后再说吧