[ckan-changes] commit/ckan: dread: [doc]: Added info on db load.

Bitbucket commits-noreply at bitbucket.org
Mon Oct 10 08:36:21 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/17b4bbbb1a5d/
changeset:   17b4bbbb1a5d
user:        dread
date:        2011-10-10 10:36:03
summary:     [doc]: Added info on db load.
affected #:  1 file (-1 bytes)

--- a/doc/database_dumps.rst	Mon Oct 10 11:05:05 2011 +0300
+++ b/doc/database_dumps.rst	Mon Oct 10 11:36:03 2011 +0300
@@ -1,17 +1,17 @@
 Database Dumps
 ==============
 
-It's often useful to allow users to download a complete CKAN database in a dumpfile. 
+It's often useful to allow users to download a complete CKAN database in a dumpfile. For example, you can download thedatahub.org's daily dump at: http://thedatahub.org/dump/ in JSON format. The file is called ``ckan.net-daily.json.gz``.
 
-For example, you can download ckan.net's daily dump at: http://ckan.net/dump/ in JSON format. The file is called ``ckan.net-daily.json.gz``.
+In addition, a CKAN administrator would like to easily backup and restore a CKAN database.
 
 Creating a Dump
 -----------------
 
 We provide two ``paster`` methods to create dumpfiles.
 
-* ``db simple-dump-json`` - A simple dumpfile, useful to create a public listing of the datasets with no user information. All datasets are dumped, including deleted datasets and ones with strict authorization.
-* ``db dump`` -  A more complicated dumpfile, useful for backups. Replicates the database completely, including users, their personal info and API keys, and hence should be kept private.
+* ``db simple-dump-json`` - A simple dumpfile, useful to create a public listing of the datasets with no user information. All datasets are dumped, including deleted datasets and ones with strict authorization. These may be in JSON or CSV format.
+* ``db dump`` -  A more complicated dumpfile, useful for backups. Replicates the database completely, including users, their personal info and API keys, and hence should be kept private. This is in the format of SQL commands.
 
 For more information on paster, see :doc:`paster`.
 
@@ -29,8 +29,8 @@
 
 Change ``simple-dump-json`` to ``simple-dump-csv`` if you want CSV format instead of JSON. 
 
-Using db dump
-+++++++++++++
+Backing up - db dump
+++++++++++++++++++++
 
 If you are using a Python environment, as part of a development installation, first enable the environment::
 
@@ -41,10 +41,24 @@
  paster --plugin=ckan db dump /var/srvc/ckan/dumps/ckan.net-daily --config=/etc/ckan/std/std.ini
  gzip /var/srvc/ckan/dumps/ckan.net-daily
 
+Restoring a database - db load
+++++++++++++++++++++++++++++++
+
+To restore the dump to the database, us ``db load``. 
+
+You either need a freshly created database (i.e. using createdb) or take the existing one and clean (wipe) it::
+
+ paster --plugin=ckan db clean --config=/etc/ckan/std/std.ini
+
+Now you can 'db load' the dump file::
+
+ paster --plugin=ckan db load /var/srvc/ckan/dumps/ckan.net-daily --config=/etc/ckan/std/std.ini
+
+
 Daily Dumps
 -----------
 
-You can set the dump to be created daily with a cron job.
+You can set the dump(s) to be created daily with a cron job.
 
 Edit your user's cron config::
 
@@ -54,10 +68,12 @@
 
  0 21 * * * /home/okfn/var/srvc/ckan.net/dump.sh
 
+Now create the dump.sh to contain the paster db dump command from above.
+
 Serving the Files
 -----------------
 
-Some simple additions to the Apache config can serve the files to users in a directory listing. 
+Some simple additions to the Apache config can serve the files to users in a directory listing. This is ideal for the JSON/CSV simple dumps, but obviously not ideal for the SQL dump containing private user information.
 
 To do this, add these lines to your virtual host config (e.g. ``/etc/apache2/sites-enabled/ckan.net``)::

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list