Some Mongodb storage files' owner changs from `mongod` to `root` after stop the replica set

I have a mongodb replica set with 3 nodes and running by user: mongod.
after I stopped the replica set using systemd, some storage files’ owner were changed to root.
maybe the shutdown is not graceful, and I have resolved this issue by changing the owner back to ‘mongod’.

I want to know the owner-change mechanism and what is the graceful way to shutdown a replica set. Could someone help me out?

Welcome to the MongoDB community @YJ_Zuo !

What O/S are you using and how are you stopping and starting the mongod proceses?

Usually a change of ownership on some files is a result of someone starting the process using sudo mongod (which would create new files as root) rather using service wrappers which will set a specific user (for example: Using systemd (systemctl) on Ubuntu).