Riak CS returns "s3.amazonaws.com" 无论 cs_root_host 中有什么

Riak CS returns "s3.amazonaws.com" no matter what is in cs_root_host

cs_root_host设置正确:

grep root_host /var/lib/riak-cs/generated.configs/app.2015.07.09.13.59.07.config
    {cs_root_host,"s3.example.com"},

但是当我上传文件时:

s3cmd put test.jpg s3://images --acl-public

我进了return:

Public URL of the object is: http://images.s3.amazonaws.com/test.jpg

问题出在哪里?

添加: 这是输出——一切看起来都很好,除了最后一行:

(example.com 只是替换我不想 public)

的真实域

    s3cmd -d -c .s3cfg put newfile.jpg s3://images --acl-public
    DEBUG: ConfigParser: Reading file '.s3cfg'
    DEBUG: ConfigParser: access_key->YD...17_chars...U
    DEBUG: ConfigParser: bucket_location->RU
    DEBUG: ConfigParser: cloudfront_host->cloudfront.amazonaws.com
    DEBUG: ConfigParser: cloudfront_resource->/2010-07-15/distribution
    DEBUG: ConfigParser: default_mime_type->binary/octet-stream
    DEBUG: ConfigParser: delete_removed->False
    DEBUG: ConfigParser: dry_run->False
    DEBUG: ConfigParser: encoding->UTF-8
    DEBUG: ConfigParser: encrypt->False
    DEBUG: ConfigParser: follow_symlinks->False
    DEBUG: ConfigParser: force->False
    DEBUG: ConfigParser: get_continue->False
    DEBUG: ConfigParser: gpg_command->/usr/bin/gpg
    DEBUG: ConfigParser: gpg_decrypt->%(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
    DEBUG: ConfigParser: gpg_encrypt->%(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
    DEBUG: ConfigParser: gpg_passphrase->...-3_chars...
    DEBUG: ConfigParser: guess_mime_type->True
    DEBUG: ConfigParser: host_base->s3.example.com
    DEBUG: ConfigParser: host_bucket->%(bucket)s.s3.example.com
    DEBUG: ConfigParser: human_readable_sizes->False
    DEBUG: ConfigParser: list_md5->False
    DEBUG: ConfigParser: log_target_prefix->
    DEBUG: ConfigParser: preserve_attrs->True
    DEBUG: ConfigParser: progress_meter->True
    DEBUG: ConfigParser: proxy_host->127.0.0.1
    DEBUG: ConfigParser: proxy_port->80
    DEBUG: ConfigParser: recursive->False
    DEBUG: ConfigParser: recv_chunk->4096
    DEBUG: ConfigParser: reduced_redundancy->False
    DEBUG: ConfigParser: secret_key->kG...37_chars...=
    DEBUG: ConfigParser: send_chunk->4096
    DEBUG: ConfigParser: simpledb_host->sdb.amazonaws.com
    DEBUG: ConfigParser: skip_existing->False
    DEBUG: ConfigParser: socket_timeout->10
    DEBUG: ConfigParser: urlencoding_mode->normal
    DEBUG: ConfigParser: use_https->False
    DEBUG: ConfigParser: verbosity->WARNING
    DEBUG: Updating Config.Config encoding -> UTF-8
    DEBUG: Updating Config.Config follow_symlinks -> False
    DEBUG: Updating Config.Config verbosity -> 10
    DEBUG: Unicodising 'put' using UTF-8
    DEBUG: Unicodising 'newfile.jpg' using UTF-8
    DEBUG: Unicodising 's3://images' using UTF-8
    DEBUG: Command: put
    INFO: Compiling list of local files...
    DEBUG: DeUnicodising u'' using UTF-8
    DEBUG: DeUnicodising u'newfile.jpg' using UTF-8
    DEBUG: Unicodising 'newfile.jpg' using UTF-8
    DEBUG: Unicodising 'newfile.jpg' using UTF-8
    INFO: Applying --exclude/--include
    DEBUG: CHECK: newfile.jpg
    DEBUG: PASS: newfile.jpg
    INFO: Summary: 1 local files to upload
    DEBUG: Content-Type set to 'image/jpeg'
    DEBUG: String 'newfile.jpg' encoded to 'newfile.jpg'
    DEBUG: SignHeaders: 'PUT\n\nimage/jpeg\n\nx-amz-acl:public-read\nx-amz-date:Fri, 10 Jul 2015 09:55:37 +0000\n/images/newfile.jpg'
    DEBUG: CreateRequest: resource[uri]=/newfile.jpg
    DEBUG: Unicodising 'newfile.jpg' using UTF-8
    DEBUG: SignHeaders: 'PUT\n\nimage/jpeg\n\nx-amz-acl:public-read\nx-amz-date:Fri, 10 Jul 2015 09:55:37 +0000\n/images/newfile.jpg'
    newfile.jpg -> s3://images/newfile.jpg  [1 of 1]
    DEBUG: get_hostname(images): images.s3.example.com
    DEBUG: format_uri(): http://images.s3.example.com/newfile.jpg
     32600 of 32600   100% in    0s    14.49 MB/sDEBUG: Response: {'status': 200, 'headers': {'content-length': '0', 'server': 'nginx', 'connection': 'keep-alive', 'etag': '"89e39f454c69a1ce1fadec3a222fc292"', 'date': 'Fri, 10 Jul 2015 09:55:37 GMT', 'content-type': 'text/plain'}, 'reason': 'OK', 'data': '', 'size': 32600}
     32600 of 32600   100% in    0s   391.54 kB/s  done
    DEBUG: MD5 sums: computed=89e39f454c69a1ce1fadec3a222fc292, received="89e39f454c69a1ce1fadec3a222fc292"
    Public URL of the object is: http://images.s3.amazonaws.com/newfile.jpg

这不是 Riak CS 问题。 s3cmd 本身产生 public url 字符串 并打印出来。

对于我的环境,使用提交主分支的 s3cmd 7bdefc81823699069706ea3680bfa65ec8ad3db5(今天刚取的,2015-07-14), 它显示(看似)正确的 URL.

% ~/g/s3cmd/build/scripts-2.7/s3cmd -c .s3cfg.15018.alice put rebar.config -P s3://test/a
rebar.config -> s3://test/a  [1 of 1]
2791 of 2791   100% in    0s   196.88 kB/s  done
Public URL of the object is: http://test.s3.example.com/a

从s3cmd的源代码来看,好像是用了host_bucket或者host_base 配置取决于存储桶名称(或其他配置。)

关于我的环境的一些其他细节

  • s3cmd 配置:host_base = s3.example.comhost_bucket = %(bucket)s.s3.example.com
  • 服务器是 develop 分支的 Riak CS(提交 1f954aaae45429923f65fdad40c7916a55ab79f3
  • Riak CS 配置:cs_root_host = s3.example.com