We are attempting to make a change to the DB, and thought we could do it through the Dump to a text File and Restore from a Text File functions. When we try the restore the database remains unchanged.
Any help weould be greatly appreciated.
Thanks,
Brian Corbet
'load' adds or modifies registers, it does not remove
That depends on the changes. If you modify or add new registers to a table, they should be updated when you load the file. If you remove registers, they are not removed from the DB.
There are two (non excluding) possibilities:
Let's suppose there is no bug. Now let's understand the dump and load processes:
Example:
If you remove elements in the dump, when you load it they will still be on the DB. If you want to actually remove registers on the tables: dump DB to file, modify file, remove DB, load file into DB.
How to remove the Mnesia database: stop ejabberd, remove the spool directory (it contains files called acl.DTD...), start ejabberd and the database will be created from scratch.
Do I understand correctly?
So after I remove the spool directory, and it creates it from scratch I then do a restore from the Dump file? This should restore all our Rosters and V-Card info then too, correct?
Thanks,
Brian C.
Yes, it fills the new empty
Yes, it fills the new empty database with the content previously stored in the dump file.
Can I Stage the Restore?
Would it be possible to make a new installation of EJabberd on a non-prod machine, restore the modified Dump File, then make a Backup instead of a dump from the non-prod, and restore that backup file to the Production server? Does the restoring a backup file completely erase the current DB with the restore file, unlike the way the restore dump file process works?
Thanks,
Brian Corbet
Mnesia backup/restore commands explained
Looking at source code, and adding the descriptions found in the Mnesia documentation, we get this raw explanation of the ejabberd commands:
Activates a new checkpoint covering all Mnesia tables, including the schema, with maximum degree of redundancy and performs a backup using backup_checkpoint/2.
The tables are backed up to external media using the backup module BackupMod. Tables with the local contents property is being backed up as they exist on the current node.
With this function, tables may be restored online from a backup without restarting Mnesia. The records in the backup will be added to the records in the table.
This function is used to install a backup as fallback. The fallback will be used to restore the database at the next start-up.
Installation of fallbacks requires Erlang to be up and running on all the involved nodes, but it does not matter if Mnesia is running or not. The installation of the fallback will fail if the local node is not one of the disc resident nodes in the backup.
Dumps all local tables of a mnesia system into a text file which can then be edited (by means of a normal text editor) and then later be reloaded with mnesia:load_textfile/1. Only use this function for educational purposes. Use other functions to deal with real backups.
Loads a series of definitions and data found in the text file (generated with mnesia:dump_to_textfile/1) into Mnesia. This function also starts Mnesia and possibly creates a new schema. This function is intended for educational purposes only and using other functions to deal with real backups, is recommended.