Giter Site home page Giter Site logo

zsync's Introduction

ZFS syncing daemon

Introduction

The zsync daemon auto-snapshots ZFS datasets, replicates datasets, and auto-deletes stale snapshots. The replication can be performed across machines in either a push or pull mechanism using either SSH or local OS subprocesses.

This only tested with ZFS on Linux.

Usage

Delegate ZFS permissions

In order for the daemon to properly perform ZFS operations, the zfs allow feature must be used to enable permissions on certain operations.

The following permissions should be granted:

# On all sources:
sudo zfs allow $USER send,snapshot,destroy,mount $DATASET

# On all mirrors:
sudo zfs allow $USER receive,create,mount,mountpoint,readonly,snapshot,destroy,mount $DATASET

The mountpoint and readonly properties are only need when performing the first replication, where the receiving side sets mountpoint=none and readonly=on.

The zpool and zfs tool must work without sudo. See the "Changes in Behavior" section of the ZoL v0.7.0 release.

Build the daemon

go get -u github.com/dsnet/zsync

The instruction steps below assume $GOPATH/bin is in your $PATH, so that the zsync binary can be executed directly from the shell.

Create configuration file

The operation of zsync is configured using a JSON configuration file, where the full list of features can be listed by running zsync -help.

Here is an example configuration file (adjust as appropriate):

{
	"SSH": {
		"KeyFiles":       ["/home/user/.ssh/id_rsa"],
		"KnownHostFiles": ["/home/user/.ssh/known_hosts"],
	},

	"AutoSnapshot": {"Cron": "@daily", "Count": 7},
	"Datasets": [{
		"Source":  "//localhost/tank/dataset",
		"Mirrors": ["//user@remotehost:22/tank/dataset-mirror"],
	}],
}

This example auto-snapshots daily and only keeps 7 snapshots. It replicates tank/dataset on the local machine to tank/dataset-mirror on a remote machine using an SSH push.

Running the daemon

Start the daemon with:

zsync /path/to/config.json

zsync's People

Contributors

dsnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vtaneza

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.