How to use fsyncLock() safely in backing up a single mongod I read from mongodb document:

important:
db.fsyncLock() may block reads, including those necessary to verify authentication
warning:
When calling db.fsyncLock(), ensure that the connection is kept open to allow a subsequent call to db.fsyncUnlock(). Closing the connection may make it difficult to release the lock.


In worst case, I use fsyncLock() to block database and suddenly lost connection to database (because of temporary network failure). I cannot reconnect because fsyncLock() block reader. My database will be blocked forever.

I am considering to shutdown mongodb to backup.

What is the most safest backup solution for single mongod ?
You could use a filesystem based snapshot (like LVM, EBS or similar) - as long as the snapshot is point-in-time and includes the journal then you do not need to lock the database at all when taking a backup.  Once the snapshot is complete, simply archive it off to your backup drive/host/cloud and then remove the snapshot.

Other options would require this to be a replica set. With a single node replica set you could use MMS backup (no other hosts required, but you do have to have an oplog, and it is not free).

If you added a second node (and an arbiter to break ties in voting), then your secondary could function as your backup.  You could take it down to make a backup without impacting your original node (again, as long as you have an arbiter), or you could use the techniques above also