Octivi releases the first PHP client for Ceph

4157426778_ec104a85ca_b

We’ve just released a PHP client for Ceph REST API. Ceph is a distributed and fault-tolerant filesystem used to easily scale-out the storage layer. Our CephClient is freely available on GitHub.

What is a Ceph?

It uniquely delivers object, block, and file storage in one unified system. Ceph is highly reliable, easy to manage, and free. The power of Ceph can transform your IT infrastructure and your ability to manage vast amounts of data. Ceph delivers extraordinary scalability–thousands of clients accessing petabytes to exabytes of data.

Ceph REST API possibilities

The commands which let you to easily maintain the cluster, are provided through an REST API.

Ceph’s REST API is a Web Server Gateway Interface application that provides much of the functionality of the ceph command-line tool through an HTTP-accessible interface. Octivi’s php-cephclient is a PHP library to communicate with Ceph’s REST API.

Using the API it’s possible to control all aspects of the Ceph cluster, including some common administrative tasks like:

  • Root operations – check the status and health of the cluster,
  • Cluster monitors (MON) – receive information of the MON statuses, remove monitors
  • Metadata servers (MDS) – get the statistics from the Metadata Servers, stop, remove servers,
  • Object storage devices (OSD) – get the tree of the OSDs structure, control their status

CephClient is the first PHP library to communicate with Ceph REST API so far.

Documentation for the API itself isn’t officially available but there’s one created by @dmsimard – Documentation for ceph-rest-api. It’s based on the one which is built into the application.

Octivi – CephClient

Our Client gives access to the Ceph’s command in an object-oriented way.

The sample call for the health of the cluster is as easy as:

<?php

use Octivi\CephClient\Client\CephClient;

// Initialization of the Client's object
$cephClient = new CephClient('http://10.20.51.201:5000/api/v0.1/');
$cephClient->useAuth('some', 'password');

// Getting the health of the cluster
$response = $cephClient->getRoot()->health();

The full list of the implemented commands is available at the calls groups documentation.

The core, CephClient class and CommandWrappers classes, takes care of the OOP abstraction layer. They provide helper functions to communicate with the API through fluent interface.

CephClient has an only one required setting – an URL to the cluster. It’s also possible to use Ceph’s authentication providing an username and password in the useAuth method.

The client also allows you to enter to a very handy, debug mode by setting debug parameter to true. CephClient will return pure JSON responses in that case.

Another feature is the possibility of getting the informations of the last API call. It let’s you to get the time of the request, transfered bytes and other debugging-related statistics.

Contribution

Take a closer look at our work! Fell free to comment, share your opinion and ideas at the Github’s Issues. We would be glad of every contribution attempts through the pull requests.

Photo by John McStravick


We at Octivi provide Software Development truly ready for Cloud

Looking to scale-out your
web application?

Hire Octivi!

Web developer