Use the ceph-objectstore-tool utility to change object
attributes.
Before you begin
Before you begin, make sure that you have the following prerequisites in place:
- Root-level access to the Ceph OSD node.
- Stop the
ceph-osd daemon.
About this task
To manipulate object attributes you need the data paths, the placement group identifier (PG ID),
the object, and the key in the object attribute.
Procedure
- Verify that the appropriate OSD is down.
systemctl status ceph-osd@OSD_ID
For
example,
[root@host01 ~]# systemctl status ceph-osd@1
- Log in to the OSD container.
cephadm shell --name osd.OSD_ID
For
example,
[root@host01 ~]# cephadm shell --name osd.0
- Get the attributes of the object.
ceph-objectstore-tool --data-path PATH_TO_OSD \
--pgid PG_ID OBJECT \
get-attr KEY > OBJECT_ATTRS_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-attr "oid" > zone_info.default.attr.txt - Set the attributes of the object.
ceph-objectstore-tool --data-path PATH_TO_OSD \
--pgid PG_ID OBJECT \
set-attr KEY > OBJECT_ATTRS_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-attr "oid" > zone_info.default.attr.txt - Remove the attributes of the object.
ceph-objectstore-tool --data-path PATH_TO_OSD \
--pgid PG_ID OBJECT \
rm-attr KEY
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":""}' \
rm-attr "oid"