andrewd

package module
v0.0.0-...-6c56b69 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

README

AndrewD

This OpsRobot is a daemon that will help run your swift cluster. Currently it keeps track of unmounted drives in a swift cluster and if they go unmounted for more than 3 days (by default) it will remove the drive from the ring.

It uses the recon api on the swift object server to query the unmounted drives on the cluster so it requires network access to your storage nodes to run.

The unmounted drives will be kept track of using a local sqlite db.

It creates a json report of its progress in a configurable location.

Config file explanation

[DEFAULT]
user = swift

[andrewd]
working_dir = /some/dir/no/default  # where the sqlite db is kept
report_dir = /some/dir/no/default  # where the json report is saved
run_frequency = 3600  # how often (in secs) this runs and produces report
ring_update_frequency = 259200  # how often it will update / rebalance the ring
max_age_sec = 604800  # if a drive has been unmounted / unreachable 
                      # for this long. it will be set to 0 weight
max_weight_change = .005  # on a ring update. this is the max ratio of device 
                          # weight that will be allowed to be removed
ring_builder = /etc/swift/object.builder  # the ring builder. the deployed
                                          # object.ring.gz must be in
                                          # /etc/swift/object.ring.gz
log_facility = LOG_LOCAL0  # logs over udp
do_not_rebalance = false  # if set to true will run set_weight commands 
                          # but will not rebalance the ring

TODO:

  • Create a webserver to show report and then later to be able to make rings changes.
  • Make priority replication calls after the ring change to heal the cluster.

Documentation

Index

Constants

View Source
const ONE_DAY = 86400

Variables

View Source
var Account = ".dispersion"
View Source
var DbName = "birdcatcher.db"
View Source
var ReportName = "unmounted_report.json"

Functions

func PutDispersionObjects

func PutDispersionObjects(hClient client.ProxyClient, container string, policy string) bool

func RunDaemon

func RunDaemon(GetDaemon func(conf.Config, *flag.FlagSet) (Daemon, error), flags *flag.FlagSet)

func ShutdownStdio

func ShutdownStdio()

Types

type BirdCatcher

type BirdCatcher struct {
	// contains filtered or unexported fields
}

func (*BirdCatcher) LogDebug

func (r *BirdCatcher) LogDebug(format string, args ...interface{})

func (*BirdCatcher) LogError

func (r *BirdCatcher) LogError(format string, args ...interface{})

func (*BirdCatcher) LogInfo

func (r *BirdCatcher) LogInfo(format string, args ...interface{})

func (*BirdCatcher) Run

func (bc *BirdCatcher) Run()

func (*BirdCatcher) RunForever

func (bc *BirdCatcher) RunForever()

type Daemon

type Daemon interface {
	Run()
	RunForever()
	LogError(format string, args ...interface{})
}

func GetBirdCatcher

func GetBirdCatcher(serverconf conf.Config, flags *flag.FlagSet) (Daemon, error)

func GetDispersionMonitor

func GetDispersionMonitor(serverconf conf.Config, flags *flag.FlagSet) (Daemon, error)

type DispersionMonitor

type DispersionMonitor struct {
	// contains filtered or unexported fields
}

func (*DispersionMonitor) LogDebug

func (dm *DispersionMonitor) LogDebug(format string, args ...interface{})

func (*DispersionMonitor) LogError

func (dm *DispersionMonitor) LogError(format string, args ...interface{})

func (*DispersionMonitor) LogInfo

func (dm *DispersionMonitor) LogInfo(format string, args ...interface{})

func (*DispersionMonitor) Run

func (dm *DispersionMonitor) Run()

func (*DispersionMonitor) RunForever

func (dm *DispersionMonitor) RunForever()

type LowLevelLogger

type LowLevelLogger interface {
	Err(string) error
	Info(string) error
	Debug(string) error
}

func SetupLogger

func SetupLogger(conf conf.Config, flags *flag.FlagSet, section, prefix string) (LowLevelLogger, error)

SetupLogger pulls configuration information from the config and flags to create a UDP syslog logger. If -d was not specified, it also logs to the console.

type ReconData

type ReconData struct {
	Device  string
	Mounted bool
	// contains filtered or unexported fields
}

type ReportData

type ReportData struct {
	TotalDevices      int
	TotalWeight       float64
	LastSuccessfulRun time.Time
	UnmountedDevices  []ReportDevice
	LastRingZeroes    []ReportDevice
}

type ReportDevice

type ReportDevice struct {
	Ip         string
	Port       int
	Device     string
	Weight     float64
	Mounted    bool
	Reachable  bool
	LastUpdate time.Time
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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