Mount the S3 bucket to the Linux directory using S3FS

Source: Internet
Author: User
Tags git clone

S3fs is a fuse-based file system that allows Linux and Mac Os x to mount S3 buckets in the local filesystem, s3fs able to preserve the original format of the object. About S3fs-fuse function, how to use, download can refer to:https://github.com/s3fs-fuse/s3fs-fuse

1, this article mainly introduces the S3 bucket mounted to the Linux directory, as a local disk use. So the first thing to do is to create S3 buckets, for example:
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8C/EF/wKioL1h-_oCDJXN3AAA2GYI3WgA338.png "title=" screen shot 2017-01-18 12.20.49.png "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:250PX;HEIGHT:33PX; "alt = "Wkiol1h-_ocdjxn3aaa2gyi3wga338.png"/>


2. To mount the S3 bucket to a local directory requires access to the S3 bucket, so the next step is to prepare the IAM user's access key ID and access key. Note: the "Key ID" and "key" (private key) are created when the "Create access key" button is clicked, but the key is only displayed once at the time of creation and cannot be reproduced later, so this is also the only chance to download or save the key. As shown in the following:
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8C/F2/wKiom1h-_qThV4GSAAF-RQB3BGA932.png "title=" screen shot 2017-01-18 12.26.26.png "width=" "height=" 182 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:182px; " alt= "Wkiom1h-_qthv4gsaaf-rqb3bga932.png"/>


3, the key ID and key to save as a key file, the file format must be:

IAM user access key Id:iam user access key

And the file permission must be 600

As shown in the following:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8C/EF/wKioL1h-_jniOgM-AABqGrlcAQo653.png "title=" screen shot 2017-01-18 12.13.04.png "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:400PX;HEIGHT:56PX; "alt = "Wkiol1h-_jniogm-aabqgrlcaqo653.png"/>


4. Press down to install S3fs-fuse:

1) Download, compile, install

Yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make Openssl-devel

git clone https://github.com/s3fs-fuse/s3fs-fuse.git

CD S3fs-fuse

./autogen.sh

./configure

Make

Make install

As shown in the following:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8C/EF/wKioL1h-__PyHZKUAAT3QUhfKAI871.png "title=" screen shot 2017-01-18 12.12.04.png "width=" "height=" 615 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:615px; " alt= "Wkiol1h-__pyhzkuaat3quhfkai871.png"/>

2) Verify that the installation is successful

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8C/EF/wKioL1h_AG2xAL0XAADznsaKBIw796.png "title=" screen shot 2017-01-18 12.12.34.png "width=" "height=" 119 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:500PX;HEIGHT:119PX; " alt= "Wkiol1h_ag2xal0xaadznsakbiw796.png"/>


5. Finally realize hand-mounted S3 bucket

S3fs BUCKET mountpoint [OPTION]

S3fs yeecall-s3fs-mount-bucket/new/-o passwd_file=./test-o endpoint=ap-northeast-1

As shown in the following:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/8C/EF/wKioL1h_ARLAzeGgAAI7T9gdY4Q387.png "title=" screen shot 2017-01-18 12.13.15.png "width=" height= "236" border= "0" hspace= "0" vspace= "0" style= "WIDTH:750PX;HEIGHT:236PX;" alt= "Wkiol1h_arlazeggaai7t9gdy4q387.png"/>


6, finally can put the relevant parameters into the fstab, to achieve automatic mounting

S3fs#mybucket/path/to/mountpoint Fuse _netdev,allow_other 0 0ormybucket/path/to/mountpoint fuse.s3fs _netdev,allow_ Other 0 0

You can also store the key ID and key in the global default key file:

echo myidentity:mycredential >/etc/passwd-s3fschmod 600/etc/passwd-s3fs


7, can be S3FS related process kill, in order to achieve the purpose of unloading

This article is from the "Worknote" blog, make sure to keep this source http://caiyuanji.blog.51cto.com/11462293/1892856

Mount the S3 bucket to the Linux directory using S3FS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.