neoha

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: Apache-2.0

README

NeoHA Build NeoHA Test NeoHA Coverage Go Reference codecov


NeoHA

NeoHA is a template for MySQL and PostgreSQL High Availability with Etcd, Consul, ZooKeeper, or Kubernetes written in Golang, inspired by zalando/patroni and radondb/xenon.

Authors

Copyright 2022-2026 The NeoHA Authors. See AUTHORS for contributor details.

Licensed under the Apache License, Version 2.0. See LICENSE.

Documentation

Topic Document
Architecture (L1–L5, Coordinator / Driver / Reconciler) docs/architecture.md
MySQL HA failover (3-node semi-sync & MGR: minority / majority loss, sequence diagrams) docs/ha-failover.md
Config schema & validation docs/config-design.md
Deployment (build, 3-node wiring, neohactl, checklists) docs/deployment.md
Operations (inspection, failover drills, production tuning) docs/operations.md
Release notes (v0.1.0–v0.3.0) docs/releases.md
Roadmap & IT notes docs/TODO.md
Integration test harness test/integration/README.md

Unit Tests

make test      # unit tests (~5 min; raft package is the slowest)
make coverage  # unit-test coverage (~8–15 min; raft alone ~5–10 min with -covermode=atomic)

CI runs make test and make coverage-ci on push/PR to main (unit tests only; see .github/workflows/). The Codecov badge reflects the uploaded coverage.out from CI (packages in Makefile PKGS; integration tests excluded).

Integration tests are not run in CI — they require a local MySQL 8.0 build, optional Xtrabackup, and SSH. Run them on a dev machine after significant changes:

make build && make test-integration

Integration Tests

Requires MySQL 8.0 debug build, optional Xtrabackup + SSH for backup tests. See test/integration/README.md.

cp test/integration/it.local.yaml.example test/integration/it.local.yaml
make test-integration

Directories

Path Synopsis
api
v1
cmd
neoha command
neohactl command
internal
coordination
Package coordination defines the L2 cluster coordination abstraction.
Package coordination defines the L2 cluster coordination abstraction.
coordination/clusterconfig
Package clusterconfig defines the JSON document stored in DCS for dynamic failover policy (shared across MySQL and PostgreSQL).
Package clusterconfig defines the JSON document stored in DCS for dynamic failover policy (shared across MySQL and PostgreSQL).
coordination/etcd
Package etcd provides an etcd-backed coordination.Coordinator (Patroni-style leader lease).
Package etcd provides an etcd-backed coordination.Coordinator (Patroni-style leader lease).
coordination/raftadapter
Package raftadapter wraps internal/election/raft as coordination.Coordinator.
Package raftadapter wraps internal/election/raft as coordination.Coordinator.
coordination/wire
Package wire constructs coordination.Coordinator implementations from config.
Package wire constructs coordination.Coordinator implementations from config.
database/driver
Package driver defines the L4 database abstraction for HA orchestration.
Package driver defines the L4 database abstraction for HA orchestration.
ha
Package ha implements the L3 reconcile loop (Patroni-style run_cycle).
Package ha implements the L3 reconcile loop (Patroni-style run_cycle).
test
integration/harness
Package harness orchestrates databases and NeoHA nodes for integration tests.
Package harness orchestrates databases and NeoHA nodes for integration tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL