博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
S3cmd 中国区客户端配置详解
阅读量:7227 次
发布时间:2019-06-29

本文共 2026 字,大约阅读时间需要 6 分钟。

本篇旨在介绍S3cmd的配置方法

注意:s3cmd版本>1.5

1、下载s3cmd

wget

解压
tar -zxf s3cmd-1.5.2.tar.gz -C /usr/local

2、安装setuptools

tar -xf setuptools-0.6c11.tar.gz

cd setuptools-0.6c11
python setup.py install

3、安装s3cmd

cd /usr/local/s3cmd-1.5.2

python setup.py install

4、配置AK

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 : 输入AK
Secret Key : 输入SK
Default Region [US]:
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]:
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:*
Secret Key: ***
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]
test access.... ? 这块选择no,选用yes会测试失败
save the changes? yes

以上必须填写的是AK和SK,其他信息直接回车即可。

5、修改配置文件:(如下以中国宁夏为例,修改如下四行内容)

vi /root/.s3cfg

bucket_location = cn-northwest-1
host_base = s3.cn-northwest-1.amazonaws.com.cn
host_bucket = %(bucket)s.s3.cn-northwest-1.amazonaws.com.cn
website_endpoint =http://%(bucket)s.s3-website-%(location)s.amazonaws.com.cn

默认的S3配置文件是AWS美国地域的,所以不修改的话会出现:Your Access key is not in our record类似这种错误。

修改完成后即可使用s3cmd 去测试了。

一般在linux系统上使用s3cmd也是为了便于写异地备份脚本,常用命令如下:

查看存储桶内容
s3cmd ls s3://bucket_name
上传存储桶内容 (如递归上传,需要加上参数-r)
s3cmd put filename s3://bucket_name/filename
删除存储桶内容
s3cmd del s3://bucket_name/filename

更多命令可通过s3cmd --help查看

转载于:https://blog.51cto.com/9867744/2356318

你可能感兴趣的文章
Protostuff 介绍
查看>>
一张图看懂开源许可协议,开源许可证GPL、BSD、MIT、Mozilla、Apache和LGPL的区别...
查看>>
参数验证其实可以更简明一点
查看>>
Set up Mule runtime env with mule-standalone-3.6.0
查看>>
Linux基础-linux命令:csplit
查看>>
core_framework —— 基于libev的轻量级lua网络开发框架
查看>>
回到顶部
查看>>
DES/3DES(TripleDES)加密、解密测试数据
查看>>
Maven项目标准目录结构
查看>>
Tomcat 系统架构与设计模式,第 1 部分: 工作原理
查看>>
Hadoop输出参数信息详解(16)
查看>>
ERROR 2002 (HY000): Can't connect to local MySQL错误
查看>>
Java版冒泡排序法
查看>>
关于FB4.6插件安装后默认语言环境的更改问题
查看>>
免费分区助手
查看>>
Javascript通过Name调用Function
查看>>
统计当前在线用户数量
查看>>
IntelliJ IDEA 乱码解决方案 (项目代码、控制台等)
查看>>
PHP项目记录
查看>>
.net面试题系列文章七(附答案)
查看>>