[OpenIndiana-discuss] Problems with netcat zfs receive
Jonathan Adams
t12nslookup at gmail.com
Tue Sep 11 08:40:22 UTC 2012
I know how "we all hate perl" (tm) and this doesn't fix your problem
directly ...
I got fed up of our backup system (USB ZFS, if more than one receive
happened on the pool the USB drives would go offline and take out the
base ZFS pool ... Solaris 10)
The guy who used to do it used cron, and because the files changed
size he couldn't guarantee when they would finish ... he went on
holiday for 2 weeks and after 3 days of the servers crashing I rewrote
his whole system using the attached scripts.
the data gets rsynced from the servers into a folder on the receiver
in /snapshots/fromserver/tempstore with a filename related to the
zfs-slice that the snapshot is from and to, and the date at the end.
e.g. /snapshots/fromserver/tempstore/zfsreports11Sep2012
we run "universal-restore.pl" on the receiving server (generally
nohup'd) it loops around (every 30 minutes) and when it sees the file
appear it restores it.
rsync transfers the files as hidden with an odd extension and renames
them when the sync is complete, which works well in this case because
it doesn't try to restore a file until it is sync'ed.
when the file is restored it then moves the zfs snapshots to an
archive directory that includes the Month and Year:
e.g. /snapshots/fromserver/archive/Sep2012/zfsreports11Sep2012
probably not what you want, but might work for you.
Jon
On 10 September 2012 20:55, Florian <florian at acw.at> wrote:
> Hello,
>
> I want to switch from zfs send and receive with ssh todo it with netcat.
>
> The send and receive process works without problems, but netcat won't work.
>
> Server A is oi151a6-1
> Server B is oi151a5-2
>
> I use netcat with these commands:
> Server A:
> /root at oi151a6-1:~# zfs list -t snapshot
> NAME USED AVAIL REFER MOUNTPOINT
> ...
> tank/raid1-2 at replication_09-09-12-19:40:00 0 - 16K -
> tank/raid1-2 at nc_test05 0 - 16K -/
>
> Snapshot /tank/raid1-2 at replication_09-09-12-19:40:00/ exists already on
> Server B (received over ssh)
>
> /root at oi151a6-1:~# ssh -n -f 192.168.10.201 "/usr/bin/nc -l -p 1337 |
> /usr/sbin/zfs receive -F tank/raid1-2"/
>
> With the previous command, I can see the netcat process on Server B:
> /root at oi151a5-2:~# ps auxww | grep nc
> root 838 0.0 0.1 2052 1380 pts/1 S 21:14:42 0:00 grep nc
> root 805 0.0 0.2 3664 2384 ? S 21:14:14 0:00 bash -c /usr/bin/nc -l -p 1337
> | /usr/sbin/zfs receive -F tank/raid1-2
> root 806 0.0 0.1 2124 1144 ? S 21:14:14 0:00 /usr/bin/nc -l -p 1337/
>
> On Server A:
> /root at oi151a6-1:~# zfs send -I tank/raid1-2 at replication_09-09-12-19:40:00
> tank/raid1-2 at nc_test05 | nc 192.168.10.201 1337/
>
> This exits with the following error:
> cannot receive: failed to read from stream
>
> This is only a testing server, so I enabled the user root and enabled root
> login for sshd.
>
> Can someone please help me with my problem? I never used netcat, so I am a
> real beginner.
>
> The funny thing is, when I issue the commands on the local servers, it works
> without problems!
> Server B:
> /root at oi151a5-2:~# ///usr/bin/nc -l -p 1337 | /usr/sbin/zfs receive -F
> tank/raid1-2
>
> Server A:
> //root at oi151a6-1:~# //zfs send -I tank/raid1-2 at replication_09-09-12-19:40:00
> tank/raid1-2 at nc_test05 | nc 192.168.10.201 1337
>
> /Result on Server B:
> /root at oi151a5-2:~# zfs list -t snapshot
> NAME USED AVAIL REFER MOUNTPOINT
> ...
> tank/raid1-2 at replication_09-09-12-19:40:00 0 - 16K -
> tank/raid1-2 at nc_test05 0 - 16K -/
>
>
> Best regards
> Florian
>
> _______________________________________________
> OpenIndiana-discuss mailing list
> OpenIndiana-discuss at openindiana.org
> http://openindiana.org/mailman/listinfo/openindiana-discuss
More information about the OpenIndiana-discuss
mailing list