You can not delete image Report rbd: error: image still has watchers Solution Can not delete the image newspaper rbd: error: image still has watchers solution

Reference links:

You can not delete image Report rbd: error: image still has watchers solution

Solutions:

Ceph cluster in the daily operation and maintenance, the administrator may experience some image can not be deleted:
1) Due to the snapshot information in the image, only need to first clear snapshot information, you can then delete the image
2) the image still being a client to access specific performance for image has watcher. If the client end of the abnormal situation can not delete the image so there will be

In the first case, a good solution, to say here is how to solve the second case. Prior to solve science-related knowledge about watcher:
Ceph has a watch / notify mechanism (particle size object), which is used between different client message notification, so that the state between the client to remain consistent, and every a client-side watch, for the Ceph cluster for both a watcher.

Solution:

1. Check the watcher on the current image

Check one:

[root@node3 ~]# rbd status foo
watcher=192.168.197.157:0/1135656048 client.4172 cookie=1

This method is simple and quick view, it is recommended

View Method Two:

1) First, find the image of the object header

[root@node3 ~]# rbd info foo
rbd image 'foo':
        size 1024 MB in 256 objects
        order 22 (4096 kB objects)
        block_name_prefix: rbd_data.1041643c9869
        format: 2
        features: layering
        flags: 
        create_timestamp: Tue Oct 17 10:20:50 2017

The image is from the block_name_prefix rbd_data.1041643c9869, shows the image of the object header rbd_header.1041643c9869 later, has been the object header to view the watcher information

2) watcher information on viewing the image of the object header

[root@node3 ~]# rados -p rbd listwatchers rbd_header.1041643c9869
watcher=192.168.197.157:0/1135656048 client.4172 cookie=1

2. Delete the image on the watcher

2.1 The watcher blacklist:

[root@node3 ~]# ceph osd blacklist add 192.168.197.157:0/1135656048 
blacklisting 192.168.197.157:0/1135656048 until 2017-10-18 12:04:19.103313 (3600 sec)

2.2 View occupy watcher of the image:

[root@node3 ~]# rados -p rbd listwatchers  rbd_header.1041643c9869
[root@node3 ~]# 

watcher abnormal client information does not exist, then we can delete the image of the

2.3 delete the image:

[root@node3 ~]# rbd rm foo
Removing image: 100% complete...done.

3. The subsequent operation

In fact done above have solved the problem, but the best is still to blacklist client is removed, the following are the relevant operations related to blacklist

3.1 query blacklist:

[root@node3 ~]# ceph osd blacklist ls
listed 1 entries
192.168.197.157:0/1135656048 2017-10-18 12:04:19.103313

3.2 removal from the blacklist a client:

[root@node3 ~]# ceph osd blacklist rm 192.168.197.157:0/1135656048 
un-blacklisting 192.168.197.157:0/1135656048

3.3 Clear Blacklist:

[root@node3 ~]# ceph osd blacklist clear
 removed all blacklist entries

Guess you like

Origin www.cnblogs.com/wangjq19920210/p/12165466.html