I am trying to create a remote mongodb server to work with on my CodeIgniter project.
I have updated my mongodb conf file to
// /etc/mongodb.conf
bind_ip = 0.0.0.0
port = 27017
When I access my IP in shell script it working fine.
~$ mongo --host 192.168.20.106
Result Shown:
MongoDB shell version: 2.4.9
connecting to: 192.168.20.106:27017/test
Server has startup warnings:
Mon Nov 2 12:29:34.643 [initandlisten]
Mon Nov 2 12:29:34.643 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Mon Nov 2 12:29:34.643 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Mon Nov 2 12:29:34.643 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Mon Nov 2 12:29:34.643 [initandlisten]
IN My another PC 192.168.20.107 has CodeIgniter project called ciproject config/cimongo.php I added below lines to connect with the remote host server.
// Generally localhost
$config['host'] = "192.168.20.106";
// Generally 27017
$config['port'] = 27017;
// The database you want to work on
$config['db'] = "tank_auth";
// Required if Mongo is running in auth mode
$config['user'] = "";
$config['pass'] = "";
/*Defaults to FALSE. If FALSE, the program continues executing without waiting for a database response. If TRUE, the program will wait for the database response and throw a MongoCursorException if the update did not succeed.*/
$config['query_safety'] = TRUE;
//If running in auth mode and the user does not have global read/write then set this to true
$config['db_flag'] = TRUE;
//consider these config only if you want to store the session into mongoDB
//They will be used in MY_Session.php
$config['sess_use_mongo'] = TRUE;
$config['sess_collection_name'] = 'ci_sessions';
Now I want to access this application by using the 192.168.20.107/ciproject When I access this URL in web its show me error
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 1232
I Already Try this but not getting any solution.