Repository is archived
No commit activity in last 3 years
No release in over 3 years
Easy management of Ceph
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 2.13
~> 11.1
~> 3.4
~> 0.39

Runtime

~> 1.9
 Project Readme

Ceph::Ruby

Easy management of Ceph Distributed Storage System (rbd, images, rados objects) using ruby.

Installation

Add this line to your application's Gemfile:

gem 'ceph-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ceph-ruby

Usage

require "ceph-ruby"

# version information
puts CephRuby::Lib::Rados.version_string
puts CephRuby::Lib::Rbd.version_string

# connect to cluster and open a pool
cluster = CephRuby::Cluster.new
pool = cluster.pool("my-pool-xyz")
pool.open

# CephRuby::Cluster.new currently accepts up to three setings.
# conf_file - path to your ceph.conf file (default: /etc/ceph/ceph.conf)
# options hash:
#   :user    - cephx user to authenticate against (default: client.admin)
                 (would look for a keyring file at: '/etc/ceph/<cluster>.<user>.keyring')
#   :cluster - ceph cluster to connect to (default: ceph)

cluster = CephRuby::Cluster.new "/etc/ceph/us-east.conf", {cluster: 'us-east', user: 'client.amazing'}

# simple example for using rados objects
object = pool.rados_object("my-object-xyz")
object.write(0, "This is a Test!")
puts object.size

# simple example for using rbd images
image = pool.rados_block_device("my-image-xyz")
puts image.exists?
image.create(10.gigabytes)
puts image.exists?
puts image.size
image.write(0, "This is a Test!")
pp image.stat
image.close

# clean up
pool.close
cluster.shutdown

Known bugs

  • Many features provided by ceph are not implemented yet. Please contribute!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2012 - 2013 Netskin GmbH. Released unter the MIT license.