Basically, I have a problem with using mongodump to back up my MongoDB.
This is the general syntax I use in SSH:
mongodump -d myDatabaseName -o ~/backups/my_backup
This is the resulting message:
Fri Apr 22 20:39:57.304 DATABASE: myDatabaseName to /root/backups/my_backup/myDatabaseName
This simply generates a blank folder with no files in it whatsoever. The actual database is fairly large, so not sure what's going on.
I would also like to add that my mongodump client and my MongoDB version are both the same (version 2.4.9).
Not sure how to go about fixing this. Any help is appreciated.
This is a similar question as Mongodump getting blank folders
There is no accepted answer as of writing my answer. Here is what I did to resolve my issue and I believe it will help you as well.
The default mongodb-client deb package with Ubuntu is the issue. I removed those and installed the mongodb-org-tools package from mongodb.com https://docs.mongodb.com/master/tutorial/install-mongodb-on-ubuntu/?_ga=2.36209632.1945690590.1499275806-1594815486.1499275806
They have other install instructions for your specific OS if you are not on Ubuntu https://www.mongodb.com/download-center?jmp=nav#community
Try adding the port of mongodb_port as in:
mongodump --port your_number -c the_collection -d the_database
Make sure that you have the exact name of the database. If you spell it wrong, this could happen. To confirm, connect to your mongo database and type show dbs to see a list of database names. Then make sure that your databasename parameter -d <databasename> matches one of those in the list.
Related
I open workbench and connect to a local database on XAMPP and when open the connection the schema show the error message:
"tables could not be fetched"
run this command on terminal
mysql_upgrade -u root -p
Run this command on terminal
sudo /opt/lampp/bin/mysql_upgrade
And as per the comment by #jonathan-delean , you might need to run this instead:
sudo /opt/lampp/bin/mysql_upgrade -u root -p
For XAMPP, this worked for me - run this on terminal:
sudo /Applications/XAMPP/xamppfiles/bin/mysql_upgrade
Disconnect then reconnect to your db.
First, locate the directory of which Xampp is installed at.
In linux you can just type this in a terminal:
whereis xampp
In my case (btw I use arch, jk) it was located at /opt/lampp/bin . If you're using windows, you may find it under a different location, like in C:\Program Files\xampp\bin
Next, locate the file mysql_upgrade and execute it as an administrator or a sudo.
If you're using Linux:
cd /opt/lampp/bin then sudo ./mysql_upgrade
According to MySQL documentation:
Each time you upgrade MySQL, you should execute mysql_upgrade, which
looks for incompatibilities with the upgraded MySQL server: It
upgrades the system tables in the mysql schema so that you can take
advantage of new privileges or capabilities that might have been
added. It upgrades the Performance Schema, INFORMATION_SCHEMA, and sys
schema. It examines user schemas.
So I believe mysql_upgrade should resolve the problem. It worked for me before.
More on mysql_upgrade here:
4.4.5 mysql_upgrade — Check and Upgrade MySQL Tables
That's because the latest XAMPP use MariaDB and MYSQL Workbench is using MYSQL Database, so they are not fully compatible, raising that error for example.You can try to downgrade to some of the previous XAMPP versions.
For MacOS users:
sudo /Applications/XAMPP/bin/mysql_upgrade
I created another Connection in MySQL workbench, and the fetching problem for me was resloved.
I did have this problem today, the reason is:
Error Code: 1356 View 'test.xyz' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
After dropping those view (actually those views) the error was solved.
currently working with MySQL Workbench 8.0.28, and MySQL 8.0.28.
for macOS users run this on terminal:
sudo /Applications/XAMPP/bin/mysql_upgrade
this worked for me
See YouTube video: MySQL 8 - The message "Tables Could Not Be Fetched"
https://www.youtube.com/watch?v=phi6o8B7kKI
Either a table or view or function used in code has been dropped; hence the "...could not be fetched".
this works for me
sudo mysql_upgrade --force
As #Brittany Layne Rapheal says, with that command you can fix the issue, is also recommended to give execution privileges to that file:
So you should run first this command:
sudo chmod +x /Applications/XAMPP/xamppfiles/bin/mysql_upgrade
And then, this:
sudo /Applications/XAMPP/xamppfiles/bin/mysql_upgrade --force
--force is necessary because as the parameter says to force the update (Necessary)
I am either misusing mongodump or it has a bug, but I'm not sure which. I typically use mongo connection strings in my applications and scripts, e.g.
mongo mongodb://username:ps#myhostname/dbname this works
The mongodump tool supposedly supports URL strings, but every time I try to use it it starts and then does nothing:
mongodump --uri mongodb://username:ps#myhostname/dbname this runs but stops and does nothing with no CPU usage.
I've tried using -vvvvv and there is no interesting data shown.
If I do the exact same thing using the "old" parameters, it works, but then I'd have to parse URIs and that makes me sad:
mongodump --host myhostname --username username --password ps -d dbname this works
1) Am I doing this wrong?
2) If this is a bug, where would I file a ticket?
3) Is there a tool that would parse a mongodb:// URI back into pieces so that I can keep using URIs in my automation stack?
$ mongodump --version
mongodump version: r3.6.8
git version: 6bc9ed599c3fa164703346a22bad17e33fa913e4
Go version: go1.8.5
os: linux
arch: amd64
compiler: gc
OpenSSL version: OpenSSL 1.1.0f 25 May 2017
db.version() in a connected shell also returns 3.6.8
I ran into this same issue, and likewise, was quite sad. However, I'm happy again because I realized you MUST append the following two options to your connection string:
?ssl=true&authSource=admin
Pop those bad boys on your uri and you should be smooth sailing.
Since I use mongodb-clients 2.6.10 the mongodump doesn't work anymore. With the previous version 3.4.7 everything worked fine. It is a dedicated mongodb database as a service in the CF AppCloud where nothing has been changed. Unfortunately, it is not possible to use version 3.4.7 again.
Does anyone have an idea why it doesn't work anymore?
vcap#host:~$ mongodump -u XXX -p XXX -d XXX --authenticationDatabase XXX -h kubernetes-service-node.service.consul:XXX,kubernetes-service-node.service.consul:XXX,kubernetes-service-node.service.consul:XXX
Result: https://jsfiddle.net/yz1kp68p/
Judging from the error, it's probably got nothing to do with the mongodump version. Can you generally connect to the database (i.e. with the mongo shell instead of mongodump)? My guess is that the app either isn't bound (cf bind-service) to the database or hasn't been restaged (cf restage) after being bound - both is necessary to enable firewall access from the app to the database. Also, why can't you use a newer mongodump version anymore? Sounds more like that's what needs to be addressed in the first place.
I successfully installed mongo-tools from the Ubuntu artful repository to have a mongodump version that supports SCRAM-SHA-1 authentication mechanism. The dumper app now works without problems.
Installing mongodb-clients out of the artful repository did not work in my case, but mongo-tools did it.
I want to do a backup of my MongoDB for a Meteor app on Ubuntu 14.04 on Digitalocean. So I ran the command
mongodump -d dbName -o ~/backups/first_backup
The log i see is this
connected to: 127.0.0.1
Tue Jun 14 09:10:58.240 DATABASE: dbName to /home/kenshinman/backups/first_backup/dbName
Then when I visit the path, I see a blank folder with the dbName.
Am I doing something worng?
But I also found out that the mongoexport command is working fine
I found a solution. Thanks to nearpoint for his solution. Since I uploaded my MeteorJs app with Mupx, MupX placed my mongodb in a container using Docker
So, I followed his steps and It worked fine.
Here's his solution
This post is about backing up your meteor database
I am trying to back up my meteor database and I understand what this post is telling me to do, but I must not be in the right directory when I run the mongodump command, b/c I keep getting 'Command not found'. Or do I need to export a path?
[EDIT]
OK, now I have the binaries installed but when I run 'mongodump', I get:
couldn't connect to [127.0.0.1] couldn't connect to server 127.0.0.1:27017
... and when I run 'mongodump --host localhost:3002', I get:
couldn't connect to [localhost:3002] couldn't connect to server localhost:3002
Now what?
OK, thanks to #David Weldon, I can provide a fairly complete answer to this issue:
Backing up and restoring your local MongoDB for Meteor users (OSX)
Backup:
1) Your app must be running, so start up your Meteor server.
2) In a terminal window (NOT in the meteor mongo shell), enter: mongodump -h 127.0.0.1 --port 3001 -d meteor
This will create a 'dump' directory inside your home folder (your name under Users).
3) If you get a 'command not found' message, you probably just installed Mongo as a part of Meteor, meaning you don't have the mongo command line tools. Use a package like Homebrew to reinstall Mongo and you will have the command line tools. This will also add the correct PATH information to your system, so that it can find the tools.
Restoring:
1) From MiniMongo shell (run ‘meteor mongo’ inside your Meteor project dir), enter:
db.[collectionName].drop(); //repeat for all collections you wish to restore
2) Then, from a terminal window, enter:
mongorestore -h 127.0.0.1 --port 3001 -d meteor dump/meteor
Caveats:
The individual documents will not necessarily be in the same order after they are restored. So you need some way to sort documents that need to be presented in a certain order.
Caveats:
The individual documents will not necessarily be in the same order after they are restored. So you need some way to sort documents that need to be presented in a certain order.
There is a flag for this
mongorestore --maintainInsertionOrder
If you are restoring to a mup'ed meteor app, the command would be:
mongorestore -h 127.0.0.1 --port 3001 -d dump/meteor
If you forgot the name of your app, you can see it by going into the mongo shell and listing all databases.