将OSS bucket挂载成为阿里云ECS服务器本地盘

首先你的服务器必须是CentOS 6.5 或者Ubuntu 14.04 系统,否则不能安装和挂载!! 
 
 
登入你的服务器先依赖软件安装 
 
 
 
CentOS 6.5  
yum install libcurl libcurl-devel openssl-devel fuse fuse-libs fuse-devel libxml2-devel git gcc g++ make  
 
 
Ubuntu 14.04  
apt-get update  
apt-get install libcurl4-openssl-dev libssl-dev pkg-config libxml2 libxml2-dev libfuse-dev git gcc g++ make   
以下我用CentOS 6.5 做示范! 
输入:yum install libcurl libcurl-devel openssl-devel fuse fuse-libs fuse-devel libxml2-devel git gcc g++ make  
遇到确认请输入Y 
211_35615732_ffc4bd45392f659.png?29 
 
 
 
出现下图说明安装依赖软件成功 
 
 
211_35615732_fd0d16ad6ef8ade.png?9 
 
 
 
接下来下载安装cloudfs: 
输入:git clone https://git.oschina.net/weiweibaba2007/cloudfs.git  
 
 
211_35615732_4eae2d2d1209c2f.png?21 
 
 
 
进入:cloudfs_src目录 
输入:cd cloudfs/cloudfs_src/  
 
 
211_35615732_a40d9ea1ff02b2a.png?12 
 
 
 
输入:make pack 
211_35615732_63a1b222a9d1b05.png?18 
 
 
 
这样就安装完毕了 
 
 
接下来挂载OSS  bucke 
CentOS 6.5 或 Ubuntu 14.04 安装 挂载 
 
 
 
cloudfs 在 CentOS 6.5 和 Ubuntu 14.04发行版上已经有一键式的自动安装脚本,安装相对简单。 
cd pack/  
./CloudFS_Install.sh INSTALL_DIR=安装目录 MOUNT_POINT=挂载目录 按照命令行提示,即可完成安装。 (会有两个提示确定输入y回车就可以了) 
如下图: 
211_35615732_9d8ded0a4cafdab.png?14 
 
./CloudFS_Install.sh INSTALL_DIR=/usr/local/cloudfs_download MOUNT_POINT=/home/ftp/x/xj030/wwwroot 
命令说明: MOUNT_POINT=/home/ftp/x/xj030/wwwroot(/home/ftp/x/xj030/wwwroot这个是你网站的目录,比如附件目录什么的) 
211_35615732_4a74a522a65709c.png?8 
 
 
 
 
 
 
出现下图就说明安装完成了 
 
 
211_35615732_31d7576ccd59241.png?8 
 
 
 
接下来修改配置文件 
进入:cd /usr/local/cloudfs_download/conf 
修改目录下的cloudfs.con文件 
 
 

复制代码

  1. #This is the configuration for the OSS related
  2. [OSS Configuration]
  3. # OSS data center url configuration, uncomment the one your bucket resides on.
  4. # If you run cloudfs on aliyun ECS, then use the internal URL. Otherwise, use the public URL.
  5. # ECS
  6. #HOST=oss-cn-qingdao-internal.aliyuncs.com
  7. #HOST=oss-cn-beijing-internal.aliyuncs.com
  8. #HOST=oss-cn-shenzhen-internal.aliyuncs.com
  9. #HOST=oss-cn-hangzhou-internal.aliyuncs.com
  10. #HOST=oss-cn-hongkong-internal.aliyuncs.com
  11. # NOT ECS, but user's server
  12. #HOST=oss-cn-qingdao.aliyuncs.com
  13. #HOST=oss-cn-beijing.aliyuncs.com
  14. #HOST=oss-cn-shenzhen.aliyuncs.com
  15. #HOST=oss-cn-hangzhou.aliyuncs.com
  16. #HOST=oss-cn-hongkong.aliyuncs.com
  17.  
  18. # OSS Access Id and Access Key configuration, uncommet it and change the value
  19. # to your own id/key.
  20. #ID=your_access_id
  21. #KEY=your_access_key
  22.  
  23. # OSS bucket configuraion, uncommet it and change the value to you own bucket name
  24. #BUCKET=your_bucket_name
  25.  
  26. #this is the configuration for the FS related
  27. [FS Configuration]
  28. # The minimal sync interval from oss to cloudfs
  29. # This configuration is only needed when your system will directly
  30. # add/delete oss object from oss web control console or other system.
  31. # 0 means never sync object from oss to cloudfs after booting.
  32. # For most cases, the default value 0 is OK. If you are not sure, just make the default value 0 here.
  33. ONLINE_SYNC_CYCLE=3
  34.  
  35. # The file data cache block size when upload/download object from oss to cloudfs.
  36. # For most cases, the default value is OK.
  37. BLOCK_SIZE=1048576
  38.  
  39.  
  40. # The file data cache limit size when upload/download object from oss to cloudfs.
  41. # For most cases, the default value is OK.
  42. MAX_CACHE_LIMITS=10485760
  43.  
  44. # LOG output level
  45. # The debug.log file is under the cloudfs running directory.
  46. # When LOG_LEVEL is 1, only error log will output to debug.log file;
  47. # When LOG_LEVEL is 0, both debug and error log will output to debug.log file;
  48. LOG_LEVEL=1
  49.  
  50. # Postfix for soft link
  51. # OSS does not support unix style softlink file, so cloudfs uses a special postfix for softlink to identify
  52. # it is a soft link file.
  53. # Default value is "s1l2k3", you could change it as you wish.
  54. # But do keep in mind that this postfix should not conflict with any postfix in real world
  55. SYMLINK_POSTFIX=s1l2k3
  56.  
  57. # The parameter is used to control whether the system need to synchronize data from Aliyun OSS
  58. # when you access a file or dircetory.
  59. # When IMMEDIATE_SYNC=0, indicate no need to synchronize data;
  60. # When IMMEDIATE_SYNC=1, indicate need to synchronize data;
  61. # Default value is 0;
  62. IMMEDIATE_SYNC=1
  63.  
  64. # mode
  65. ACCESS_MODE=0666
  66.  
  67. # set the max number of upload threads,
  68. # default value is 1
  69. MAX_UPLOAD_THREADS=1

 
根据你的OSS地区去掉前面的#如: 
 
 

复制代码

  1. # ECS
  2. #HOST=oss-cn-qingdao-internal.aliyuncs.com
  3. #HOST=oss-cn-beijing-internal.aliyuncs.com
  4. #HOST=oss-cn-shenzhen-internal.aliyuncs.com
  5. HOST=oss-cn-hangzhou-internal.aliyuncs.com
  6. #HOST=oss-cn-hongkong-internal.aliyuncs.com
  7. # NOT ECS, but user's server
  8. #HOST=oss-cn-qingdao.aliyuncs.com
  9. #HOST=oss-cn-beijing.aliyuncs.com
  10. #HOST=oss-cn-shenzhen.aliyuncs.com
  11. HOST=oss-cn-hangzhou.aliyuncs.com
  12. #HOST=oss-cn-hongkong.aliyuncs.com
  13. # OSS Access Id and Access Key configuration, uncommet it and change the value

 
填写Access Key并去掉# 

复制代码

  1. # to your own id/key.
  2. ID=your_access_id(你的Access Key ID)
  3. KEY=your_access_key(你的Access Key Secret)
  4. [backcolor=#ffffff][color=#008ef1]# OSS bucket configuraion, uncommet it and change the value to you own bucket name[/color][/backcolor]
  5. BUCKET=your_bucket_name(你的OSS_bucket名称 )

 
启动CloudFS,执行命令: 
 
 
service cloudfs start 
 
 
停止CloudFS,执行命令: 
 
 
service cloudfs stop 
 
 
查看cloudfs运行状态,执行命令: 
 
 
service cloudfs status 
 
 
 
 
注意事项启动挂载的目录必须是空目录 
 
 
启动: 
211_35615732_a5940b0173ada44.png?26 
 
 
 
这样说明已经将OSS挂载到ECS了。。。。。。。 
 

转载于:https://my.oschina.net/vshcxl/blog/1571183

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值