Ceph 对象存储
2019-03-13 本文已影响0人
Super岩岩
新建云主机作为网关节点,配置cephd用户,配置免密码登录,配置admin-deploy节点/etc/hosts,配置网关节点/etc/hosts,配置cephd账户免ssh登录;
网关节点主机名cephgw
在admin-deploy节点执行
$ceph-deploy install --rgw cephgw
报错:
[cephgw][ERROR] Traceback (most recent call last):
[cephgw][ERROR] File "/usr/lib/python2.7/site-packages/ceph_deploy/lib/vendor/remoto/process.py",line 119, in run
[cephgw][ERROR] reporting(conn, result, timeout)
[cephgw][ERROR] File"/usr/lib/python2.7/site-packages/ceph_deploy/lib/vendor/remoto/log.py",line 13, in reporting
[cephgw][ERROR] received = result.receive(timeout)
[cephgw][ERROR] File"/usr/lib/python2.7/site-packages/ceph_deploy/lib/vendor/remoto/lib/vendor/execnet/gateway_base.py",line 704, in receive
[cephgw][ERROR] raise self._getremoteerror() orEOFError()
[cephgw][ERROR] RemoteError: Traceback (most recent call last):
[cephgw][ERROR] File "", line1036, in executetask
[cephgw][ERROR] File "",line 12, in _remote_run
[cephgw][ERROR] File"/usr/lib64/python2.7/subprocess.py", line 711, in __init__
[cephgw][ERROR] errread, errwrite)
[cephgw][ERROR] File"/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
[cephgw][ERROR] raise child_exception
[cephgw][ERROR] OSError: [Errno 2] No such file or directory
[cephgw][ERROR]
[cephgw][ERROR]
[ceph_deploy][ERROR] RuntimeError: Failed to execute command: ceph --version
估计网速不好,重新安装一遍成功了
执行
$ceph-deploy admin cephgw
$ceph-deploy rgw create cephgw
执行成功后,cephgw节点上通过7480端口访问网关了
修改端口:
在admin-deploy节点执行
修改/home/cephd/cluster-ceph目录下的ceph.conf文件
添加:
[client.rgw.cephgw]
rgw_frontends = “civetweb port=8099”
推送给配置文件到网关节点:
$ceph-deploy –overwrite-conf config push cephgw
推动后,在cephgw节点重启网关服务:
$sudo systemctl restartceph-radosgw.target
注意,这里红字内容和官网文档不一样,官网文档写的是ceph-radosgw.service,根本找不到服务
此时访问http://cephgwIp:8099,可以看到网关页面返回信息
创建s3网关用户
[root@admin-deploy ceph]# radosgw-admin user create --uid="zhangyan777"--display-name="zhangyan"
{
"user_id":"zhangyan777",
"display_name":"zhangyan",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"auid": 0,
"subusers": [],
"keys": [
{
"user":"zhangyan777",
"access_key":"R5WN26V2RBIA23U39XDQ",
"secret_key": "[Gh8KJCR2xsUownPv7FfvY5E9AEW2r9fE97Fznrmk](https://www.jianshu.com/writer)"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write,delete",
"default_placement":"",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"temp_url_keys": [],
"type": "rgw",
"mfa_ids": []
}
注意,生成的ak、sk要保存好,访问对象存储功能时需要使用
可以通过s3客户端来测试ceph对象存储
#yum install –y s3cmd
配置s3cmd
s3cmd –configure
主要配置ak,sk,endpoint指向ceph对象网关ip地址和端口
测试
$s3cmd mb s3://first-bucket