Docker Ceph系列之第二篇:使用灵雀云启动Docker Ceph对象存储(S3或Swift)
Hypers
国内顶尖的大数据分析公司,参加过“云雀Docker巨好玩”并获得一等奖,年纪尚小请大家多多指教。因为有人提出了这个想法,我之前已经成功实践过这些实验,自己也就把百度和Google不到的私房菜贡献出来,只有一个要求,希望大家互相帮助,不要自吹自擂就行,多多分享。顺便向大家推荐下云雀平台 http://www.alauda.cn
还有Daocloud https://www.daocloud.io
希望大家互相扶持,互相帮助,与DockOne&OSchina还有所有的开源社区一起推动国内的Docker商用和技术能力。
用Docker搭建Ceph对象存储非常简单,只需要几条命令就可以搞定,甚至比Ceph出的ceph-deploy还方便,也无需翻墙获得软件包。
上一篇为 使用Docker搭建Ceph集群
我的部署环境是
灵雀云Docker平台
浏览镜像—》搜索 ceph-demo
创建服务
root@426debfd7cb7:/opt#radosgw-admin user create --uid="testuser" --display-name="First User"
{
"user_id": "testuser",
"display_name": "First User",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"auid": 0,
"subusers": [],
"keys": [
{
"user": "testuser",
"access_key": "MBFIV44FH7FIV96UM124",
"secret_key": "idSCzjsrHNDXPZdLK2cgOpE2UkM6Jx5lhdMM9DvY"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"max_size_kb": -1,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"max_size_kb": -1,
"max_objects": -1
},
"temp_url_keys": []
}
root@426debfd7cb7:/opt#sed -i s@archive.ubuntu.com@mirrors.aliyun.com@g /etc/apt/sources.list
root@426debfd7cb7:/opt#apt-get update
root@426debfd7cb7:/opt#apt-get install vim -y
root@426debfd7cb7:/opt#apt-get install python-pip -y
root@426debfd7cb7:/opt#pip install boto
root@426debfd7cb7:/opt#vim s3.py
import boto
import boto.s3.connection
access_key = 'MBFIV44FH7FIV96UM124'
secret_key = 'idSCzjsrHNDXPZdLK2cgOpE2UkM6Jx5lhdMM9DvY'
conn = boto.connect_s3(
aws_access_key_id = access_key,
aws_secret_access_key = secret_key,
host = 'ceph-smoak.myalauda.cn',
is_secure=False,
calling_format = boto.s3.connection.OrdinaryCallingFormat(),
)
bucket = conn.create_bucket('georce')
for bucket in conn.get_all_buckets():
print "{name}/t{created}".format(
name = bucket.name,
created = bucket.creation_date,
)
root@426debfd7cb7:/opt#chmod 755 s3.py
root@426debfd7cb7:/opt#python s3.py
georce 2015-06-21T16:56:07.000Z