Additional Yugabyte staging prerequisites for ingestion using backups
The backup can exist on the staging server or can be accessed over NFS.
For performing a backup operation via yb_backup.py
script, you can execute the following command:
python3 yb_backup.py --masters 10.23.1.2:7100 --remote_yb_admin_binary /home/yugabyte/yugabyte-2.20.1.3/bin/yb-admin --remote_ysql_dump_binary /home/yugabyte/yugabyte-2.20.1.3/postgres/bin/ysql_dump --remote_ysql_shell_binary /home/yugabyte/yugabyte-2.20.1.3/postgres/bin/ysqlsh --ssh_user yugabyte --ssh_port 22 --ssh_key_path /home/yugabyte/.ssh/id_rsa --storage_type nfs --nfs_storage_path /home/yugabyte/database --backup_location /home/yugabyte/backup --no_auto_name --keyspace ysql.yb_demo create
Script arguments:
masters: comma (“,”) separated list of <ip>:<port> for master servers of the production database
remote_yb_admin_binary: yb_admin binary path on the master server
remote_ysql_dump_binary: ysql_dump binary path on the master server
remote_ysql_shell_binary: ysqlsh binary path on the master server
ssh_user: OS user used to ssh into a remote host
ssh_port: ssh port enabled on the remote host
ssh_key_path: ssh keypair with a path on the remote host
storage_type: use
nfs
to take backup on NFS locationnfs_storage_path: NFS storage mount path
backup_location: Location where backup is to be taken
no_auto_name: Disable the automatic generation of a name under the given backup location.
keyspace: Repeatable keyspace of the tables to backup or a target keyspace for the backup restoring.
This command reaches the production master server at 10.23.1.2:7100
and takes backup at location /home/yugabyte/backup
. The database backed up is yb_demo
.
Alternative Method: Backup Using Yugabyte Anywhere (YBA) API
You can also take a backup using the Yugabyte Anywhere (YBA) API.
Below is a sample API and payload:
API:
https://{platform_address}/api/v1/customers/{customer_uuid}/backups
Payload:
{ "backupCategory": "YB_BACKUP_SCRIPT", "backupType": "PGSQL_TABLE_TYPE", "storageConfigUUID": "storageConfigUUID", "universeUUID": "universeUUID" }
Parameters:
platform_address: The hostname/IP address of Yugabyte Anywhere.
customer_uuid: The customer UUID specified in YBA.
storageConfigUUID: The UUID of the storage configuration.
universeUUID: The UUID of the universe.
Note: Both methods can be used to take backups, depending on your environment's specific requirements and setup. For more information, refer to the Yugabyte API documentation.