class

GlusterCLI::CLI

Inherits Reference / Object

Constructors

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"
Source

Instance methods

add_peer(hostname : String)

Add new peer to the Cluster

Example:

cli.add_peer("server2.example.com")
Source
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)
Source
list_peers

List all peers of the Cluster

Example:

puts cli.list_peers
Source
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)
Source
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")
Source
peer(hostname : String)

Get the Peer Object

Example:

peer = cli.peer("server1.example.com")
peer.remove
Source
volume(name : String) : Volume

Get the Volume Object

Example:

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