class GlusterCLI::CLI
- GlusterCLI::CLI
- Reference
- Object
Defined in:
glustercli.crhelpers.cr
Constructors
-
.new
Instance of Gluster CLI.
Instance Method Summary
-
#add_peer(hostname : String)
Add new peer to the Cluster
-
#create_volume(name : String, bricks : Array(String), opts : VolumeCreateOptions)
Create a new Gluster Volume
-
#list_peers
List all peers of the Cluster
-
#list_volumes(status = false)
List all Volumes of the Cluster
-
#local_metrics(log_dir = "/var/log/glusterfs")
Collect the Local metrics
-
#peer(hostname : String)
Get the Peer Object
-
#volume(name : String) : Volume
Get the Volume Object
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"
Instance Method Detail
def add_peer(hostname : String)
#
Add new peer to the Cluster
Example:
cli.add_peer("server2.example.com")
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)
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)
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")
def peer(hostname : String)
#
Get the Peer Object
Example:
peer = cli.peer("server1.example.com")
peer.remove
Get the Volume Object
Example:
volume = cli.volume("gvol1")
volume.start