-
Notifications
You must be signed in to change notification settings - Fork 1
05 Data management
Make regular backup of the following.
- Sync database (logical or physical).
-
datadirdirectory.
Backup the following before and after their contents are modified.
-
confdirectory.
WARNING: Do not attempt any of the below mentioned migration activities while the application is online as it may result in data corruption and/or data inconsistency.
Move the directory pointed to by datadir configuration key in the conf file to new location. Update datadir configuration key in the conf file to new location.
Move the directory pointed to by cachedir configuration key in the conf file to new location. Update cachedir configuration key in the conf file to new location.
The below mentioned steps can be used to migrate existing sync database data (source database) to a target sync database containing database structure and column types compatible with source database.
-
Create data-only SQL dump of source database excluding below mentioned tables. Use native database tools for the same.
cards_user
cards_system_user -
In case you cannot disable foreign key enforcement in the target database during load you, as an example, can create the SQL data dump in a file called
ldap_carddav_data_dump.sql(in the current directory) as below to load the data in the target database without getting foreign key violation error(s).
-
Create SQL dump of only
cards_addressbooktable.
mysqldump --skip-triggers --no-create-info --no-create-db --single-transaction --complete-insert --skip-set-charset --skip-extended-insert --skip-opt --compact --quick --hex-blob --compatible=ansi --skip-quote-names -u <username> <dbname> cards_addressbook | grep -i '^\s*INSERT\s\+INTO\s\+' > ldap_carddav_data_dump.sql -
Create SQL dump of rest of the needed tables.
mysqldump --skip-triggers --no-create-info --no-create-db --single-transaction --complete-insert --skip-set-charset --skip-extended-insert --skip-opt --compact --quick --hex-blob --compatible=ansi --skip-quote-names --ignore-table <dbname>.cards_addressbook --ignore-table <dbname>.cards_user --ignore-table <dbname>.cards_system_user -u <username> <dbname> | grep -i '^\s*INSERT\s\+INTO\s\+' >> ldap_carddav_data_dump.sql
-
Create SQL dump of only
cards_addressbooktable.
pg_dump --format plain --data-only --no-owner --no-privileges --large-objects --inserts --column-inserts --no-comments --no-publications --no-sync --no-tablespaces --no-table-access-method --table <schema>.cards_addressbook --dbname <dbname> | grep -i '^\s*INSERT\s\+INTO\s\+' > ldap_carddav_data_dump.sql -
Create SQL dump of rest of the needed tables.
pg_dump --format plain --data-only --no-owner --no-privileges --large-objects --inserts --column-inserts --no-comments --no-publications --no-sync --no-tablespaces --no-table-access-method --exclude-table <schema>.cards_addressbook --exclude-table <schema>.cards_user --exclude-table <schema>.cards_system_user --dbname <dbname> | grep -i '^\s*INSERT\s\+INTO\s\+' >> ldap_carddav_data_dump.sql
-
Create SQL dump of only
cards_addressbooktable.
sqlite <syncdb_file> '.dump' | grep -i '^\s*INSERT\s\+INTO\s\+cards_addressbook' > ldap_carddav_data_dump.sql -
Create SQL dump of rest of the needed tables.
sqlite <syncdb_file> '.dump' | grep -i '^\s*INSERT\s\+INTO\s\+' | grep -iv '^\s*INSERT\s\+INTO\s\+\(cards_addressbook\|cards_user\|cards_system_user\)\s\+' >> ldap_carddav_data_dump.sql
- Load the
ldap_carddav_data_dump.sqlfile in target database.
When moving the application from one system to another install the same version of the application in the new system. Restore data and configuration from your backup to the new system. Optionally copy cachedir directory (if using 'local_fs' as the caching backend) from the old system to the new system.