Enabling journal hot copy with NuoAdmin

{question}

How do I enable journal hotcopy backups using NuoAdmin?

{question}

{answer}

Starting with NuoDB release 3.4, we include NuoAdmin as our domain and database administration tier. More information could be found here.

Journal hot copy enables point-in-time restore, allowing restore to a chosen transaction. 

 

Enable journal hot copy

There are two ways to set --journal-hot-copy option via admin layer.
One could enable it for all SM processes by using default database options or per process.

Using default database options

The default database options can be used to configure all SM processes with --journal-hot-copy option.  For example:

$ nuocmd create database --db-name nuodb --dba-user dba --dba-password dba --default-options journal-hot-copy enable --te-server-ids server0
STARTING: StartProcessRequest(archive_id=0, db_name=nuodb, engine_type=SM, labels={}, options={}, server_id=server0)
STARTING: StartProcessRequest(db_name=nuodb, engine_type=TE, labels={}, options={}, server_id=server0)

Verification is done on the SM process level by using:

$ nuocmd get processes --db-name nuodb
Process(address=3b479dfa4e22:48007, archive_id=0, db_name=nuodb, durable_state=MONITORED, engine_state=RUNNING, engine_type=SM, labels={}, last_ack=4.371, node_id=1, options={log-over-conn: enable, verbose: error,flush,warn, user-data: {"incarnation":{"major":1,"minor":0},"startId":"0","labels":{}}, engine-type: SM, region-name: Default, journal-dir: /var/opt/nuodb/production-archives/nuodb-journal, archive-id: 0, database: nuodb, geo-region: 0, initialize: true, commit: safe, journal-hot-copy: enable, archive: /var/opt/nuodb/production-archives/nuodb-archive}, pid=836, region_name=Default, server_id=server0, start_id=0)
Process(address=3b479dfa4e22:48006, db_name=nuodb, durable_state=MONITORED, engine_state=RUNNING, engine_type=TE, labels={}, last_ack=1.221, node_id=2, options={log-over-conn: enable, verbose: error,flush,warn, user-data: {"incarnation":{"major":1,"minor":0},"startId":"1","labels":{}}, region-name: Default, engine-type: TE, database: nuodb, geo-region: 0, commit: safe, journal-hot-copy: enable}, pid=840, region_name=Default, server_id=server0, start_id=1)

Per SM process

If new processes need to be started on an existing database, then the process option flag could be used.  For example:

$ nuocmd start process --db-name nuodb --engine-type SM \
--archive-id 1 --options journal-hot-copy enable --server-id server0
Process(archive_id=1, db_name=nuodb, durable_state=REQUESTED, engine_state=UNKNOWN, engine_type=SM, labels={}, options={log-over-conn: enable, verbose: error,flush,warn, database: nuodb, engine-type: SM, region-name: Default, journal-dir: /var/opt/nuodb/production-archives/nuodb-journal-2, archive-id: 1, geo-region: 0, initialize: true, commit: safe, journal-hot-copy: enable, archive: /var/opt/nuodb/production-archives/nuodb-archive-2}, region_name=Default, server_id=server0, start_id=2)

Verification is done instantly as process options are printed in the command output.

 

Create backup

The above can be tested by creating journal type hot copy backup. The prerequisite is to perform full type backup. For example:

$ nuocmd hotcopy database --db-name nuodb --type full \
--backup-dirs 0 /var/opt/nuodb/backup/nuodb/0/backupset_2019_06_28
HotCopyResponse(coordinator_start_id=0, id=28180495-d250-402d-8a11-1348530a19b5)

As the above command will asynchronously send the command and return control, there is a need to check hotcopy status. This is done via get hotcopy-status command by providing the coordinator_start_id and hotcopy id returned from the previous command:

$ nuocmd get hotcopy-status --coordinator-start-id 0 \
--hotcopy-id 28180495-d250-402d-8a11-1348530a19b5
HotCopyResponse(begin_timestamp=2019-06-28 07:06:18, coordinator_start_id=0, end_timestamp=2019-06-28 07:06:23, id=28180495-d250-402d-8a11-1348530a19b5, message=Hot copy successfully completed, status=completed)

 

After the full backup is performed, the new journal backup could be done.

$ nuocmd hotcopy database --db-name nuodb --type journal \
--backup-dirs 0 /var/opt/nuodb/backup/nuodb/0/backupset_2019_06_28
HotCopyResponse(coordinator_start_id=0, id=689c32ca-e926-4701-93cd-09e037f7e069)

Again the hotcopy status could be checked via:

$ nuocmd get hotcopy-status --coordinator-start-id 0 \
--hotcopy-id 689c32ca-e926-4701-93cd-09e037f7e069
HotCopyResponse(begin_timestamp=2019-06-28 07:10:32, coordinator_start_id=0, end_timestamp=2019-06-28 07:10:34, id=689c32ca-e926-4701-93cd-09e037f7e069, message=Hot copy successfully completed, status=completed)

 

After the journal backup is performed, one could use it to do a point-in-time restore.
For the purpose of this article, let us report the transactions and timestamps found in our journal backup:

$ su -s /bin/sh -c "nuoarchive restore --report-timestamps --format simple /var/opt/nuodb/backup/nuodb/0/backupset_2019_06_28" nuodb
2019-06-28T13:29:24 898
2019-06-28T13:29:34 1026
2019-06-28T13:29:36 1154
2019-06-28T13:29:39 1282
2019-06-28T13:29:42 1410

Note: The backup set is created by SM process running on that host. It's owned by the OS user which the SM process is running with. For NuoDB RPM installations, this is nuodb user. If we are not logged in with backup set owner, then su or sudo commands need to be used to execute operations on the backup set.

 

For more information about journal hotcopy, please refer to Using Journal Hot Copy.
For more information on how to restore from backup, please refer to Archive Restoring.

{answer}

Have more questions? Submit a request

Comments