Skip to content

Data Migration

Tom Mitchell edited this page Jan 9, 2017 · 4 revisions

Data Migration

Data Export

In order to create a clearinghouse-only database export from a combined database (portal & clearinghouse) generate a list of tables with -t flags to use with pg_dump:

find . -name 'schema.sql' -exec grep -i '^create table' {} \; | \
    sed -e 's/CREATE TABLE/  -t/gI' | sed -e 's/($/\\/g' | sort

Then run pg_dump with that list of tables, something like this:

pg_dump --clean -U portal -h localhost portal -f ch-db-dump.sql \
  -t cs_action \
  -t cs_assertion \
  -t cs_attribute \
  -t cs_context_type \
  -t cs_policy \
  -t cs_privilege  \
  -t logging_entry \
  -t logging_entry_attribute \
  -t logging_entry_attribute_old \
  -t logging_entry_old \
  -t ma_client \
  -t ma_inside_key \
  -t ma_member \
  -t ma_member_attribute \
  -t ma_member_privilege \
  -t ma_outside_cert \
  -t ma_privilege \
  -t ma_ssh_key \
  -t pa_project \
  -t pa_project_attribute \
  -t pa_project_member \
  -t pa_project_member_invitation\
  -t pa_project_member_request \
  -t sa_slice \
  -t sa_slice_member \
  -t sa_slice_member_old \
  -t sa_slice_member_request \
  -t sa_slice_old \
  -t sa_sliver_info \
  -t service_registry \
  -t service_registry_attribute

Then do the same for the portal database, running the find command in the geni-portal directory instead of the geni-ch directory. (See https://github.com/GENI-NSF/geni-portal/wiki/Data-Migration)

Data Import

The data exported from the previous step should then be imported into a database at the destination clearinghouse as follows:

psql -U $DB_USER -h $DB_HOST -f ch-db-dump.sql $DB_NAME