AWS S3FS如何 [英] AWS S3FS How to

查看:211
本文介绍了AWS S3FS如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是当前情况-

Here's the current scenario -

我有多个S3存储桶,其中具有SQS事件,这些事件已配置为使用FTP通过S3FS配置的来自FTP的对象的PUT.

I have multiple S3 Buckets, which have SQS events configured for PUTs of Objects from a FTP, which I have configured using S3FS.

此外,我在EC2上具有多个目录,用户可以在该目录上放置一个对象,该对象与不同的S3存储桶(使用S3FS)同步,从而生成SQS事件(使用S3的SQS事件).

Also, I have multiple Directories on an EC2, on which a User can PUT an object, which gets synced with the different S3 buckets (using S3FS), which generate SQS events(using S3's SQS events).

这是我需要实现的,

我需要整合多个文件夹级别的逻辑,而不是多个S3存储桶
IE.现在,我为之前创建的每个存储桶创建了不同的文件夹,并为各个文件夹中的PUT创建了单独的SQS事件.

Instead of Multiple S3 buckets, I need to consolidate the logic on Folder level,
ie. I have now created Different Folders for each Bucket that I had created previously, I have created separate SQS events for PUT in individual Folders.

现在,在S3FS的存储桶级逻辑中,我想调整单个S3存储桶中的文件夹级.

Now the Bucket level logic of S3FS, I want to tweak for Folder level in a Single S3 bucket.

即.我想在EC2上创建3个不同的目录,例如A,B,C.
如果我将一个对象放在EC2的目录A中,则该对象必须与S3存储桶中的文件夹A同步
对于S3的目录B和文件夹B以及EC2上的目录C和S3上的文件夹C同样.

ie. I want to create 3 different Directories oon the EC2, eg A,B,C.
If I PUT an object in Directory A of the EC2, the object must get synced with Folder A in the S3 bucket,
Similarly for Directory B and folder B of S3 and Directory C on EC2 and Folder C on the S3.

这是我创建的安装S3FS的步骤-
步骤-

Here are the steps I created for installing S3FS -
Steps -

  1. ssh进入EC2

  1. ssh into the EC2

sudo apt-get install automake autotools-dev g ++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

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

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

cd s3fs-fuse

cd s3fs-fuse

./autogen.sh

./autogen.sh

./configure

./configure

制作

sudo make install

sudo make install

将S3存储桶安装到文件系统

  1. 回显 access-key-id:secret-access-key >/etc/passwd-s3fs

  1. echo access-key-id:secret-access-key > /etc/passwd-s3fs

chmod 600/etc/passwd-s3fs

chmod 600 /etc/passwd-s3fs

mkdir/mnt/存储区名称

mkdir /mnt/bucketname

echo s3fs#存储桶名称/mnt/存储桶名称保险丝_netdev,rw,nosuid,nodev,allow_other 0 0 >>/etc/fstab

echo s3fs#bucketname /mnt/bucketname fuse _netdev,rw,nosuid,nodev,allow_other 0 0 >> /etc/fstab

挂载-a

现在,这些步骤可实现EC2上的特定目录和S3存储桶之间的同步,
如何调整此设置,以使EC2上的2个不同目录与S3上的2个不同文件夹同步.
我是Linux和AWS新手,请帮帮我.

Now these steps achieve sync between a particular Directory on the EC2 and the S3 bucket,
How do I tweak this to sync say 2 different Directories on the EC2 with 2 different Folders on the S3.
I am a Linux and AWS newbie, Please help me out.

推荐答案

请勿将S3存储桶安装到文件系统.使用AWS S3 CLI和Cron将EC2目录与S3存储桶目录同步.

Do not mount the S3 bucket to the file system. Use AWS S3 CLI and Cron to Sync the EC2 Directory with the S3 Bucket Directory.

  1. 在EC2实例上安装S3CMD( http://tecadmin.net/install-s3cmd-manage-amazon-s3-buckets/#)
  2. 开始一项cron作业,以实现与本地目录和S3 Bucket子文件夹的同步.

创建一个脚本文件,例如"script.sh"

Create a Script File for example "script.sh"

#/bin/bash
aws s3 sync /path/to/folder/A s3://mybucket/FolderA
aws s3 sync /path/to/folder/B s3://mybucket/FolderB
aws s3 sync /path/to/folder/C s3://mybucket/FolderC

为这样的事情开始cron作业:

Start a cron job for some thing like this:

* * * * * /root/scripts/script.sh

您将实现用例.

这篇关于AWS S3FS如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆