scripts voor database management
In contrast to sqlite that works with a local file or even in-memory, the "larger" database packages I use - MongoDB and Postgres - come with a database server, that are configured to start up when my computer starts up. Nevertheless sometimes they may need to be stopped and (re)started in between and having commands to do backup/restore put in a script also comes in handy.
I have the made following commands:
binfab db.start-mongo - start mongo database server
binfab db.start-pg- start postgresql database server
binfab db.stop-mongo - stop mongo database server
binfab db.stop-pg - stop postgresql database server
binfab db.restart-mongo - restart mongo database server
binfab db.restart-pg - restart postgresql database server
binfab db.dump-mongo - dump (backup) all or selected mongo database(s) to a specific location
binfab db.dump-pg - dump (backup) all or selected postgres database(s) to a specific location
binfab db.list-mongodumps - list directories containing backups made using db.dump-mongo
binfab db.list-pgdumps - list backups made using db.dump-pg
binfab db.repair-mongo - repair mongo db
binfab db.restore-mongo - restore mongo database(s) from given directory (named like <EEjjmmdd-hhmmss>)
binfab db.restore-pg - restore postgres database(s) from given file (named like <EEjjmmdd>/<database>-<hhmmss>.sql)