# Format JuiceFS file system
> juicefs format redis://your-redis-host:6379/1 myjfs
# Mount JuiceFS file system
> juicefs mount -d redis://your-redis-host:6379/1 /mnt/juicefs
# Check mount point status
> df -h /mnt/juicefs
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
JuiceFS:myjfs 1.0Pi 0Bi 1.0Pi 0% 0 10485760 0% /mnt/juicefs
# Copy dataset from home to JuiceFS
> cp -r ~/dataset /mnt/juicefs/
# Python example.py
path = '/mnt/juicefs/dataset/days.txt'
days_file = open(path, 'r')
days = days_file.read()
new_path = '/mnt/juicefs/new_days.txt'
new_days = open(new_path, 'w')
title = 'Days of the Week\n'
new_days.write(title)
print(title)
new_days.write(days)
print(days)
days_file.close()
new_days.close()
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: web-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Pi
storageClassName: juicefs-sc
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-run
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: linuxserver/nginx
ports:
- containerPort: 80
volumeMounts:
- mountPath: /config
name: web-data
volumes:
- name: web-data
persistentVolumeClaim:
claimName: web-pvc
> kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
juicefs-sc csi.juicefs.com Retain Immediate false 88m
# Shell
> hadoop fs -ls jfs://myjfs
# Hive
CREATE TABLE IF NOT EXISTS person
(
name STRING,
age INT
) LOCATION 'jfs://myjfs/tmp/person';
# Start S3 Gateway for JuiceFS file system
> juicefs gateway redis://localhost:6379/1 localhost:9000
# Access JuiceFS file system via AWS CLI
> aws --endpoint-url http://localhost:9000 s3 ls s3://myjfs
一套 JuiceFS 满足不同的使用场景。
# Format JuiceFS file system
> juicefs format redis://your-redis-host:6379/1 myjfs
# Mount JuiceFS file system
> juicefs mount -d redis://your-redis-host:6379/1 /mnt/juicefs
# Check mount point status
> df -h /mnt/juicefs
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
JuiceFS:myjfs 1.0Pi 0Bi 1.0Pi 0% 0 10485760 0% /mnt/juicefs
# Copy dataset from home to JuiceFS
> cp -r ~/dataset /mnt/juicefs/
# Python example.py
path = '/mnt/juicefs/dataset/days.txt'
days_file = open(path, 'r')
days = days_file.read()
new_path = '/mnt/juicefs/new_days.txt'
new_days = open(new_path, 'w')
title = 'Days of the Week\n'
new_days.write(title)
print(title)
new_days.write(days)
print(days)
days_file.close()
new_days.close()
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: web-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Pi
storageClassName: juicefs-sc
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-run
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: linuxserver/nginx
ports:
- containerPort: 80
volumeMounts:
- mountPath: /config
name: web-data
volumes:
- name: web-data
persistentVolumeClaim:
claimName: web-pvc
> kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
juicefs-sc csi.juicefs.com Retain Immediate false 88m
# Shell
> hadoop fs -ls jfs://myjfs
# Hive
CREATE TABLE IF NOT EXISTS person
(
name STRING,
age INT
) LOCATION 'jfs://myjfs/tmp/person';
# Start S3 Gateway for JuiceFS file system
> juicefs gateway redis://localhost:6379/1 localhost:9000
# Access JuiceFS file system via AWS CLI
> aws --endpoint-url http://localhost:9000 s3 ls s3://myjfs