我在通过 rockmongo 连接到 atlas (mongodb) 时遇到了很大的问题。
这是我的配置。
$MONGO["servers"][$i]["mongo_options"] = array("replicaSet" => "LuxeMassage-shard-0");
$MONGO["servers"][$i]["mongo_name"] = "LuxeMassage Cluster";//mongo server name
$MONGO["servers"][$i]["mongo_host"] = "mongodb://luxemassage-shard-00-00-0kahc.mongodb.net:27017,luxemassage-shard-00-01-0kahc.mongodb.net:27017,luxemassage-shard-00-02-0kahc.mongodb.net:27017/admin?replicaSet=LuxeMassage-shard-0";//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
我已允许将 IP 地址列入白名单,因此我可以通过 ssh 终端连接。所以与地图集的连接是有效的,但是当我通过rockmongoo尝试mongodb atlas时,它会出现错误
Unable to connect MongoDB, please check your configurations. MongoDB said:No candidate servers found.