记qingcloud对s3兼容的url的坑

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37788558/article/details/84382102

前言

使用s3fs挂载qingstor到本地文件系统,对于url的设置是个坑,没用文档上的默认url,因为总感觉应该有包名做区分。。结果实际上就是要用那个默认的。

开始

小提示:
s3fs中,添加参数 -f -d -o f2 可进行日志输出,其中 -f 参数让日志输出到屏幕,如果不加-f,则会写入/var/log/message文件夹中(文档上这样写的,但实际未找到该文件夹,所以加上-f)

qingcloud文档截图如下:
在这里插入图片描述
那我的理解就是:url在一般api和s3支持中是不一样的,需要在bucketname后加.s3或在domain后加bucket-name
假设我的bucket命名为hqw-wyq,那么:

但实际应该用 http://s3.pek3b.qingstor.com 就行

遇到的报错:

[root@0Z mybucket]# s3fs hqw-wyq /mnt/mybucket -o passwd_file=/root/.s3fs/credentials -o url=http://hqw-wyq.pek3b.qingstor.com -f -d -o f2
[CRT] s3fs.cpp:set_s3fs_log_level(275): change debug level from [CRT] to [INF] 
[CRT] s3fs.cpp:set_s3fs_log_level(275): change debug level from [INF] to [DBG] 
[INF]     s3fs.cpp:set_mountpoint_attribute(4251): PROC(uid=0, gid=0) - MountPoint(uid=0, gid=0, mode=40777)
[INF] s3fs.cpp:s3fs_init(3381): init v1.84(commit:e8033f9) with OpenSSL
[INF] s3fs.cpp:s3fs_check_service(3727): check services.
[INF]       curl.cpp:CheckBucket(3080): check a bucket.
[DBG] curl.cpp:GetHandler(285): Get handler from pool: 31
[INF]       curl.cpp:prepare_url(4271): URL is http://hqw-wyq.pek3b.qingstor.com/hqw-wyq/
[INF]       curl.cpp:prepare_url(4303): URL changed is http://hqw-wyq.hqw-wyq.pek3b.qingstor.com/hqw-wyq/.pek3b.qingstor.com/hqw-wyq/
[INF]       curl.cpp:insertV4Headers(2408): computing signature [GET] [/] [] []
[INF]       curl.cpp:url_to_host(101): url is http://hqw-wyq.pek3b.qingstor.com
[DBG] curl.cpp:RequestPerform(2045): connecting to URL http://hqw-wyq.hqw-wyq.pek3b.qingstor.com/hqw-wyq/.pek3b.qingstor.com/hqw-wyq/
[INF]       curl.cpp:RequestPerform(2082): HTTP response code 404 was returned, returning ENOENT
[DBG] curl.cpp:RequestPerform(2083): Body Text: {"code":"bucket_not_exists","message":"The bucket you are accessing does not exist.","url":"http://docs.qingcloud.com/qingstor/api/common/error_code.html","request_id":"952087d5000f43ef"}

[ERR] curl.cpp:CheckBucket(3108): Check bucket failed, S3 response: {"code":"bucket_not_exists","message":"The bucket you are accessing does not exist.","url":"http://docs.qingcloud.com/qingstor/api/common/error_code.html","request_id":"952087d5000f43ef"}

[CRT] s3fs.cpp:s3fs_check_service(3786): bucket not found(host=http://hqw-wyq.pek3b.qingstor.com) - result of checking service.
[DBG] curl.cpp:ReturnHandler(309): Return handler to pool: 31
[ERR] s3fs.cpp:s3fs_exit_fuseloop(3371): Exiting FUSE event loop due to errors

[INF] s3fs.cpp:s3fs_destroy(3434): destroy

经测试,发现url应该用“http://s3.pek3b.qingstor.com”,不需要bucketname,因为它会自动将bucketname补在path中,即上面文档截图的path形式。

猜你喜欢

转载自blog.csdn.net/qq_37788558/article/details/84382102