Still struggling with rsync

Status
Not open for further replies.

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I've tried a few times to sort this, but I just can't understand why this doesn't work so thought I'd ask some experts.

I have 2 HP micro servers running 9.2.1.8, both with 16GB ECC RAM but with a slightly different volumes:

freenas1 (192.168.168.65) has 4x4TB drives with a RAIDZ1 volume and 3 datasets (media, home, backup)
freenas2 (192.168.168.165) has 1x4TB and 3x3TB drives striped with the same 3 datasets

I want rsync to run automatically pushing changes on 1 to 2. I've used the rsync command in the shell to move all the data from 1 to 2 so I know it works, but don't want to be doing it manually.

I've switched the rsync service on 2 and added 192.168.168.65 into the allowed list and created 3 rsync modules with the same names as the datasets pointing to the appropriate dataset.

I've created 3 rsync tasks on 1 using the module names and again pointing to the appropriate dataset.

I'm using the same user on both machines (Adrian) and the permissions of the volumes are both set to Adrian for the user and group.

When I schedule the rsync task it just doesn't start.

Help! I've probably missed something really stupid :confused:
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
How is authentication configured? The first thing that comes to mind is that the rsync task isn't finding the right ssh key, possibly because it's running as the wrong user. Screenshots would help here.

Also, I don't know what the advantage of using the module is, but it isn't required to get rsync running.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I did think about screenshots, but wasn't sure which ones. Here is the module setup on freenas2 (192.168.168.165):

rsync_module.jpg


And the task setup on freenas1 (192.168.168.65):

rsync_task.jpg


From reading the manual, I don't need to worry about authentication for this approach although have tried with the SSH method and not managed to get that working either. I know rsync is working, as I used commands in the shell to move the datasets from freenas1 to freenas2, and could just run these commands every week or so but was hoping for a more automated process :D
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Yeah, I don't have any experience with rsync modules, but if it works on the command line and not in the crontab I would think it's either an authentication issue (though you've said it shouldn't be) or an environment difference.

I guess the only thing that does look weird is that "maximum connections" is set at zero. Unless that just means "unlimited".

I wish I could be more help; I've always had luck with basic rsync and keys.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I've had another go following the manual for setting up SSH transfers and at least that shows something happening in the console and points to some authentication issues:

Oct 26 09:54:00 freenas2 rsync: ssh: connect to host 192.168.168.65 port 22: Connection refused^M
Oct 26 09:54:00 freenas2 rsync: rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
Oct 26 09:54:00 freenas2 rsync: rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]

I tried setting up using the root user but get this error when trying to create the rsync task on the PULL machine:

rsync_error.jpg


And can't complete this command - ssh-keyscan -t rsa 192.168.2.6 >> /root/.ssh/known_hosts - when I'm logged in as Adrian on the PUSH machine, even though I've tried changing the /root/... to /Adrian

It works fine when I use - rsync -avz /mnt/APE_pool/Media/ Adrian@192.168.168.165:/mnt/APE_backup/Media/ - from the shell, although does ask me for a password!

I know I don't fully understand this, but is the 9.2.1 manual still accurate for this?
 
D

dlavigne

Guest
Is the public key for root pasted into the "SSH Public Key" box for the root user account?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Pretty sure I did when I was trying with the root user. When you copy the string across it tells you to remove all the spaces. Does that include the spaces after ssh-rss and before root@freenas1.local?
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Try:

Code:
rsync -avz -e 'ssh -i /mnt/APE_pool/path/to/your/ssh/private/key' /mnt/APE_pool/Media/ Adrian@192.168.168.165:/mnt/APE_backup/Media/


If that works, you can try adding the "-e 'ssh -i /path'" part to the additional parameters section of the rsync configuration.

My guess is that when you try the command on the terminal, you're using a different ssh key than is tried when run by cron.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I'll give this a try at the weekend, thanks!
 
Status
Not open for further replies.
Top