概要:
局限性
ossfs提供的功能和性能和本地文件系统相比,具有一些局限性。具体包括:
- 随机或者追加写文件会导致整个文件的重写。
- 元数据操作,例如list directory,性能较差,因为需要远程访问oss服务器
- 文件/文件夹的rename操作不是原子的
- 多个客户端挂载同一个oss bucket时,依赖用户自行协调各个客户端的行为。例如避免多个客户端写同一个文件等等。
- 不支持hard link。
- 不适合用在高并发读/写的场景,这样会让系统的load升高
一、安装ossfs之前安装相应的依赖库:
Ubuntu 14.04:sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev \ libfuse-dev libssl-dev libxml2-dev make pkg-configCentOS 7.0:sudo yum install automake gcc-c++ git libcurl-devel libxml2-devel \ fuse-devel make openssl-devel安装ossfs源码,可以从github上获取
git clone https://github.com/aliyun/ossfs.gitcd ossfs./autogen.sh./configuremakesudo make install二、配置相应文件
设置bucket name, access key/id信息,将其存放在/etc/passwd-ossfs 文件中, 注意这个文件的权限必须正确设置,建议设为640。
echo my-bucket:my-access-key-id:my-access-key-secret > /etc/passwd-ossfschmod 640 /etc/passwd-ossfs挂载oss相应的bucket到本地挂载点
ossfs my-bucket my-mount-point -ourl=my-oss-endpoint
example:将my-bucket这个bucket挂载到/tmp/ossfs目录下,AccessKeyId是faint, AccessKeySecret是123,oss endpoint是http://oss-cn-hangzhou.aliyuncs.comecho my-bucket:faint:123 > /etc/passwd-ossfschmod 640 /etc/passwd-ossfsmkdir /tmp/ossfsossfs my-bucket /tmp/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com卸载oss
卸载bucket:umount /tmp/ossfs # root userfusermount -u /tmp/ossfs # non-root user 遇到的问题:
ossfs test /ossfsfile -ourl=http://oss-cn-hangzhou.aliyuncs.com[ERR] curl.cpp:CheckBucket(2625): Check bucket failed, OSS response: <?xml version="1.0" encoding="UTF-8"?><Error> <Code>RequestTimeTooSkewed</Code> <Message>The difference between the request time and the current time is too large.</Message> <RequestId>58F6D89ECBB6F0795271EEBA</RequestId> <HostId>test.oss-cn-hangzhou.aliyuncs.com</HostId> <MaxAllowedSkewMilliseconds>900000</MaxAllowedSkewMilliseconds> <RequestTime>2017-04-19T04:21:16.000Z</RequestTime> <ServerTime>2017-04-19T03:25:18.000Z</ServerTime></Error>[ERR] curl.cpp:CheckBucket(2625): Check bucket failed, OSS response: <?xml version="1.0" encoding="UTF-8"?><Error> <Code>RequestTimeTooSkewed</Code> <Message>The difference between the request time and the current time is too large.</Message> <RequestId>58F6D89ECBB6F0795271EEC1</RequestId> <HostId>test.oss-cn-hangzhou.aliyuncs.com</HostId> <MaxAllowedSkewMilliseconds>900000</MaxAllowedSkewMilliseconds> <RequestTime>2017-04-19T04:21:16.000Z</RequestTime> <ServerTime>2017-04-19T03:25:18.000Z</ServerTime></Error>[CRT] s3fs.cpp:s3fs_check_service(3690): invalid credentials - result of checking service.ossfs: Check OSS service failed. Run with -f option for more details.- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
上面的错误最主要的一句话为:
The difference between the request time and the current time is too large.意思是请求的时间和当前的时间差异太大
尝试查看本地时间
[root@storm1 tmp]# dateWed Apr 19 16:47:47 CST 2017果然差距一个小时 只需更新同步时间即可
ntpdate cn.pool.ntp.org19 Apr 15:52:39 ntpdate[71442]: step time server 51.15.41.135 offset -3357.358058 sec再次挂载
ossfs test /ossfsfile -ourl=http://oss-cn-hangzhou.aliyuncs.com在遇到错误的时候尝试添加debug信息日志
ossfs test /ossfsfile -ourl=http://oss-cn-hangzhou.aliyuncs.com -o dbglevel=debug -f -d > /tmp/fs.log 2>&1查看日志信息,并解决。
全文地址请点击:https://blog.csdn.net/kane_canpo ... 160?utm_source=copy
|
|