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 journaling

As a prerequisite, all SM processes should have journal enabled and --journal-dir engine option set.  Journaling could be specified using NuoAdmin when an archive is created.  This is done via nuocmd client. For example:

$ nuocmd create archive --db-name nuodb --archive-path /var/opt/nuodb/production-archives/nuodb-archive --journal-path /var/opt/nuodb/production-archives/nuodb-journal --server-id server0
Archive(archive_path=/var/opt/nuodb/production-archives/nuodb-archive, db_name=nuodb, id=0, journal_path=/var/opt/nuodb/production-archives/nuodb-journal, server_id=server0, state=PROVISIONED)

Note: One could check whether the journal is enabled on the already created archive by using the show archives command.  For example:

$ nuocmd show archives
[0] server0 : /var/opt/nuodb/production-archives/nuodb-archive @ nuodb [journal_path = /var/opt/nuodb/production-archives/nuodb-journal] [snapshot_archive_path = ] PROVISIONED

Enable journal hot copy

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 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 --this-server
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)

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)

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 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

 

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