• This repository has been archived on 10/Mar/2019
  • Stars
    star
    1,343
  • Rank 34,982 (Top 0.7 %)
  • Language
    Go
  • License
    Other
  • Created about 9 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Postgres high-availability cluster with auto-failover and automated cluster recovery.

yoke logo Build Status

Yoke is a Postgres redundancy/auto-failover solution that provides a high-availability PostgreSQL cluster that's simple to manage.

Requirements

Yoke has the following requirements/dependencies to run:

  • A 3-server cluster consisting of a 'primary', 'secondary', and 'monitor' node
  • 'primary' & 'secondary' nodes need ssh connections between each other (w/o passwords)
  • 'primary' & 'secondary' nodes need rsync (or some alternative sync_command) installed
  • 'primary' & 'secondary' nodes should have postgres installed under a postgres user, and in the path. Yoke tries calling 'postgres' and 'pg_ctl'
  • 'primary' & 'secondary' nodes run postgres as a child process so it should not be started independently

Each node in the cluster requires its own config.ini file with the following options (provided values are defaults):

[config]
# the IP which this node will broadcast to other nodes
advertise_ip=
# the port which this node will broadcast to other nodes
advertise_port=4400
# the directory where postgresql was installed
data_dir=/data
# delay before node decides what to do with postgresql instance
decision_timeout=30
# log verbosity (trace, debug, info, warn error, fatal)
log_level=warn
# REQUIRED - the IP:port combination of all nodes that are to be in the cluster (e.g. 'role=m.y.i.p:4400')
primary=
secondary=
monitor=
# SmartOS REQUIRED - either 'primary', 'secondary', or 'monitor' (the cluster needs exactly one of each)
role=
# the postgresql port
pg_port=5432
# the directory where node status information is stored
status_dir=./status
# the command you would like to use to sync the data from this node to the other when this node is master
sync_command=rsync -ae "ssh -o StrictHostKeyChecking=no" --delete {{local_dir}} {{slave_ip}}:{{slave_dir}}

[vip]
# Virtual Ip you would like to use
ip=
# Command to use when adding the vip. This will be called as {{add_command}} {{vip}}
add_command=
# Command to use when removing the vip. This will be called as {{remove_command}} {{vip}}
remove_command=

[role_change]
# When this nodes role changes we will call the command with the new role as its arguement '{{command}} {{(master|slave|single}))'
command=

Startup

Once all configurations are in place, start yoke by running:

./yoke ./primary.ini

Note: The ini file can be named anything and reside anywhere. All Yoke needs is the /path/to/config.ini on startup.

Yoke CLI - yokeadm

Yoke comes with its own CLI, yokeadm, that allows for limited introspection into the cluster.

Building the CLI:

cd ./yokeadm
go build
./yokeadm
Usage:
yokeadm (<COMMAND>:<ACTION> OR <ALIAS>) [GLOBAL FLAG] <POSITIONAL> [SUB FLAGS]
Available Commands:
  • list : Returns status information for all nodes in the cluster
  • demote : Advises a node to demote

Documentation

Complete documentation is available on godoc.

Licence

Mozilla Public License Version 2.0

open source

More Repositories

1

mist

A distributed, tag-based pub-sub service for modern web applications and container-driven cloud.
Go
665
star
2

shaman

Small, lightweight, api-driven dns server.
Go
450
star
3

portal

An api-driven, in-kernel layer 2/3 load balancer.
Go
104
star
4

hoarder

A simple, api-driven storage system for storing code builds and cached libraries for cloud-based deployment services.
Go
100
star
5

redundis

Redis high-availability cluster using Sentinel to transparently proxy connections to the active primary member.
Go
88
star
6

logvac

Simple, lightweight, api-driven log aggregation service with realtime push capabilities and historical persistence.
Go
70
star
7

shon

A simple tool to convert json or yaml into a shell-compliant data structure.
Go
47
star
8

pulse

Dynamic, api-driven stats collector service for realtime stats publishing and historical aggregation with Influxdb.
Go
46
star
9

nanoinit

A small, proper, init process for docker containers.
C
44
star
10

red

A fast, in-kernel, ad-hoc point-to-point vxlan network.
C
34
star
11

flip

Simple, lightweight, virtual IP management utility for moving IPs around nodes in response to cluster events.
Lua
22
star
12

redd

The red management plane daemon.
C
20
star
13

narc

Small utility to watch log files and ship to syslog service.
C
18
star
14

hookit

A devops configuration management tool that responds to events, with a chef-like dsl.
Ruby
14
star
15

shuttle

Lightweight, transparent, api-driven tcp proxy service.
10
star
16

sherpa

DEPRECATED - An api-driven approach to building machine images with Packer.
Go
8
star
17

nanopack.github.io

HTML for the Nanopack site
HTML
4
star
18

nanopack

Hub for nanopack resources and content
3
star
19

siphon

A simple output stream formatter
C
3
star
20

mist-client-js

Javascript client for interacting with the mist service
JavaScript
2
star