Ceph comes with powerful REST API interface access, which allows you to administer your cluster programmatically. It can run as a WSGI application or as a standalone server, listening on the default port 5000
. It provides a similar kind of functionality to that of the Ceph command-line tool through an HTTP-accessible interface. Commands are submitted as HTTP GET and PUT requests, and the results can be returned in the JSON, XML, and text formats. In this recipe, I will quickly show you how to set up the Ceph REST API and interact with it.
Let's configure and use the Ceph REST API to check some cluster states:
- Create a user,
client.restapi
, on the Ceph cluster with appropriate access tomon
,osd
, andmds
:
# ceph auth get-or-create client.restapi mds 'allow *' osd 'allow *' mon 'allow *' > /etc/ceph/ceph.client.restapi.keyring
- Add the following section to the
ceph.conf
file:
[client.restapi] log file = /var/log/ceph/ceph.restapi...