Trying to run vertica backup through crontab
I have a 3 node cluster. I have configured the backup and when I run it directly it runs fine. But when I use crontab and schedule it, backup doesn't run. Below is the crontab, the output file which is created at the scheduled time but is empty.Please help as I have to set backup in prod environment at a regular interval
$ crontab -l
20 15 * * * nohup vbr.py --task backup --config-file backup_snapshot.ini > backup.out &
ls -ltr
-rw-r--r-- 1 dbadmin verticadba 0 Oct 1 15:20 backup.out
$ cat backup.out
]$
Below is the backup config file:
vbr.py --setup config
Snapshot name (backup_snapshot):
Number of restore points (1):
Specify objects (no default):
Vertica user name (dbadmin):
Save password to avoid runtime prompt? (n) [y/n]: y
Database user password to save in vbr password config file (no default):
Node v_verticadb_node0001
Backup host name (no default): node1
Backup directory (no default): /home/dbadmin/bkp
Node v_verticadb_node0002
Backup host name (no default): node2
Backup directory (no default): /home/dbadmin/bkp2
Node v_verticadb_node0003
Backup host name (no default): node3
Backup directory (no default): /home/dbadmin/bkp3
Config file name (backup_snapshot.ini):
Password file name (no default value) (no default): passwdfile
Change advanced settings? (n) [y/n]: n
Saved vbr configuration to backup_snapshot.ini.
Saved vbr configuration to passwdfile.
i have transfered the passwdfile to the other two nodes in /home/dbadmin location
Comments
I have tryed that myself and is not working as well.
Maybe this might help you.
Why not use a UDP to dynamically create your backup config and run it from inside Vertica ?
Here is how i do it. (This is just for the schema backup).
- is the same principale as running it as a corntab job
1- Create a template backup.ini config file:
- example
Note:
- you got to make sure your got your locaitons and password variable in place.
2 - Create the shell script the you will call as your UDP
- place this file in your
/vertica/catalog/db_name/procedures/schema_backup.sh
- alter the file
3 - Create the procedure
4 - Run the procedure
-let`s says you wanna bkp schema dev, you just run this line of code.
- this will create a new ini file in the /tmp/adi/replace folder following the rules we placed in the schema_backup.sh and will execute the new ini config file.
- you can also populate the dbPassorwd value with a variable coming from a single stored place. so no string password will be needed.
- i like to do it like this becouse i don`t have to write code for every schema(schemas come and go) and also this procedure can be a part of a dinamic query that will execute backup on only the schemas i want.(you will need separate tool for this eg: informtica or even mstr).
-you can do this with tables or even the entire database.
I hope this helps you or anybody reading it.
Actually my issue got fixed when I give the whole location in crontab instead of just vbr.py.
Great.. Why make it easy ?! when we can make it complicated !!! hehehehe