Skip to content

Yaon-C2H8N2/go-glusterfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-glusterfs

A Go library for deploying and managing GlusterFS clusters. Implemented as a wrapper around the GlusterFS CLI.

Disclaimer

This project is in early stages of development. It's a simple side-project I'm doing on my own to manage my GlusterFS deployed on my homelab with a WebUI. It is not recommended for production use. Any feedback and contributions are more than welcome.

Features

  • Probe GlusterFS nodes
  • Create and delete volumes
  • Start and stop volumes
  • Event listener for volume and peer changes

Example

package main

import (
	"go-glusterfs.yaon.fr/pkg/brick"
	"go-glusterfs.yaon.fr/pkg/peer"
	"go-glusterfs.yaon.fr/pkg/volume"
)

func main() {
	//Probing nodes 2 and 3
	hostnameList := []string{"node2", "node3"}
	for _, hostname := range hostnameList {
		err := peer.PeerProbe(hostname)
		if err != nil {
			panic(err)
		}
	}

	//Creating bricks for each nodes in the pool
	peers, err := peer.ListPeers()
	var bricks []brick.Brick
	if err != nil {
		panic(err)
	}
	for _, p := range peers {
		bricks = append(bricks, brick.Brick{
			Peer: p,
			Path: "/data/brick1",
		})
	}
	
	//Creating a volume with the bricks
	v, err := volume.CreateVolume("test-volume", bricks)
	if err != nil {
        panic(err)
    }
	err = v.Start()
	if err != nil {
        panic(err)
    }
}

About

A fast glusterfs-server CLI wrapper for Go.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published