HACKING History LICENSE NEWS README TODO
MogileFS Admin Backend Client MogileFS NewFile NewFile::Writer ReadOnlyError

Methods

#change_device_state #change_device_weight #clean #clear_cache #create_class #create_device #create_domain #create_host #delete_class #delete_domain #delete_host #each_fid #get_devices #get_domains #get_hosts #get_stats #list_fids #modify_class #modify_host #replicate_now #update_class #update_host

class MogileFS::Admin

MogileFS administration client, this has little real-world usage and is considered a work-in-progress

Public Instance Methods

change_device_state (host, device, state) source

Changes the device status of device on host to state which can be 'alive', 'down', or 'dead'.

change_device_weight (host, device, weight) source

Changes the device weight of device on host to weight. weight should be a non-negative Integer. Devices with higher weight values are more likely to be chosen for reads and writes.

clear_cache () source

Clears the tracker caches. Not implemented in all versions of MogileFS

create_class (domain, klass, policy) source

Creates a new class in domain named klass with policy for replication. Raises on failure.

create_device (host, devid, opts = {}) source

Creates device with Integer devid on host host may be an integer for hostid or String for hostname

create_domain (domain) source

Creates a new domain named domain. Returns nil if creation failed.

create_host (host, args = {}) source

Creates a new host named host. args must contain :ip and :port. Returns true if successful, false if not.

delete_class (domain, klass) source

Removes class klass from domain. Returns true if successful. Raises on failure

delete_domain (domain) source

Deletes domain. Returns true if successful, raises MogileFS::Backend::DomainNotFoundError if not

delete_host (host) source

Deletes host host. Returns nil on failure.

each_fid () { |fid| ... } source

Enumerates fids using list_fids. Returns the number of valid fids processed

get_devices (devid = nil) source

Returns an Array of device status Hashes. If devid is given only that device is returned.

admin.get_devices 1

Returns:

[{"status"=>"alive",
  "mb_asof"=>nil,
  "mb_free"=>666000,
  "devid"=>1,
  "hostid"=>1,
  "mb_used"=>666,
  "utilization"=>0.0,
  "reject_bad_md5"=>false,
  "observed_state"=>"writeable",
  "mb_total"=>666666}]
get_domains () source

Returns the domains and classes, and their policies present in the mogilefs.

admin.get_domains

Returns (on newer MogileFS servers):

{
  "test" => {
    "default" => {
      "mindevcount" => 2,
      "replpolicy" => "MultipleHosts()",
      "hashtype => nil,
    }
  }
}

Returns (on older MogileFS servers without replication policies):

{"test"=>{"normal"=>3, "default"=>2}}
get_hosts (hostid = nil) source

Returns an Array of host status Hashes. If hostid is given only that host is returned.

admin.get_hosts 1

Returns:

[{"status"=>"alive",
  "http_get_port"=>nil,
  "http_port"=>7500,
  "hostid"=>1,
  "hostip"=>"192.168.1.2",
  "hostname"=>"rur-1",
  "altip"=>"",
  "altmask"=>""}]
get_stats (type = 'all') source

Returns a statistics structure representing the state of mogilefs.

*** This command no longer works with recent versions of MogileFS *** *** Use mogstats(1) from the MogileFS::Utils package on CPAN *** *** We will remove this method in 4.x ***

admin.get_stats

Returns:

{"fids"=>{"max"=>"99", "count"=>"2"},
 "device"=>
  [{"status"=>"alive", "files"=>"2", "id"=>"1", "host"=>"rur-1"},
   {"status"=>"alive", "files"=>"2", "id"=>"2", "host"=>"rur-2"}],
 "replication"=>
  [{"files"=>"2", "class"=>"normal", "devcount"=>"2", "domain"=>"test"}],
 "file"=>[{"files"=>"2", "class"=>"normal", "domain"=>"test"}]}
list_fids (from_fid, count = 100) source

Returns an Array of fid Hashes from from_fid, limited to count

admin.list_fids 0, 100

Returns:

[{"fid"=>99,
  "class"=>"normal",
  "domain"=>"test",
  "devcount"=>2,
  "length"=>4,
  "key"=>"file_key"},
 {"fid"=>82,
  "class"=>"normal",
  "devcount"=>2,
  "domain"=>"test",
  "length"=>9,
  "key"=>"new_new_key"}]
replicate_now () source

reschedules all deferred replication, returns a hash with the number of files rescheduled:

admin.replicate_now => { "count" => 5 }
update_class (domain, klass, policy) source

Updates class klass in domain with policy for replication. Raises on failure.

update_host (host, args = {}) source

Updates host with args. Returns true if successful, false if not.

Protected Instance Methods

clean (count, prefix, res, underscore = true, to_i = [], want = nil) source

Turns the response res from the backend into an Array of Hashes from 1 to res. If underscore is true then a '_' character is assumed between the prefix and the hash key value.

res = {"host1_remoteroot"=>"/mnt/mogilefs/rur-1",
       "host1_hostname"=>"rur-1",
       "host1_hostid"=>"1",
       "host1_http_get_port"=>"",
       "host1_altip"=>"",
       "hosts"=>"1",
       "host1_hostip"=>"",
       "host1_http_port"=>"",
       "host1_status"=>"alive",
       "host1_altmask"=>""}
admin.clean 'hosts', 'host', res

Returns:

[{"status"=>"alive",
  "http_get_port"=>nil,
  "http_port"=>7600,
  "hostid"=>1,
  "hostip"=>"192.168.1.3",
  "hostname"=>"rur-1",
  "altip"=>"",
  "altmask"=>""}]
modify_class (domain, klass, policy, action) source

Modifies klass on domain to store files on mindevcount devices via action. Returns the class name if successful, raises if not

modify_host (host, args = {}, action = 'create') source

Modifies host using args via action. Returns true if successful, false if not.

Parent: MogileFS::Client
Pages Classes Methods


mail archives: https://yhbt.net/mogilefs-client-public/
	http://ou63pmih66umazou.onion/mogilefs-client-public/ 
	nntp://news.public-inbox.org/inbox.comp.file-systems.mogilefs.ruby 
	nntp://ou63pmih66umazou.onion/inbox.comp.file-systems.mogilefs.ruby 
public: mogilefs-client-public@yhbt.net
source code: git clone https://yhbt.net/mogilefs-client.git
	torsocks git clone http://ou63pmih66umazou.onion/mogilefs-client.git