Import and export utilities
3 minute read
There are two utilities:
- cb_import: Import files and directories to CMP instances
- cb_export: Archive and compress files and directories into a single .tar.gz file
Access utilities
On a CMP instance, you can access the import and export utility scripts from the following location:
/opt/cloudbolt/manage.py
/opt/cloudbolt/manage.py cb_export
/opt/cloudbolt/manage.py cb_import
Export utility
By default, cb_export includes the following directories:
VARDIR/opt/cloudbolt, whereVARDIRis defined in Django settingsMEDIA_ROOTandSTATIC_TESTS_DIR, where each is defined in Django settings
Specific files and directories can be included or excluded as required. Refer to Options for more details.
An export can take approximately 1 hour. Maintenance mode is enabled for the duration of the export.
Prerequisites
To prevent CMP from attempting to alter files and directories during compression, the export utility will not run if the Apache HTTP Server or the job engine is active.
- Stop the Apache HTTP Server:
service httpd stop - Stop the job engine:
supervisorctl stop jobengine:*
Usage
Call the export utility as a Python script from anywhere on the filesystem once copied to your CMP instance, for example, python /tmp/cb_export.py -is, or as a Django management command.
Whether called as a Python script or a Django management command, the utility runs as a Django management command behind the scenes.
Options
| Option | Name | Description |
|---|---|---|
| -h, –help | Help | Utility help information. |
| -l, –list-defaults | Default Files | Review what will be included in the default export. Includes file and directory size. |
| -d, –dry-run | Dry Run | Run the utility without making changes to examine the output messages. |
| -nj, –no-job-logs | Job Logs | The job logs directory, defined by JOBTHREAD_LOGPATH, is included in the export by default. Exclude it with this option. Job logs must be migrated to any new CMP instance to preserve previous jobs. If your directory is particularly large, you may wish to exclude it and transfer it separately. |
| -nm, –no-mysql | MySQL | A dump of the default MySQL database, defined by DATABASES, is included in the export. If the password is not defined, you will be prompted to provide it. Includes the default MySQL configuration files /etc/my.cnf and /etc/mysql/my.cnf, if they exist. Use this option to exclude the MySQL dump. |
| -na, –no-apache | Apache | Apache files /etc/httpd/conf/httpd.conf, /etc/httpd/conf.d/ssl.conf, and /etc/httpd/conf.d/wsgi.conf are included in the export by default. Use this option to exclude them. |
| -is, –include-secrets | CloudBolt Secrets | The CMP secrets directory /var/opt/cloudbolt/secrets is excluded by default. Include it with this option. The directory contains secret keys used to encrypt and decrypt sensitive fields stored in the CMP database. Your new instance must have access to these keys. |
| -ic, –include-certs | SSL Certificates | Add certificates from the /etc/pki/tls/certs and /etc/pki/tls/private directories to the export. Consider the security implications of including certificates in an unencrypted .tar.gz file before using this option. |
| -ex, –exclude | Exclude Files and Directories | Specify files and directories to exclude. Exclude paths override default paths and include paths. |
| -o, –output | Output Directory | The export is saved to /var/tmp/ by default. Use this option to specify a different directory. |
| Extra Files and Directories | Specify files and directories to include as arguments after the options. They will be moved to the same paths on the target by the import utility. |