class GlusterCLI::CLI

Defined in:

glustercli.cr
helpers.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

Instance of Gluster CLI.

Example:

require "glustercli"

cli = GlusterCLI::CLI.new
puts cli.list_peers

Set current_hostname if it is different from the hostname. Gluster pool list command shows "localhost" for the node where the command is run. current_hostname will replace the references of the localhost.

Example:

cli = GlusterCLI::CLI.new
cli.current_hostname = "server1.example.com"

Set gluster_executable option if Gluster is installed in non-standard location.

Example:

cli = GlusterCLI::CLI.new
cli.gluster_executable = "/usr/local/sbin/gluster"

[View source]

Instance Method Detail

def add_peer(hostname : String) #

Add new peer to the Cluster

Example:

cli.add_peer("server2.example.com")

[View source]
def create_volume(name : String, bricks : Array(String), opts : VolumeCreateOptions) #

Create a new Gluster Volume

Example:

opts = VolumeCreateOptions.new
opts.replica_count = 3

bricks = [
  "server1.example.com:/bricks/gvol1/brick1/brick",
  "server2.example.com:/bricks/gvol1/brick2/brick",
  "server3.example.com:/bricks/gvol1/brick3/brick",
]
cli.create_volume("gvol1", bricks, opts)

[View source]
def list_peers #

List all peers of the Cluster

Example:

puts cli.list_peers

[View source]
def list_volumes(status = false) #

List all Volumes of the Cluster

Example:

puts cli.list_volumes

# List all Volumes with realtime status
puts cli.list_volumes(status: true)

[View source]
def local_metrics(log_dir = "/var/log/glusterfs") #

Collect the Local metrics

Example:

cli = GlusterCLI::CLI.new
cli.local_metrics
cli.local_metrics(log_dir: "/var/log/glusterfs")

[View source]
def peer(hostname : String) #

Get the Peer Object

Example:

peer = cli.peer("server1.example.com")
peer.remove

[View source]
def volume(name : String) : Volume #

Get the Volume Object

Example:

volume = cli.volume("gvol1")
volume.start

[View source]