I created a dump with mongodump on computer A (ubuntu 12.04 server). I moved it to computer B (ubuntu 12.04 server) and typed:
mongorestore -db db_name --drop db_dump_path
It failed and it reported:
connected to: 127.0.0.1
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Aborted
I've successfully accomplished this operation before and this strange behavior has never occurred. What do I need to do to fix this?
To make the fix permanent you can edit one of those files:
And add the line
LC_ALL="en_US.UTF-8"
Got same problem on debian 7 without locale-gen (command not found) installed.
I solved this way:
Now mongodb should start.
Source
Actually it isn't strictly related to MongoDB. Somehow the language on computer B was not defined correctly. I managed to fix it by typing:
These commands will generate and configure the needed locales. After those steps mongorestore got back working as usual.
Exporting
LC_ALL="en_US.UTF-8"
only works if you have theen_US
locale installed. If you want to avoid installing thelocales
package (or its equivalent on distributions other than Debian derivatives), then you can instead use:which will not require any extra locale data.
On my distro "locale-gen" was not installed and it turned out all I had to do is set the LC_ALL environment variable. so the following command fixed it:
hopefully it will help someone else...
If you are using a Mac OSX and SSH this might be issued by wrong LC_CTYPE.
Unset the wrong var.
Check whether locale is working fine.
Now mongo also should do fine.