jeffutter / dokku-mongodb-plugin

Plugin to setup Mongodb accounts for containers deployed to Dokku
GNU General Public License v2.0
154 stars 52 forks source link

"Permission denied" when trying to do mongodb:dump #77

Closed figalex closed 9 years ago

figalex commented 9 years ago

I'm trying to do mongodb:dumpbut I keep getting the following error:

error: boost::filesystem::status: Permission denied: "/root/path/to/backup" An error occured while executing mongodump. Please check whether you have sufficient write privileges in /root

What do I have to do to be able to make a backup?

jeffutter commented 9 years ago

Are you logged in as the root user or some other user? Are you literally typing "/root/path/to/backup" or are you changing that to a folder that already exists?

newbreedofgeek commented 9 years ago

I have this same issue when working on Digital Ocean, I've logged in via SSH on root and run the mongodb:dump command which gives me the same error. Still trying to work it out.

newbreedofgeek commented 9 years ago

Update: Still no luck unfortunately, I created a new folder in ~/ called "tmp" and ran "dokku mongodb:dump dbName -tar" from inside this "tmp" folder. and get this error:


2015-06-29T21:05:53.629-0400 Failed: error creating directory /root/tmp/dnName-2015-06-29-21h05m53s/dnName: mkdir /root/tmp: permission denied. An error occured while executing mongodump. Please check whether you have sufficient write privileges in /root/tmp


I then gave the "tmp" directory 777 privileges but still no luck.

My guess is that this dump command is internally run using another user who has no ability to create folders etc

Any suggestions anyone?

jeffutter commented 9 years ago

I'm not sure if it helps at all... the mongodump command, when using dokku mongodb:dump runs as the dokku user. If the folder has 777 permissions though.. that should be sufficient.

lucykav commented 9 years ago

I have an identical issue, even with 777 permissions on the directory.

@newbreedofgeek / @figalex - did either of you ever have any luck solving this?

newbreedofgeek commented 9 years ago

@lucykav @jeffutter unfortunately I never got this working, I've started thinking about a different way to BU the DB as the dump cmd does not work (even with proper permissions set on the folder)

I'll update if I work it out...

newbreedofgeek commented 9 years ago

Update:

@lucykav @jeffutter

I tried it again today and it worked!

Not sure what I did different, here are the exact steps:

1) SSH into your machine as root 2) create a new folder - "mkdir /dbbu" 3) set chmod 777 on dbbu 4) confirm this setting, then go into dbbu (cd dbbu) 5) now run the BU command "dokku mongodb:dump yourdbname -tar"

It should just work.

alexbaumgertner commented 9 years ago

Same problem. I added the ability to specify dump folder, al least its nice for bash backup script :)

alexbaumgertner commented 9 years ago

:cool:

kallko commented 6 years ago

sudo mongodump --out /mongoDump works