1 Star 0 Fork 38

hornsey / JuiceFS

forked from Juicedata / JuiceFS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
s3_gateway.md 2.92 KB
一键复制 编辑 原始数据 按行查看 历史
Changjian Gao 提交于 2021-02-26 16:05 . Add S3 gateway doc (#203)

S3 Gateway

JuiceFS S3 Gateway is a service which provides S3-compatible interface. It means you could interact with JuiceFS by existing tools, e.g. AWS CLI, s3cmd, MinIO client (mc). The JuiceFS S3 Gateway is based on MinIO S3 Gateway.

Prerequisites

Before running the gateway, you need first formatting a volume. Please follow the steps in README.

JuiceFS S3 Gateway is a feature introduced in v0.11.0, please ensure you have latest version of JuiceFS.

Quickstart

Use juicefs gateway command to run the gateway, most options of this command are same as juicefs mount, except following options:

--access-log value  path for JuiceFS access log
--no-banner         disable MinIO startup information (default: false)

The --access-log option controls where to store access log of JuiceFS. By default access log will not be stored. The --no-banner option controls if disable logs from MinIO.

MinIO S3 Gateway requires two environment variables been configured before startup: MINIO_ROOT_USER and MINIO_ROOT_PASSWORD. You can set them with any value, but must meet the length requirements. MINIO_ROOT_USER length should be at least 3, and MINIO_ROOT_PASSWORD length at least 8 characters.

The following command shows how to run a gateway. The Redis address is localhost:6379, and the gateway is listening on localhost:9000.

$ export MINIO_ROOT_USER=admin
$ export MINIO_ROOT_PASSWORD=12345678
$ juicefs gateway redis://localhost:6379 localhost:9000

If the gateway is running successfully, you could visit http://localhost:9000 in the browser:

MinIO browser

Use AWS CLI

Install AWS CLI from https://aws.amazon.com/cli. Then you need configure it:

$ aws configure
AWS Access Key ID [None]: admin
AWS Secret Access Key [None]: 12345678
Default region name [None]:
Default output format [None]:

The Access Key ID is same as MINIO_ROOT_USER, and Secret Access Key is same as MINIO_ROOT_PASSWORD. Region name and output format could be empty.

After that, you could use aws s3 command to access the gateway, for example:

# List buckets
$ aws --endpoint-url http://localhost:9000 s3 ls

# List objects in bucket
$ aws --endpoint-url http://localhost:9000 s3 ls s3://<bucket>

Use MinIO Client

Install MinIO client from https://docs.min.io/docs/minio-client-complete-guide.html. Then add a new host called juicefs:

$ mc alias set juicefs http://localhost:9000 admin 12345678 --api S3v4

After that, you could use mc command to access the gateway, for example:

# List buckets
$ mc ls juicefs

# List objects in bucket
$ mc ls juicefs/<bucket>
1
https://gitee.com/hornsey/JuiceFS.git
git@gitee.com:hornsey/JuiceFS.git
hornsey
JuiceFS
JuiceFS
main

搜索帮助