Skip to content

Utility nz_cp_backup to upload/download backup to and from cloud to NPS#6

Open
nmahalle52 wants to merge 8 commits into
masterfrom
nmahalle_nzconnector
Open

Utility nz_cp_backup to upload/download backup to and from cloud to NPS#6
nmahalle52 wants to merge 8 commits into
masterfrom
nmahalle_nzconnector

Conversation

@nmahalle52
Copy link
Copy Markdown
Contributor

@nmahalle52 nmahalle52 commented Mar 10, 2021

Problem: Currently we had nz_azconnector to upload and download backup from and to azure cloud. Needed the single utility to upload /download backup to azure as well as s3 cloud based on respective connector type.

Solution: Created utility which can be use to upload/download backup to cloud (/azure/S3) respectively based on connector type .

Testing: Tested below scenario:
TESTING S3:
1] Upload on prem backup to S3 cloud and Restore using S3 Connector:
2] Take multi dir backup, upload to S3 , S3 cloud restore:
3] Take backup on S3 of NPS and Download Backup to NPS host and restore on NPS:
4] Take PDA backup , upload to cloud , cloud restore to nps:
5] PDA cloud backup to S3, download to nps, and restore:
6] Tested Granularity with -increment

Testing Azure:
1] Upload on prem backup to Azure cloud and Restore using Azure Connector:
2] Take multi dir backup, upload to Azure , Azure cloud restore:
3] Take backup on Azure of NPS and Download Backup to NPS host and restore on NPS:
4] Take PDA backup , upload to cloud , cloud restore to nps
5] Tested Granularity with -increment

Sample Command :
Upload:
./main -db=MYDB1 -dir=/tmp/mydb1_backup -npshost=sim-ips21.fyre.ibm.com -increment 1 -backupset 20210311142047 -connector=az -connectorArgs="STORAGE_ACCOUNT:####;KEY:####;CONTAINER:quickstart;STREAMS:16;BLOCKSIZE:100" -logfiledir=. -upload -uniqueid=test50 -paralleljobs=10

Download:
./main -db=MYDB1 -dir=/tmp/mydb1_backupAZDownload -npshost=sim-ips21.fyre.ibm.com -increment 1 -backupset 20210311142047 -connector=az -connectorArgs="STORAGE_ACCOUNT:####;KEY:####;CONTAINER:quickstart;STREAMS:16;BLOCKSIZE:100" -logfiledir=. -download -uniqueid=test50 -paralleljobs=20

nzsyncbackup_Unit_Test.txt

@abhishekjog
Copy link
Copy Markdown
Member

@nmahalle52 add sample commands in PR description

@brajeshkpandey
Copy link
Copy Markdown

Does it copy everything? or there is a granularity ?

@abhishekjog
Copy link
Copy Markdown
Member

Comment from @aniket-s-kulkarni : change the name to nzsyncbackup

Comment thread bnr-utils/nzsyncbackup/main.go Outdated
Comment on lines +23 to +32
var backupinfo Connector.BackupInfo
var connectorInfo Connector.ConnectorInfo
var otherargs Connector.OtherArgs
var err error
// parse input args
Connector.ParseArgs(&backupinfo, &connectorInfo, &otherargs)
flag.Parse()
Connector.SetUpLogFile(&backupinfo, &connectorInfo, &otherargs)
connector := Factory.GetConnector(connectorInfo.Connector)
parseConnectorArgs(connector, connectorInfo.ConnectorArgs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets use Cobra for parsing here.

Lets make this

nzsyncbackup [upload|download|list] [aws-s3|azure-blob|ibm-cos]

# where connector args would be
# for aws s3 
nzsyncbackup upload aws-s3 -h

Options
-------

-access-key <ACCESS-KEY>      The access key for the object store [AWS_ACCESS_KEY_ID] (required)
-bucket-name <BUCKET-NAME>    The name of the bucket to store backups to (required)
-region <REGION>              The region of the object store bucket (required)
-secret-key <SECRET-KEY>      The secret key for the object store [AWS_SECRET_ACCESS_KEY] (required)
--unique-id <id>

# .. similar options for ibm-cos
# for azure 

nzsyncbackup upload azure-blob -h

Options
-------

-account-key <ACCOUNT-KEY>      The Azure Blob account key (required)
-account-name <ACCOUNT-NAME>    The Azure Blob account name (required)
-blob-type <BLOB-TYPE>          The type of Azure Blob container. One of [block,page]
-bucket-name <BUCKET-NAME>      The name of the bucket to store backups to (required)
-container <CONTAINER>          The Azure Blob container name (required)

ditto for download and list

@nmahalle52
Copy link
Copy Markdown
Contributor Author

@Brajesh1984 : Utility has granularity , we can give increment number to upload or download particular increment .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants