With the ceph-objectstore-tool utility, you can get or set bytes on an
object.
Before you begin
Before you begin, make sure that you have the following prerequisites in place:
- Root-level access to the Ceph OSD node.
- Stopping the
ceph-osd daemon.
Procedure
- Verify that the appropriate OSD is down.
systemctl status ceph-osd@OSD_ID
For
example,
[root@host01 ~]# systemctl status ceph-osd@1
- Find the object by listing the objects of the OSD or placement group (PG).
- Log in to the OSD container.
cephadm shell --name osd.OSD_ID
For
example,
[root@host01 ~]# cephadm shell --name osd.0
- Create a backup and working copy of the object.
This must be done before
setting bytes on an
object.
ceph-objectstore-tool --data-path PATH_TO_OSD --pgid PG_ID \
OBJECT \
get-bytes > OBJECT_FILE_NAME
For
example,
[ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c \
'{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}' \
get-bytes > zone_info.default.backup
[ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c \
'{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}' \
get-bytes > zone_info.default.working-copy - Edit the working copy object file and modify the object contents.
- Set the bytes of the object.
ceph-objectstore-tool --data-path PATH_TO_OSD --pgid PG_ID \
OBJECT \
set-bytes < OBJECT_FILE_NAME
For
example,
[ceph: root@host01 /]# ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0 --pgid 0.1c \
'{"oid":"zone_info.default","key":"","snapid":-2,"hash":235010478,"max":0,"pool":11,"namespace":""}' \
set-bytes < zone_info.default.working-copy