README.md 11.8 KB
Newer Older
1
<p align="center"><a href="https://github.com/juicedata/juicefs"><img alt="JuiceFS Logo" src="docs/images/juicefs-logo.png" width="50%" /></a></p>
D
Davies Liu 已提交
2 3
<p align="center">
    <a href="https://travis-ci.com/juicedata/juicefs"><img alt="Build Status" src="https://travis-ci.com/juicedata/juicefs.svg?token=jKSPwswpc2ph4uMtwpHa&branch=main" /></a>
4
    <a href="https://join.slack.com/t/juicefs/shared_invite/zt-n9h5qdxh-0bJojPaql8cfFgwerDQJgA"><img alt="Join Slack" src="https://badgen.net/badge/Slack/Join%20JuiceFS/0abd59?icon=slack" /></a>
5
    <a href="https://goreportcard.com/report/github.com/juicedata/juicefs"><img alt="Go Report" src="https://goreportcard.com/badge/github.com/juicedata/juicefs" /></a>
6
    <a href="README_CN.md"><img alt="Chinese Docs" src="https://img.shields.io/badge/docs-%E4%B8%AD%E6%96%87-informational" /></a>
D
Davies Liu 已提交
7 8 9 10 11 12
</p>

**JuiceFS** is an open-source POSIX file system built on top of [Redis](https://redis.io) and object storage (e.g. Amazon S3), designed and optimized for cloud native environment. By using the widely adopted Redis and S3 as the persistent storage, JuiceFS serves as a stateless middleware to enable many applications to share data easily.

The highlighted features are:

Z
ZhaoXinlong 已提交
13
- **Fully POSIX-compatible**: JuiceFS is a fully POSIX-compatible file system. Existing applications can work with it without any change. See [pjdfstest result](#posix-compatibility) below.
14 15
- **Fully Hadoop-compatible**: JuiceFS [Hadoop Java SDK](docs/en/hadoop_java_sdk.md) is compatible with Hadoop 2.x and Hadoop 3.x. As well as variety of components in Hadoop ecosystem.
- **S3-compatible**: JuiceFS [S3 Gateway](docs/en/s3_gateway.md) provides S3-compatible interface.
D
Davies Liu 已提交
16
- **Outstanding Performance**: The latency can be as low as a few milliseconds and the throughput can be expanded to nearly unlimited. See [benchmark result](#performance-benchmark) below.
17
- **Cloud Native**: JuiceFS provides [Kubernetes CSI driver](docs/en/how_to_use_on_kubernetes.md) to help people who want to use JuiceFS in Kubernetes.
18
- **Sharing**: JuiceFS is a shared file storage that can be read and written by thousands clients.
19 20 21

In addition, there are some other features:

D
Davies Liu 已提交
22
- **Global File Locks**: JuiceFS supports both BSD locks (flock) and POSIX record locks (fcntl).
23
- **Data Compression**: JuiceFS supports use [LZ4](https://lz4.github.io/lz4) or [Zstandard](https://facebook.github.io/zstd) to compress all your data.
24
- **Data Encryption**: JuiceFS supports data encryption in transit and at rest, read [the guide](docs/en/encrypt.md) for more information.
D
Davies Liu 已提交
25 26 27

---

28
[Architecture](#architecture) | [Getting Started](#getting-started) | [Administration](#administration) | [POSIX Compatibility](#posix-compatibility) | [Performance Benchmark](#performance-benchmark) | [Supported Object Storage](#supported-object-storage) | [Status](#status) | [Roadmap](#roadmap) | [Reporting Issues](#reporting-issues) | [Contributing](#contributing) | [Community](#community) | [Usage Tracking](#usage-tracking) | [License](#license) | [Credits](#credits) | [FAQ](#faq)
D
Davies Liu 已提交
29 30 31 32 33 34 35

---

## Architecture

![JuiceFS Architecture](docs/images/juicefs-arch.png)

Z
ZhaoXinlong 已提交
36
JuiceFS relies on Redis to store file system metadata. Redis is a fast, open-source, in-memory key-value data store and very suitable for storing the metadata. All the data will store into object storage through JuiceFS client.
D
Davies Liu 已提交
37 38 39

![JuiceFS Storage Format](docs/images/juicefs-storage-format.png)

Z
ZhaoXinlong 已提交
40
The storage format of one file in JuiceFS consists of three levels. The first level called **"Chunk"**. Each chunk has fixed size, currently it is 64MiB and cannot be changed. The second level called **"Slice"**. The slice size is variable. A chunk may have multiple slices. The third level called **"Block"**. Like chunk, its size is fixed. By default one block is 4MiB and you could modify it when formatting a volume (see following section). At last, the block will be compressed and encrypted (optional) store into object storage.
D
Davies Liu 已提交
41 42 43 44 45 46 47 48 49

## Getting Started

### Precompiled binaries

You can download precompiled binaries from [releases page](https://github.com/juicedata/juicefs/releases).

### Building from source

50
You need first installing [Go](https://golang.org) 1.14+ and GCC 5.4+, then run following commands:
D
Davies Liu 已提交
51 52

```bash
D
Davies Liu 已提交
53
$ git clone https://github.com/juicedata/juicefs.git
X
Xie Yanbo 已提交
54
$ cd juicefs
D
Davies Liu 已提交
55 56 57 58 59
$ make
```

### Dependency

60
A Redis server (>= 2.8) is needed for metadata, please follow [Redis Quick Start](https://redis.io/topics/quickstart).
D
Davies Liu 已提交
61

62
[macFUSE](https://osxfuse.github.io) is also needed for macOS.
D
Davies Liu 已提交
63 64 65 66 67 68 69 70 71 72 73

The last one you need is object storage. There are many options for object storage, local disk is the easiest one to get started.

### Format a volume

Assume you have a Redis server running locally, we can create a volume called `test` using it to store metadata:

```bash
$ ./juicefs format localhost test
```

B
baishen 已提交
74
It will create a volume with default settings. If there Redis server is not running locally, the address could be specified using URL, for example, `redis://user:password@host:6379/1`, the password can also be specified by environment variable `REDIS_PASSWORD` to hide it from command line options.
D
Davies Liu 已提交
75

76
As JuiceFS relies on object storage to store data, you can specify a object storage using `--storage`, `--bucket`, `--access-key` and `--secret-key`. By default, it uses a local directory to serve as an object store, for all the options, please see `./juicefs format -h`.
D
Davies Liu 已提交
77

78
For the details about how to setup different object storage, please read [the guide](docs/en/how_to_setup_object_storage.md).
D
Davies Liu 已提交
79

D
Davies Liu 已提交
80 81
### Mount a volume

B
baishen 已提交
82
Once a volume is formatted, you can mount it to a directory, which is called *mount point*.
D
Davies Liu 已提交
83 84 85 86 87 88 89 90 91

```bash
$ ./juicefs mount -d localhost ~/jfs
```

After that you can access the volume just like a local directory.

To get all options, just run `./juicefs mount -h`.

92
If you wanna mount JuiceFS automatically at boot, please read [the guide](docs/en/mount_at_boot.md).
93

S
Suave Su 已提交
94 95
### Command Reference

96
There is a [command reference](docs/en/command_reference.md) to see all options of the subcommand.
S
Suave Su 已提交
97

D
Davies Liu 已提交
98 99
### Kubernetes

100
[Using JuiceFS on Kubernetes](docs/en/how_to_use_on_kubernetes.md) is so easy, have a try.
D
Davies Liu 已提交
101

102 103 104 105
### Hadoop Java SDK

If you wanna use JuiceFS in Hadoop, check [Hadoop Java SDK](docs/en/hadoop_java_sdk.md).

106 107
## Administration

108 109 110
- [Redis Best Practices](docs/en/redis_best_practices.md)
- [Mount JuiceFS at Boot](docs/en/mount_at_boot.md)
- [How to Setup Object Storage](docs/en/how_to_setup_object_storage.md)
C
Changjian Gao 已提交
111
- [Cache Management](docs/en/cache_management.md)
112
- [Fault Diagnosis and Analysis](docs/en/fault_diagnosis_and_analysis.md)
C
Changjian Gao 已提交
113
- [S3 Gateway](docs/en/s3_gateway.md)
114
- [FUSE Mount Options](docs/en/fuse_mount_options.md)
115 116
- [Using JuiceFS on Kubernetes](docs/en/how_to_use_on_kubernetes.md)
- [Using JuiceFS on Windows](docs/en/windows.md)
117

D
Davies Liu 已提交
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
## POSIX Compatibility

JuiceFS passed all of the 8813 tests in latest [pjdfstest](https://github.com/pjd/pjdfstest).

```
All tests successful.

Test Summary Report
-------------------
/root/soft/pjdfstest/tests/chown/00.t          (Wstat: 0 Tests: 1323 Failed: 0)
  TODO passed:   693, 697, 708-709, 714-715, 729, 733
Files=235, Tests=8813, 233 wallclock secs ( 2.77 usr  0.38 sys +  2.57 cusr  3.93 csys =  9.65 CPU)
Result: PASS
```

C
Changjian Gao 已提交
133
Besides the things covered by pjdfstest, JuiceFS provides:
134

C
Changjian Gao 已提交
135
- Close-to-open consistency. Once a file is closed, the following open and read can see the data written before close. Within same mount point, read can see all data written before it.
136 137
- Rename and all other metadata operations are atomic guaranteed by Redis transaction.
- Open files remain accessible after unlink from same mount point.
C
Changjian Gao 已提交
138
- Mmap is supported (tested with FSx).
139 140
- Fallocate with punch hole support.
- Extended attributes (xattr).
C
Changjian Gao 已提交
141 142
- BSD locks (flock).
- POSIX record locks (fcntl).
143

D
Davies Liu 已提交
144 145 146 147 148 149 150 151
## Performance Benchmark

### Throughput

Performed a sequential read/write benchmark on JuiceFS, [EFS](https://aws.amazon.com/efs) and [S3FS](https://github.com/s3fs-fuse/s3fs-fuse) by [fio](https://github.com/axboe/fio), here is the result:

![Sequential Read Write Benchmark](docs/images/sequential-read-write-benchmark.svg)

152
It shows JuiceFS can provide 10X more throughput than the other two, read [more details](docs/en/fio.md).
D
Davies Liu 已提交
153 154 155 156 157 158 159

### Metadata IOPS

Performed a simple mdtest benchmark on JuiceFS, [EFS](https://aws.amazon.com/efs) and [S3FS](https://github.com/s3fs-fuse/s3fs-fuse) by [mdtest](https://github.com/hpc/ior), here is the result:

![Metadata Benchmark](docs/images/metadata-benchmark.svg)

160
It shows JuiceFS can provide significantly more metadata IOPS than the other two, read [more details](docs/en/mdtest.md).
D
Davies Liu 已提交
161

162 163 164 165 166 167 168 169 170 171 172
### Analyze performance

There is a virtual file called `.accesslog` in the root of JuiceFS to show all the operations and the time they takes, for example:

```bash
$ cat /jfs/.accesslog
2021.01.15 08:26:11.003330 [uid:0,gid:0,pid:4403] write (17669,8666,4993160): OK <0.000010>
2021.01.15 08:26:11.003473 [uid:0,gid:0,pid:4403] write (17675,198,997439): OK <0.000014>
2021.01.15 08:26:11.003616 [uid:0,gid:0,pid:4403] write (17666,390,951582): OK <0.000006>
```

173
The last number on each line is the time (in seconds) current operation takes. You can use this to debug and analyze performance issues. We will provide more tools to analyze it.
174

D
Davies Liu 已提交
175 176 177 178 179 180 181
## Supported Object Storage

- Amazon S3
- Google Cloud Storage
- Azure Blob Storage
- Alibaba Cloud Object Storage Service (OSS)
- Tencent Cloud Object Storage (COS)
182
- QingStor Object Storage
D
Davies Liu 已提交
183 184 185 186 187
- Ceph RGW
- MinIO
- Local disk
- Redis

188
For the detailed list, see [this document](docs/en/how_to_setup_object_storage.md#supported-object-storage).
D
Davies Liu 已提交
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208

## Status

It's considered as beta quality, the storage format is not stabilized yet. It's not recommended to deploy it into production environment. Please test it with your use cases and give us feedback.

## Roadmap

- Stabilize storage format
- Other databases for metadata

## Reporting Issues

We use [GitHub Issues](https://github.com/juicedata/juicefs/issues) to track community reported issues. You can also [contact](#community) the community for getting answers.

## Contributing

Thank you for your contribution! Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) for more information.

## Community

209
Welcome to join the [Discussions](https://github.com/juicedata/juicefs/discussions) and the [Slack channel](https://join.slack.com/t/juicefs/shared_invite/zt-n9h5qdxh-0bJojPaql8cfFgwerDQJgA) to connect with JuiceFS team members and other users.
D
Davies Liu 已提交
210 211 212

## Usage Tracking

D
Davies Liu 已提交
213
JuiceFS by default collects **anonymous** usage data. It only collects core metrics (e.g. version number), no user or any sensitive data will be collected. You could review related code [here](pkg/usage/usage.go).
D
Davies Liu 已提交
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232

These data help us understand how the community is using this project. You could disable reporting easily by command line option `--no-usage-report`:

```bash
$ ./juicefs mount --no-usage-report
```

## License

JuiceFS is open-sourced under GNU AGPL v3.0, see [LICENSE](LICENSE).

## Credits

The design of JuiceFS was inspired by [Google File System](https://research.google/pubs/pub51), [HDFS](https://hadoop.apache.org) and [MooseFS](https://moosefs.com), thanks to their great work.

## FAQ

### Why doesn't JuiceFS support XXX object storage?

C
Changjian Gao 已提交
233
JuiceFS already supported many object storage, please check [the list](docs/en/how_to_setup_object_storage.md#supported-object-storage) first. If this object storage is compatible with S3, you could treat it as S3. Otherwise, try reporting issue.
D
Davies Liu 已提交
234 235 236

### Can I use Redis cluster?

D
Davies Liu 已提交
237
The simple answer is no. JuiceFS uses [transaction](https://redis.io/topics/transactions) to guarantee the atomicity of metadata operations, which is not well supported in cluster mode. Sentinal or other HA solution for Redis are needed.
C
Changjian Gao 已提交
238

C
Changjian Gao 已提交
239 240
See ["Redis Best Practices"](docs/en/redis_best_practices.md) for more information.

C
Changjian Gao 已提交
241 242 243
### What's the difference between JuiceFS and XXX?

See ["Comparison with Others"](docs/en/comparison_with_others.md) for more information.
C
Changjian Gao 已提交
244 245

For more FAQs, please see the [full list](docs/en/faq.md).