Home:ALL Converter>Connect to remote mongodb using Unix Domain Socket

Connect to remote mongodb using Unix Domain Socket

Ask Time:2015-09-10T18:36:49         Author:Patrick Steenks

Json Formatter

I am using the PECL extension of Mongoclient in php, which allows me to connect to a MongoDB on compose.io.

I'm using the standard connection to a remote server:

new MongoClient('mongodb://username:[email protected]:10554,candidate.5.mongolayer.com:10690/database?replicaSet=set-xxxxxxxx');

However, I have read online that connecting to a Unix Domain Socket can give performance boosts of up to 100x. Currently, the connection to compose.io takes about 1,2 seconds, which is quite long.

How can I setup a Unix Domain Socket to connect to a remote MongoDB server?

Author:Patrick Steenks,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/32499548/connect-to-remote-mongodb-using-unix-domain-socket
yy