zoukankan      html  css  js  c++  java
  • fuse--s3挂载到centos7.5服务器

    需将s3 bucket 挂载到本地centos7服务器,用作附件或备份存储。

    授权

    在aws上创建 s3 bucket的IAM用户,并添加读写权限。在此获取 Access Key ID 与 Secret Access Key。

    安装依赖包

    yum install fuse.x86_64 fuse-devel.x86_64 fuse-libs.x86_64 libconfuse-devel.x86_64 libconfuse.x86_64 -y
    yum install gcc-c++.noarch -y
    yum install curl.x86_64 libcurl-devel.x86_64 libcurl.x86_64 -y
    yum install libxml2.x86_64 libxml2-devel.x86_64 openssl-devel.x86_64 -y
    

    安装s3fs-fuse

    cd /usr/local/
    git clone https://github.com/s3fs-fuse/s3fs-fuse.git
    cd s3fs-fuse/
    ./autogen.sh 
    ./configure
    make
    make install
    

    以下命令输出代表安装成功

    [root@one s3test]# /usr/local/bin/s3fs 
    s3fs: missing BUCKET argument.
    Usage: s3fs BUCKET:[PATH] MOUNTPOINT [OPTION]...
    

    添加Access Key ID 与 Secret Access Key

    vim ~/.passwd-s3fs
    格式为  Access Key ID:Secret Access Key
    chmod 600  ~/.passwd-s3fs   
    

    挂载:

     mkdir /mnt/s3bucket
     /usr/local/bin/s3fs -o passwd_file=~/.passwd-s3fs -o url=https://s3.cn-northwest-1.amazonaws.com.cn -o allow_other my-buckentname /mnt/s3bucket/ -o use_cache=/tmp
    

    此处会有报错 libcurl版本低的问题

    更新curl版本

    见:https://www.htcp.net/337.html
    步骤为:

    cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.bak
    curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
    
    vim /etc/yum.repos.d/city-fan-for-curl.repo
    [CityFanforCurl]
    name=City Fan Repo
    baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
    enabled=0
    gpgcheck=0
    
    yum update curl --enablerepo=CityFanforCurl -y
    

    重新挂载

    /usr/local/bin/s3fs -o passwd_file=~/.passwd-s3fs -o url=https://s3.cn-northwest-1.amazonaws.com.cn -o allow_other my-buckentname /mnt/s3bucket/ -o use_cache=/tmp
    df -h  #查看挂载是否成功
    

    注:若挂载未成功,可在挂载命令添加-d -d -f -o f2 -o curldbg ,输出日志查看问题
    注意以上命令中,它实际访问的链接是https://my-buckentname.s3.cn-northwest-1.amazonaws.com.cn;
    若要它的访问链接完全等于url中的链接,可加上 -o use_path_request_style

    /usr/local/bin/s3fs -o passwd_file=~/.passwd-s3fs -o use_path_request_style  -o url=http://minio-s3.test.net:3000  -o allow_other my-buckentname /mnt/s3bucket/
  • 相关阅读:
    Microsoft Visio 2013 简体中文版
    visio2013产品密钥激活
    WebConfigurationManager和ConfigurationManager区别
    错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
    Windows10安装oracle 19c数据库+PLsql详细安装过程
    js 三个input输入框,组合查询。
    Vue.js组件教程 https://www.jb51.net/Special/926.htm
    LeetCode刷题之路
    涉猎---Java多线程
    深信服翔鹰计划线上笔试考察点总结(路由,虚拟架构,IPV4,Tcp/IP......)
  • 原文地址:https://www.cnblogs.com/huandada/p/12411623.html
Copyright © 2011-2022 走看看