Skip to content

ctomkow/tto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tto

Build Status

tto [t⋅toe]: 3-2-1 MySQL backup and sync. Three backups, two copies on different storage, one located off-site.

→ An asynchronous client-server app for synchronizing a MySQL database between two systems. In addition, it keeps a ring buffer of X backups on the secondary system.

The main use-case for developing this was to help maintain a hybrid primary / [primary/secondary] application deployment where replication was not possible.

Use Cases

  • Replace cron scheduled database backup shell scripts
  • Don't want to/can't setup MySQL replication
  • Enable a simple primary/secondary infrastructure across two data centers

Build Dependencies

  • "github.com/fsnotify/fsnotify"
  • "github.com/golang/glog"
  • "github.com/robfig/cron"
  • "github.com/takama/daemon"
  • "github.com/go-sql-driver/mysql"
  • "golang.org/x/crypto/ssh"

Runtime Dependencies

  • mysqldump
  • InnoDB tables

Install

The application needs to be installed on the primary and secondary systems. Each will be configured for their respective roles (sender | receiver).

RPM Install/Upgrade

sudo yum install ./tto-<version>.x86_64.rpm

(edit /etc/tto/conf.json)

sudo systemctl enable tto
sudo systemctl start tto

RPM Uninstall

sudo yum remove tto

WARNING: this removes working dir /opt/tto and conf dir /etc/tto as well!

Docker Install

Currently, the docker install doesn't create a sample conf.json at runtime. See the sample conf.json included in the repo.

mkdir /etc/tto
mkdir /opt/tto
cp conf.json /etc/tto/

(edit /etc/tto/conf.json)

docker build --build-arg GID= myGID --build-arg UID= myUID --build-arg NAME= myUsername -t tto .

docker run -v /etc/tto/conf.json:/etc/tto/conf.json -v /opt/tto:/opt/tto tto

Docker Compose

mkdir /etc/tto
mkdir /opt/tto
cp conf.json /etc/tto/

(edit /etc/tto/conf.json)

(edit .env)

docker-compose up -d

Build

Ensure you build on the target system!

mkdir -p build/bin/tto-0.5.2

# CGO is required for looking up an AD user to work
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ./build/bin/tto-0.5.2/tto ./cmd/tto
tar -czf build/package/rpmbuild/SOURCES/tto-0.5.2.tar.gz -C build/bin tto-0.5.2

RPM build

Edit tto.spec versioning to match

rpmbuild -ba build/package/rpmbuild/SPECS/tto.spec --define "_topdir $(pwd)/build/package/rpmbuild"

About

3-2-1 backup and sync

Resources

License

Stars

Watchers

Forks

Packages

No packages published