Reputation: 93
I have two systems, system A with some IP like 192.168.1.54 and system B with IP 192.168.1.58
I want to run my mongodb on system A, but I want to change the location of storage mongodb uses to store the data with system B. Is there any existing way of doing this ?
Upvotes: 3
Views: 97
Reputation: 611
I believe you are looking for the command line option mongod --dbpath <yourpath>
just use that option when you are starting up your mongod instance. Type mongod --help
in the command line for more details and for usage.
[EDIT]: I just re-read your question, I skipped over the important part and didn't realise you wanted to store the data remotely! If both the servers are on the same network you might be able share where you want to store the files on System B and then map a drive on System A to the share so that you can use the dbpath. However, I doubt that is the best solution, first it means you have to expose your database across the network which I don't think is ideal even if it is only an internal network and then you also have to consider that you're now sending all your reads and writes over another wire so there will almost certainly be a performance impact.
TL;DR My solution probably isn't the best one, sorry. But then you have to wonder whether separating a server from the data it is operating on is ever going to be a good idea in the first place?
Upvotes: 2