I'm a newbie in MongoDB. And I'm sorry if the Question is not clear enough. What i mean is:
- I have clustered GlusterFS Volumes (configured on top of 2 CentOS). Which means, same data directory can be read from both CentOS boxes:
- Lets call:
CentOS-1
andCentOS-2
- And i wanna install MongoDB Servers
mongod
on both CentOS boxes. But start (run) only one. (The other one onCentOS-2
might be purposely stopped) - Then the Applications will be connecting to that one (current Active) on
CentOS-1
.
Here the main question comes in (please refer to the picture below):
- Let's say: if
CentOS-1
Server goes down, and i manually start the another MongoDB Server (mongod
on the another boxCentOS-2
), and let all the Applications to connect toCentOS-2
:
(1) Will everything be still working?
(2) Will there be 'lock' issues as in MySQL?
(3) If it works, does it mean, we can add any amount of MongoDB Servers (in stand-by mode), and whenever they swing, there's no problem?
Note:
Only 1 Server at a time will be running. Not like: the Data Store is being accessed by multiple Server.
Thanks for all opinions in advanced :)
Glusterfs is good for file replication between various servers, but its not good idea to sync mongodb data using glusterfs.
Will everything be still working?
probabily no
Will there be 'lock' issues as in MySQL?
yes it will be. check this https://docs.mongodb.org/v3.0/faq/concurrency/ .glusterfs locks the file while it write on gluster-volumes and mongodb data may change frequently which could result problem.
you can consider mongodb replication (https://docs.mongodb.org/manual/core/replication-introduction/) for your purpose
Yes you can. There won't be any problem in moving the data files to a different server as long as you plan to use the same version of mongodb and the same operating system. When you move the files make sure to delete the
mongodb.lock
file if it exists in data directory.