Feature #4313

mon: generic key/value service

Added by Sage Weil about 6 years ago. Updated about 6 years ago.

Target version:
Start date:
Due date:
% Done:


Affected Versions:
Pull request ID:

Associated revisions

Revision a021ce62 (diff)
Added by Joao Eduardo Luis about 6 years ago

mon: ConfigKeyService: stash config keys on the monitor

Building up on the Single-Paxos and our existing k/v store that backs
the monitor, we now introduce a simple service so that the monitors
act as a generic k/v store available to the cluster, in which a user
can stash (and later obtain) configuration keys at his own discretion.

Users can put, get, delete, list and check for values using the
following commands:

- ceph config-key put <key> [<value>]
- ceph config-key put <key> [-i <in-file>]
with 'value' and 'in-file' being optional; if these are not specified,
'put' will act as 'touch' if 'key' does not exist, or will overwrite
the value of 'key' with a zero byte value (i.e., truncates the
contents of the value to zero)
- ceph config-key get <key>
- ceph config-key get <key> -o <out-file>
- ceph config-key delete <key>
- ceph config-key list [-o <out-file]
- ceph config-key exists <key>

Fixes: #4313

Signed-off-by: Joao Eduardo Luis <>


#1 Updated by Joao Eduardo Luis about 6 years ago

  • Category set to Monitor
  • Status changed from New to Need Review
  • Assignee set to Joao Eduardo Luis

Basically, every single piece of code is now being kept on It should be moved to a different file, ideally a class inheriting PaxosService, although it really doesn't need the same guarantees as the other PaxosServices.

The whole approach follows the idea that we should be able to read a value from any monitor in the cluster, but we should only stash values through the leader, so we can leverage Paxos to do the actual dissemination of the stashed key:value.

So we have all the write operations being forwarded to the leader, who will encode them in a transaction and submit them to paxos; once all monitors commit, the leader will then reply to the client. By leveraging Paxos this way, we avoid a whole lot of trouble making these values available to all the monitors in the cluster.

I believe the approach is quite simple, and should work as it is -- thorough testing pending the creating of a simple test to perform operations alongside other tests.

Currently supported operations:

     - ceph store put <key> <value>
     - ceph store put <key> -i <in-file>

     - ceph store get <key>
     - ceph store get <key> -o <out-file>

     - ceph store delete <key>

     - ceph store list

     - ceph store exists <key>

Btw, available @ wip-4313 commit:83ad6a7e8382b75113883f1594d831682fdca503

#2 Updated by Sage Weil about 6 years ago

  • Target version set to v0.61 - Cuttlefish

#3 Updated by Sage Weil about 6 years ago

  • translation missing: en.field_story_points set to 5.00

#4 Updated by Joao Eduardo Luis about 6 years ago

pull request:

Pushing it up for review only.

Needs to be thoroughly tested (which I will do in the morning), but from my meager testing looks like it's working fine.

#5 Updated by Joao Eduardo Luis about 6 years ago

Dozed off in front of the TV and forgot to push the branches.

repushed code can still be found on

new pull request with a script to test the 'config-key' api can be found on (please read pull request notes before merging)

#6 Updated by Sage Weil about 6 years ago

  • Status changed from Need Review to Resolved

Also available in: Atom PDF