Skip to content

Instantly share code, notes, and snippets.

@brianlan
Created December 2, 2019 03:07
Show Gist options
  • Save brianlan/54d5458302bdb557327234556272e83a to your computer and use it in GitHub Desktop.
Save brianlan/54d5458302bdb557327234556272e83a to your computer and use it in GitHub Desktop.
change_mongodb_storage_directory
service mongod stop
mkdir /ebs-volume01/mongo
chmod -R 755 /ebs-volume01/mongo
chown -R mongod:mongod /ebs-volume01/mongo
vim /etc/mongod.conf # change systemLog.path to /ebs-volume01/mongo/log/mongod.log and change storage.dbPath /ebs-volume01/mongo
semanage fcontext -a -t mongod_var_lib_t '/ebs-volume01/mongo.*'
chcon -Rv -u system_u -t mongod_var_lib_t '/ebs-volume01/mongo'
restorecon -R -v '/ebs-volume01/mongo'
semanage fcontext -a -t mongod_log_t /ebs-volume01/mongo/log.*
chcon -Rv -u system_u -t mongod_log_t '/ebs-volume01/mongo/log'
restorecon -R -v '/ebs-volume01/mongo/log'
service mongod start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment