Search code examples
ceph

How listing objects in ceph works


I know that object locations in ceph are computed from the cluster map using the hash of the object. On the other hand, we have commands like this that list objects:

rados -p POOL_NAME ls

How does this command work? Are object names stored somewhere? If yes, is it all in the monitor database? What will happen in ceph when we run this command?


Solution

  • Monitors keeps pool -> PG map in their database and when you run rados -p POOL_NAME ls it will ask monitor to get PGs associated with this pool. Each PG has an up/acting set that keeps the running OSDs for that PG. After that it will ask PG on the primary OSD to return objects within it. You can find more info within source code: https://github.com/ceph/ceph/blob/master/src/tools/rados/rados.cc#L2399