ZREP Replication and Failover Script

Status
Not open for further replies.

bollar

Patron
Joined
Oct 28, 2012
Messages
411
I found this interesting script designed to do every minute replications between two zfs systems. It also has failover capability. I haven't tried it and I don't even know yet if it would work with FreeNAS, but it seems like an elegant solution for Solaris systems.

ZREP replication and failover

EDIT: Well, since it uses ksh, my guess is it will not work.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Can probably be made to work, but someone has to want to do it.

Linux folks always wonder why I'm critical of their "sh" scripting prowess when they use unnecessary bash-isms.
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
It seems neat, but I wonder if it's really fixing a problem or improving on the FreeNAS GUI replication.
 

pbrown

Cadet
Joined
Nov 26, 2012
Messages
7
Hullo,
I'm the author of zrep. I've been poking around the web, curious about what people are doing with zrep, and came across this thread :)
Some questions/comments reguarding zrep and freenas:

First of all, I've had reports of some folks using zrep with freebsd. freenas is freebsd. So, why is it being written in ksh, a problem?

Secondly, on the "improving on FreeNAS GUI replication" issue....I'm not sure what exact functionality bollar is referring to. That is to say, I'm not sure why the term "GUI" is inserted here :)
If he is referring to what is described at: http://masterofnull.com/tag/freenas-replication/
or perhaps http://doc.freenas.org/index.php/Replication_Tasks

then okay... there is a fair amount of functional overlap.

The freeNAS replication offers the following advantages:
- It has a pretty gui

zrep offers the following advantages:
- portable to other than freeNAS systems
- bidirectional by design. That is, on day 1, you can have (box1) as master. day 2, you can switch to have (box2) as master. day 3, you can switch back. with one easy command, and no re-init, presuming data is intact.
Judging by the GUI walkthrough, it seems like freenas replication is one-way only, permenantly, on a per-filesystem basis.

- I dont know how paranoid the freenas replication checks are, but zrep has super-paranoid safety checks, so that you can schedule the thing to run every minute if you like, and if there is overlap, the later ones will just shut themselves down
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
Thanks for coming to the FreeNAS forum!

I think ZREP is interesting and I do like your bidirectional design, which is why I mentioned it to the FreeNAS community. I think the key issue is that FreeNAS runs a subset of FreeBSD and doesn't include ksh in the distribution. I'm somewhat new to FreeBSD myself, so I haven't explored exactly what it would take to make your script run on FreeNAS
 

pbrown

Cadet
Joined
Nov 26, 2012
Messages
7
the ksh-y features I used in zrep, are for performance reasons. going from memory, they are:

[[]]
(())
print
typeset
and technically, I believe these are "posix shell V(mumble)" features, so if freenas includes a reasonably recent sh, I think it would probably run via /bin/sh
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Just though I'd throw out this info for you pbrown since you aren't a FreeNAS user...

You should be able to create a FreeNAS VM with only 3GB of hard drive and 3GB of RAM(2GB of RAM would probably work too).

Note that I'm not trying to throw this problem on you, but I know you likely haven't read the manual, scoured the FAQ and my guide so you're a little out of your safety zone. I just thought I'd share this if you want to take a look.
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
Okay, I'm building a backup machine tomorrow night, so maybe I'll have a chance to experiment.
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
I had some time to give it a try with sh and csh, but it looks like the script modifications will be extensive.

I guess I could install ksh, but that's also not straightforward.
 

pbrown

Cadet
Joined
Nov 26, 2012
Messages
7
How is installing ksh not straightforward? Last I checked, its a fairly self-contained thing, all you have to do is drop a single file into /bin/ksh, worst case? :-}
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
Yeah. FreeNAS runs in a small read-only USB partition, so there are some considerations that I need to look at to make sure I don't blow that up - probably the available space on the partition will be the key problem.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Holy smokes. That's a pretty limiting license.
 

pbrown

Cadet
Joined
Nov 26, 2012
Messages
7
What's so limiting about it?
You can use it freely. You can modify it as needed. You can make backup copies, and internal copies all you like.
Thats all 99% of people on here really need, and you can do that without any further hassle.
For anything else, you just have to talk to me about it.

"BUT ITS NOT OSI OMGFBBQ@#$@#$!!!"
Do you want to promote religious views, or do you just want to get stuff done, for free? :tongue:
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I totally agree with you pbrown. Free is free. But there are alot of people that use open source because of their personal convictions of the license.
 

bollar

Patron
Joined
Oct 28, 2012
Messages
411
I did get around to attempting a ksh install. Unfortunately I couldn't find a port to 8.3, but I did try 9-stable. It installed, but won't run due to a missing library:

Code:
/libexec/ld-elf.so.1: Shared object "libutil.so.9" not found, required by "ksh93"


I will hunt again for an 8.3 port...
 

Cody

Dabbler
Joined
Jun 23, 2013
Messages
12
This looks interesting. Has anyone been able to use Zrep successfully with FreeNAS yet?
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
I know this is an old thread, but I've been playing around with it today and it looks pretty helpful. Since FN only support 1 replication target per dataset, this allows me to have multiples.

I had to change the first line in the script to be:
Code:
#!/usr/local/bin/ksh93 -p


I'm running the first sync now.

The github repo has more detail on the inner workings. https://github.com/bolthole/zrep
 
Status
Not open for further replies.
Top