How to view the data stored in levelDB in ceph
This article is about how to view the data stored in levelDB in ceph. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
This program is used to see what values / var/lib/ceph/osd/ceph-1/current/omap are stored in leveldb in ceph and store the query results in the levelDBFile.txt file.
# include # include "leveldb/db.h" # include "leveldb/env.h" # include "leveldb/write_batch.h" # include "leveldb/cache.h" using namespace std;int main () {leveldb::DB* db; leveldb::Options options; options.create_if_missing = true; leveldb::Status status = leveldb::DB::Open (options, "/ var/lib/ceph/osd/ceph-1/current/omap", & db) Assert (status.ok ()); ofstream outfile; outfile.open ("levelDBFile.txt", ios::out); if (! outfile) {cout Valid (); it- > Next () {outfile key () .ToString ()