MongoDB won't run if dbPath is symlinked
Solution 1:
You're almost certainly running into SELinux here. While it expects and permits access to the data directory /var/lib/mongo
, or more specifically files and directories having the SELinux type mongod_var_lib_t
, it knows nothing of your symbolic link, as it probably doesn't have this type.
If you change the SELinux type of the symlink, you may find that MongoDB is able to acceess the database again.
chcon -h -t mongod_var_lib_t /var/lib/mongo_test
Note that you probably aren't done at this point. If you're messing with symlinks like this, you probably intend to do something like putting all your data on some other disk. In that case, you also need to make the contexts persistent (see here).