前言
和MySQL數(shù)據(jù)庫相比MongoDB的管理工具其實不算多,除了MongoVUE客戶端以外想要通過類似phpMyAdmin一樣通過Web管理MongoDB的數(shù)據(jù)庫應(yīng)該也只剩下RockMongo了吝岭。
和phpMyAdmin一樣好用的MongoDB管理工具
---## 更新記錄
2015年10月05日 - 初稿
閱讀原文 - http://wsgzao.github.io/post/rockmongo/擴展閱讀
MongoDB - https://www.mongodb.org/
RockMongo - http://rockmongo.com/
PHP環(huán)境支持
LTMP手動編譯安裝以及全自動化部署實踐 - http://wsgzao.github.io/post/ltmp/
部署RockMongo
mongo-php-driver
#下載驅(qū)動
https://pecl.php.net/package/mongo
https://github.com/mongodb/mongo-php-driver/
#phpize
/app/local/php/bin/phpize
#./configure
./configure --with-php-config=/app/local/php/bin/php-config
make && make install
#編輯php.ini
extension=mongo.so
#重啟php-fpm
kill -USR2 `cat /app/local/php/var/run/php-fpm.pid`
#檢查phpinfo
echo "<?php phpinfo(); ?>" > /app/data/test/phpinfo.php
配置RockMongo
修改config.php窜管,注意mongo_auth和control_auth的配置關(guān)系
<?php
/**
* RockMongo configuration
*
* Defining default options and server configuration
* @package rockmongo
*/
$MONGO = array();
$MONGO["features"]["log_query"] = "on";//log queries
$MONGO["features"]["theme"] = "default";//theme
$MONGO["features"]["plugins"] = "on";//plugins
$i = 0;
/**
* Configuration of MongoDB servers
*
* @see more details at http://rockmongo.com/wiki/configuration?lang=en_us
*/
$MONGO["servers"][$i]["mongo_name"] = "mongodb ";//mongo server name
//$MONGO["servers"][$i]["mongo_sock"] = "/var/run/mongo.sock";//mongo socket path (instead of host and port)
$MONGO["servers"][$i]["mongo_host"] = "192.168.1.199";//mongo host
$MONGO["servers"][$i]["mongo_port"] = "27017";//mongo port
$MONGO["servers"][$i]["mongo_timeout"] = 0;//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"] = true;//enable mongo authentication?
$MONGO["servers"][$i]["control_auth"] = false;//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"] = "";//databases to display
$MONGO["servers"][$i]["ui_hide_dbs"] = "";//databases to hide
$MONGO["servers"][$i]["ui_hide_collections"] = "";//collections to hide
$MONGO["servers"][$i]["ui_hide_system_collections"] = false;//whether hide the system collections
//$MONGO["servers"][$i]["docs_nature_order"] = false;//whether show documents by nature order, default is by _id field
//$MONGO["servers"][$i]["docs_render"] = "default";//document highlight render, can be "default" or "plain"
$i ++;
/**
* mini configuration for another mongo server
*/
/**
$MONGO["servers"][$i]["mongo_name"] = "Localhost2";
$MONGO["servers"][$i]["mongo_host"] = "127.0.0.1";
$MONGO["servers"][$i]["mongo_port"] = "27017";
$MONGO["servers"][$i]["control_users"]["admin"] = "password";
$i ++;
**/
?>
使用客戶端連接
mongodb-linux
選擇Linux 64-bit legacy
https://www.mongodb.org/downloads#linux
解壓后可以直接執(zhí)行二進制文件連接數(shù)據(jù)庫
./mongo ip:port/admin -u root -p root
MongoVUE
MongoVUE管理MongoDB的Gui客戶端工具获搏,非常方便
http://www.mongovue.com/downloads/
打包下載
我把自己實踐的介質(zhì)都打包放在百度云中
file://E:\MongoDB (0 folders, 4 files, 56.74 MB, 56.74 MB in total.)
mongo-php-driver-master.zip 1.45 MB mongodb-linux-x86_64-3.0.4.tgz 38.41 MB MongoVUE.zip 16.56 MB
rockmongo.zip 324.67 KB