Day 74: Jenkins Database Backup Job - database server has no service

I am unable to complete this task for doing ssh into database server

Are you sure the task asks to copy the database to Database server (stdb01) and not to Storage Server (ststor01)?

@Santosh_KodeKloud

even though successfully done db dump and build triggered success, this error ocuured and not able to finish the task. why?


Please take a look at this solution for the lab. The task has changed a bit – we have you use the Storage server (ststor01) rather than the Backup Server (stbkp01), but otherwise, the technique used in the solution should work for you. Key changes:

  • Use “ssh-copy-id” for natasha@ststor01 and tony@stapp01 so you can use ssh in the script.
  • The script now looks like this:
mkdir -p /tmp/db-backup
ssh tony@stapp01 "mysqldump -u kodekloud_roy -p'asdfgdsd' kodekloud_db01" > /tmp/db-backup/db_$(date +%F).sql

ls -la

scp -o StrictHostKeyChecking=no /tmp/db-backup/*.sql natasha@ststor01:/home/natasha/db_backups

rm -rf /tmp/db-backup

This needs to be done since you can’t install anything with apt on the jenkins server, since jenkins@jenkins is not in sudoers.