• Stars
    star
    356
  • Rank 119,446 (Top 3 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A distributed POSIX filesystem based on TiKV, with partition tolerance and strict consistency.

TiFS

A distributed POSIX filesystem based on TiKV, with partition tolerance and strict consistency.

pjdfstest

Environment

Build

  • Linux libfuse and build-essential are required, in ubuntu/debian:
sudo apt install -y libfuse-dev libfuse3-dev build-essential
  • macOS
brew install --cask osxfuse

Runtime

  • Linux fuse3 and openssl are required, in ubuntu/debian:
sudo apt-get install -y libfuse3-dev fuse3 libssl-dev
  • macOS
brew install --cask osxfuse

In Catalina or former version, you need to load osxfuse into the kernel:

/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse

Installation

Container

You can use the image on docker hub or build from the Dockerfile.

Binary(linux-amd64 or darwin-amd64)

mkdir tmp
cd tmp
wget https://github.com/Hexilee/tifs/releases/download/v0.2.1/tifs-linux-amd64.tar.gz
tar -xvf tifs-linux-amd64.tar.gz
sudo ./install.sh

The install.sh may fail in macOS Catalina or Big Sur because of the SIP.

You can just use the target/release/tifs to mount tifs.

Example

target/release/tifs tifs:127.0.0.1:2379 ~/mnt

Source code

git clone https://github.com/Hexilee/tifs.git
cd tifs
sudo make install

Usage

You need a tikv cluster to run tifs. tiup is convenient to deploy one, just install it and run tiup playground.

Container

docker run -d --device /dev/fuse \
    --cap-add SYS_ADMIN \
    -v <mount point>:/mnt:shared \
    hexilee/tifs:0.2.2 --mount-point /mnt --pd-endpoints <endpoints>

TLS

You need ca.crt, client.crt and client.key to access TiKV cluster on TLS.

It will be convenient to get self-signed certificates by sign-cert.sh(based on the easy-rsa).

You should place them into a directory and execute following docker command.

docker run -d --device /dev/fuse \
    --cap-add SYS_ADMIN \
    -v <cert dir>:/root/.tifs/tls \
    -v <mount point>:/mnt:shared \
    hexilee/tifs:0.3.1 --mount-point /mnt --pd-endpoints <endpoints>

Binary

mkdir <mount point>
mount -t tifs tifs:<pd endpoints> <mount point>

TLS

mount -t tifs -o tls=<tls config file> tifs:<pd endpoints> <mount point>

By default, the tls-config should be located in ~/.tifs/tls.toml, refer to the tls.toml for detailed configuration.

Other Custom Mount Options

direct_io

Enable global direct io, to avoid page cache.

mount -t tifs -o direct_io tifs:<pd endpoints> <mount point>

blksize

The block size, 64KiB by default, could be human-readable.

mount -t tifs -o blksize=512 tifs:<pd endpoints> <mount point>

maxsize

The quota of fs capacity, could be human-readable.

mount -t tifs -o maxsize=1GiB tifs:<pd endpoints> <mount point>

Development

cargo build
mkdir ~/mnt
RUST_LOG=debug target/debug/tifs --mount-point ~/mnt

Then you can open another shell and play with tifs in ~/mnt.

Maybe you should enable user_allow_other in /etc/fuse.conf.

for developing under FreeBSD, make sure the following dependencies are met.

pkg install llvm protobuf pkgconf fusefs-libs3 cmake

for now, user_allow_other and auto unmount does not work for FreeBSD, using as root and manually umount is needed.

Contribution

Design

Please refer to the design.md

FUSE

There are little docs about FUSE, refer to the example for the meaning of FUSE API.

Deploy TiKV

Please refer to the tikv-deploy.md.

TODO

  • FUSE API

    • init
    • lookup
    • getattr
    • setattr
    • readlink
    • readdir
    • open
    • release
    • read
    • write
    • mkdir
    • rmdir
    • mknod
    • lseek
    • unlink
    • symlink
    • rename
    • link
    • statfs
    • create
    • fallocate
    • getlk
    • setlk
  • Testing and Benchmarking

    • pjdfstest
    • fio
  • Real-world usage

    • vim
    • emacs
    • git
    • gcc
    • rustc
    • cargo build
    • npm install
    • sqlite
    • tikv on tifs
    • client runs on FreeBSD: simple case works

More Repositories

1

async-io-demo

demo for rust asynchronous io: from mio to stackless coroutine
Rust
348
star
2

roa

async web framework inspired by koajs, lightweight but powerful.
Rust
251
star
3

unhtml.rs

A magic html parser
Rust
194
star
4

unhtml

HTML unmarshaler for golang
Go
55
star
5

async-postgres

A runtime-independent asynchronus PostgreSQL client
Rust
32
star
6

htest

htest is a http-test package
Go
24
star
7

BronzeDB

kv database built in rust
Rust
7
star
8

my_spider

็ˆฌๆบ็จ‹้…’ๅบ—่ฏ„่ฎบ
Python
6
star
9

modern-memory-management

no new, no delete, compare modern memory management in cpp with that in rust programming language.
C++
6
star
10

gotten

A powerful web SDK builder for go, like retrofit for java
Go
5
star
11

rover

A toy web browser
Rust
3
star
12

interfacer-http

A magic http client, like retrofit in Java
Rust
3
star
13

RFC-HTTP_1.1-zh

HTTP 1.1 RFC๏ผˆ RFC-7230 ~ RFC-7235 ๏ผ‰็š„ไธญๆ–‡็ฟป่ฏ‘
2
star
14

iobench

io/network benchmark comparison between different languages in different cases
Go
2
star
15

async-block-send

This repo aims to summarize and explain rust-lang/rust#64477 and rust-lang/rust#64856.
1
star
16

silver-io

An asynchronous IO library inspired by Future and Tokio of Rust community.
C++
1
star
17

cobra-example

An example to get cobra works.
Go
1
star
18

sgrep

Search words in everything
Rust
1
star
19

fictions

fictions written by my little pussy
1
star
20

hexilee.github.io

My website
HTML
1
star
21

tracing

non-invasive tracing for Golang
1
star
22

order-dishes

ไปŠๅคฉๅƒ็‚นๅ•ฅ
JavaScript
1
star