CEPH-初识篇】ceph详细介绍+“ 一 ” 篇解决ceph集群搭建, “ 三 ” 大(对象、块、文件)存储使用(下)

简介: CEPH-初识篇】ceph详细介绍+“ 一 ” 篇解决ceph集群搭建, “ 三 ” 大(对象、块、文件)存储使用(下)

三、对象存储

在使用对象存储之前,使用我们cephfs快照。(如果安装了块存储,这里的对象存储网关启动不了,原因不明。)

1、在 ceph-1 上通过 ceph-deploy 将 ceph-radosgw 软件包安装到 ceph-1 中

[root@ceph-1 ceph]# ceph-deploy install --rgw ceph-1

2、创建RGW服务

[root@ceph-1 ceph]# ceph-deploy rgw create ceph-1
[root@ceph-1 ceph]# ps -ef | grep radosgw
ceph        2347       1  2 15:50 ?        00:00:00 /usr/bin/radosgw -f --cluster ceph --name client.rgw.ceph-1 --setuser ceph --setgroup ceph
root        2962    1771  0 15:51 pts/0    00:00:00 grep --color=auto radosgw
[root@ceph-1 ceph]# systemctl status ceph-radosgw\*
● ceph-radosgw@rgw.ceph-1.service - Ceph rados gateway
   Loaded: loaded (/usr/lib/systemd/system/ceph-radosgw@.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-06-03 15:50:45 CST; 31s ago
 Main PID: 2347 (radosgw)
   CGroup: /system.slice/system-ceph\x2dradosgw.slice/ceph-radosgw@rgw.ceph-1.service
           └─2347 /usr/bin/radosgw -f --cluster ceph --name client.rgw.ceph-1 --setuser ceph --setgroup ceph
Jun 03 15:50:45 ceph-1 systemd[1]: Started Ceph rados gateway.
Jun 03 15:50:45 ceph-1 systemd[1]: Starting Ceph rados gateway...

3、访问RGW

RGW默认端口 7480

[root@ceph-1 ceph]# yum install -y net-tools
[root@ceph-1 ceph]# netstat -tnplu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
...
tcp        0      0 0.0.0.0:7480            0.0.0.0:*               LISTEN      2347/radosgw

浏览器访问http://192.168.200.43:7480/

使用 S3 访问 RGW

1、创建 s3 的兼容用户

[root@ceph-1 ceph]# radosgw-admin user create --uid ceph-s3-user --display-name "Ceph S3 User Demo"
...
    "keys": [ 
        { 
            "user": "ceph-s3-user", 
            "access_key": "V3J9L4M1WKV5O5ECAKPU", 
           "secret_key":"f5LqLVYOVNu38cuQwi0jXC2ZTboCSJDmdvB8oeYw" 
  ...
        }

access_key 与 secret_key 这里可以记录一下,也可以使用命令再次查看。

[root@ceph-1 ceph]# radosgw-admin user info --uid ceph-s3-user

使用命令行方式操作 rgw

1、配置命令行工具

[root@ceph-1 ceph]# yum -y install s3cmd 
[root@ceph-1 ceph]# s3cmd --configure
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.
Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
Access Key: 82EWM49KPWGFVR0CWSD4  #输入用户Access 
Secret Key: 129CSMM9Dk3CC1lZwM7kn75lXMhrWBAMPEuyJL5k ##输入用户Secret 
Default Region [US]: #默认回车
Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
S3 Endpoint [s3.amazonaws.com]: 192.168.200.43:7480  #输入Rgw服务地址
Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used
if the target S3 system supports dns based buckets.
DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: 192.168.200.43:7480/%(bucket)s  #输入
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password:  ##默认回车
Path to GPG program [/usr/bin/gpg]: ##默认回车
When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP, and can only be proxied with Python 2.7 or newer
Use HTTPS protocol [Yes]: no  #输入no
On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't connect to S3 directly
HTTP Proxy server name:   
New settings:
  Access Key: 82EWM49KPWGFVR0CWSD4
  Secret Key: 129CSMM9Dk3CC1lZwM7kn75lXMhrWBAMPEuyJL5k
  Default Region: US
  S3 Endpoint: 192.168.200.43:7480  ##输入Rgw服务地址
  DNS-style bucket+hostname:port template for accessing a bucket: 192.168.200.43:7480/%(bucket)s
  Encryption password:  
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: False
  HTTP Proxy server name: 
  HTTP Proxy server port: 0
Test access with supplied credentials? [Y/n] y  #输入y
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)
Now verifying that encryption works...
Not configured. Never mind.
Save settings? [y/N] y  #输入y
Configuration saved to '/root/.s3cfg'

2、这是需要修改版本,启用v2版本即可

[root@ceph-1 ~]# s3cmd mb s3://s3cmd-demo
ERROR: S3 error: 403 (SignatureDoesNotMatch)
[root@ceph-1 ceph]# sed -i '/signature_v2/s/False/True/g' /root/.s3cfg

3、创建

[root@ceph-1 ceph]# s3cmd mb s3://s3cmd-demo
Bucket 's3://s3cmd-demo/' created

4、上传

[root@ceph-1 ceph]# s3cmd put /etc/fstab s3://s3cmd-demo/fatab-demo
upload: '/etc/fstab' -> 's3://s3cmd-demo/fatab-demo'  [1 of 1]
 541 of 541   100% in    1s   327.08 B/s  done

5、下载

[root@ceph-1 ceph]# s3cmd get s3://s3cmd-demo/fatab-demo
download: 's3://s3cmd-demo/fatab-demo' -> './fatab-demo'  [1 of 1]
 541 of 541   100% in    0s    39.79 KB/s  done

6、删除

[root@ceph-1 ceph]# s3cmd del s3://s3cmd-demo/fatab-demo
delete: 's3://s3cmd-demo/fatab-demo'

参考资料

https://docs.ceph.com/en/latest/

目录
相关文章
|
10月前
|
存储 算法 关系型数据库
【CEPH-初识篇】ceph详细介绍+“ 一 ” 篇解决ceph集群搭建, “ 三 ” 大(对象、块、文件)存储使用(上)
【CEPH-初识篇】ceph详细介绍+“ 一 ” 篇解决ceph集群搭建, “ 三 ” 大(对象、块、文件)存储使用
943 0
|
11月前
|
存储 前端开发 对象存储
带你读《存储漫谈:Ceph原理与实践》——3.2.2 RGW 架构
带你读《存储漫谈:Ceph原理与实践》——3.2.2 RGW 架构
|
11月前
|
存储 固态存储 Windows
带你读《存储漫谈:Ceph原理与实践》——3.3.2 CephFS 访问方式
带你读《存储漫谈:Ceph原理与实践》——3.3.2 CephFS 访问方式
带你读《存储漫谈:Ceph原理与实践》——3.3.2 CephFS 访问方式
|
存储 关系型数据库 API
Ceph分布式存储初步认识(一)(下)
Ceph分布式存储初步认识(一)(下)
237 0
Ceph分布式存储初步认识(一)(下)
|
存储 分布式计算 算法
Ceph分布式存储初步认识(一)(上)
Ceph分布式存储初步认识(一)(上)
268 0
Ceph分布式存储初步认识(一)(上)
|
存储 Kubernetes 测试技术
k8s使用ceph实现动态持久化存储
简介 本文章介绍如何使用ceph为k8s提供动态申请pv的功能。ceph提供底层存储功能,cephfs方式支持k8s的pv的3种访问模式ReadWriteOnce,ReadOnlyMany ,ReadWriteMany ,RBD支持ReadWriteOnce,ReadOnlyMany两种模式 访问模式只是能力描述,并不是强制执行的,对于没有按pvc声明的方式使用pv,存储提供者应该负责访问时的运行错误。
3381 0
|
存储 安全 关系型数据库
如何从 Ceph (Luminous) 集群中安全移除 OSD
OSD.png 工作中需要从 Ceph 的集群中移除一台存储服务器,挪作他用。Ceph 存储空间即使在移除该存储服务器后依旧够用,所以操作是可行的,但集群已经运行了很长时间,每个服务器上都存储了很多数据,在数据无损的情况下移除,看起来也不简单。
1661 0
|
存储 算法 关系型数据库
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2 Ceph 数据寻址(三)
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2 Ceph 数据寻址
|
存储 算法 关系型数据库
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2 Ceph 数据寻址(一)
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2Ceph 数据寻址
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2 Ceph 数据寻址(一)
|
存储 算法 固态存储
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2 Ceph 数据寻址(二)
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2 Ceph 数据寻址
带你读《存储漫谈Ceph原理与实践》第二章Ceph 架构2.2 Ceph 数据寻址(二)