ceph命令行操作辅助工具s3cmd

1:安装和配置s3cmd
#yum install s3cmd -y

2:配置s3cmd进行S3接口测试,初始化 s3cmd本地环境  将之前radosgw-admin创建的user的access_key和secret_key,根据本机实际进行赋值;

#vim ~/.s3cfg       将标红的部分改成你自己的桶配置和对应的radowgs地址即可

[default]
access_key = WEHZDTZCGV2NYYB0TRKF
access_token = 
add_encoding_exts = 
add_headers = 
bucket_location = US
ca_certs_file = 
cache_file = 
check_ssl_certificate = True
check_ssl_hostname = True
cloudfront_host = node1:7480
content_disposition = 
content_type = 
default_mime_type = binary/octet-stream
delay_updates = False
delete_after = False
delete_after_fetch = False
delete_removed = False
dry_run = False
enable_multipart = True
encrypt = False
expiry_date = 
expiry_days = 
expiry_prefix = 
follow_symlinks = False
force = False
get_continue = False
gpg_command = /usr/bin/gpg
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_passphrase = 
guess_mime_type = True
host_base = node1:7480
host_bucket = %(*)s.rgw.ptengine.cn
human_readable_sizes = False
invalidate_default_index_on_cf = False
invalidate_default_index_root_on_cf = True
invalidate_on_cf = False
kms_key = 
limit = -1
limitrate = 0
list_md5 = False
log_target_prefix = 
long_listing = False
max_delete = -1
mime_type = 
multipart_chunk_size_mb = 15
multipart_max_chunks = 10000
preserve_attrs = True
progress_meter = True
proxy_host = 
proxy_port = 0
put_continue = False
recursive = False
recv_chunk = 4096
reduced_redundancy = False
requester_pays = False
restore_days = 1
restore_priority = Standard
secret_key = bIgqgyq5Z7hAVspqkLhqn4V2J9XouMxU8fUsli3l
send_chunk = 4096
server_side_encryption = False
signature_v2 = False
signurl_use_https = False
simpledb_host = rgw.ptengine.cn
skip_existing = False
socket_timeout = 10
stats = False
stop_on_error = False
storage_class = 
throttle_max = 100
upload_id = 
urlencoding_mode = normal
use_http_expect = False
use_https = False
use_mime_magic = True
verbosity = WARNING
website_endpoint = http://node1:7480/
website_error = 
website_index = index.html

 

3.:#s3cmd --configure
将会问你一系列问题:
    AWS S3的访问密钥和安全密钥
    对AWS S3双向传输的加密密码和加密数据
    为加密数据设定GPG程序的路径(例如,/usr/bin/gpg)
    是否使用https协议
    如果使用http代理,设定名字和端口

配置将以保存普通文本格式保存在 ~/.s3cfg.
一路回车,因为我们已经配置过了,直到最后一步Test选y:

4:列举所有 Buckets。(bucket 相当于根文件夹)
s3cmd ls

5:创建 bucket,且 bucket 名称是唯一的,不能重复。
s3cmd mb s3://my-bucket-name

6:删除空 bucket
s3cmd rb s3://my-bucket-name

7:列举 Bucket 中的内容
s3cmd ls s3://my-bucket-name

8:上传 file.txt 到某个 bucket,
s3cmd put file.txt s3://my-bucket-name/file.txt

9:上传并将权限设置为所有人可读
s3cmd put --acl-public file.txt s3://my-bucket-name/file.txt

10:批量上传文件
s3cmd put ./* s3://my-bucket-name/

11:下载文件
s3cmd get s3://my-bucket-name/file.txt file.txt

12:批量下载
s3cmd get s3://my-bucket-name/* ./

13:删除文件
s3cmd del s3://my-bucket-name/file.txt

14:来获得对应的bucket所占用的空间大小
s3cmd du -H s3://my-bucket-name

你可能感兴趣的:(ceph命令行操作辅助工具s3cmd)