반응형
python 으로 ceph 연동
1. 패키지 설치
$ yum install python-rados
2. python ceph 연동 확인
# python
Python 2.7.5 (default, Jun 20 2019, 20:27:34)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rados, sys
>>> cluster = rados.Rados(conffile='/etc/ceph/ceph.conf')
cluster librados 버전 확인
>>> print "\nlibrados version: " + str(cluster.version())
librados version: 0.69.1
mon initial members 확인
>>> print "Will attempt to connect to: " + str(cluster.conf_get('mon initial members'))
Will attempt to connect to: ceph
>>> cluster.connect()
>>> print "\nCluster ID: " + cluster.get_fsid()
Cluster ID: 6efc3505-795f-4b84-b52d-900b9bba4bc1
pool 확인
>>> pools = cluster.list_pools()|
>>> print(pools)
[u'test', u'test2']
pool 삭제
>>> cluster.delete_pool('test')
>>> print(pools)
[u'test2']
에러사항
>>> cluster.delete_pool('test')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "rados.pyx", line 425, in rados.requires.wrapper.validate_func (rados.c:4106)
File "rados.pyx", line 993, in rados.Rados.delete_pool (rados.c:10697)
rados.PermissionError: error deleting pool 'test'
# vi /etc/ceph/ceph.conf
아래 내용 설정
mon_allow_pool_delete=true
# systemctl restart ceph.target
반응형
'BlockStorage(Ceph)' 카테고리의 다른 글
[Ceph] Ceph - ansible 설치 (0) | 2021.07.04 |
---|---|
ceph 1 daemons have recently crashed (0) | 2021.02.20 |
CEPH OSD OS재설치 (0) | 2021.01.31 |
[ERROR] ceph application not enabled on 1 pool(s) (0) | 2021.01.30 |
[ERROR] RuntimeError: Unable to create a new OSD id (0) | 2021.01.25 |