YUMSERV
Published 2021. 4. 16. 08:22
python-rados 연동 BlockStorage(Ceph)
반응형

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

 

반응형
profile

YUMSERV

@lena04301

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!