当前位置:网站首页>初探JuiceFS
初探JuiceFS
2022-07-27 14:23:00 【wankunde】
说明
个人理解JuiceFS的定位是一个建立在S3, OSS 等存储系统之上的一个抽象文件系统。因为使用Redis来做文件的元数据管理,所以减少了远程调用 S3, OSS API的开销;内部有对数据的Cache功能,所以当重复访问数据时,速度也会得到明显提升。
JuiceFS作为虚拟文件系统层,底层文件是自己管理的,其定位不是其他文件存储系统的读写Proxy。
Juicefs编译
Juice编译设计到的go,java,maven等组件,而且go的编译还需要在对应的平台上进行编译,才能使用,所以参考大佬的做法,使用基础软件 + Go Docker 镜像的方式进行编译。
首先准备好,编译需要的绿色版Java,Maven以及对应的juicefs代码
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
tar -zxvf jdk-8u141-linux-x64.tar.gz
/Users/wankun/Applications/jdk1.8.0_141
使用docker镜像编译,注意,golang的镜像版本最高只能用1.15, 使用1.16 会报一些包找不到的错
# 启动docker golang镜像
docker run -it \
-v /Users/wankun/Applications/jdk1.8.0_141:/java8 \
-v /Users/wankun/Applications/maven:/maven \
-v /Users/wankun/.m2:/root/.m2 \
-v /Users/wankun/ws/wankun/juicefs-0.11.0:/root/juicefs \
--env JAVA_HOME=/java8 \
--env PATH=/java8/bin:/maven/bin:/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
golang:1.15.2 /bin/bash
# 编译juicefs
export GOPROXY=https://goproxy.io
make
# 编译hadoop SDK
$ cd sdk/java
$ make
启动 Redis 服务来管理JuiceFS元数据
- 20210330 当前redis版本更新也比较快,所以直接使用了redis的latest version
- redis取消IP bind,改为密码连接校验,参考这里
- docker镜像启动后很奇怪,默认的6379端口无法外部连接,所以使用了26379端口对外提供服务
redis.conf 中相关配置更改
appendonly yes
# bind -- 注释掉bind,改为密码校验
requirepass xxxx
将OSS存储挂载为本地目录读写
Juice通过reformat来初始化底层存储系统,然后将该存储系统挂载到本地,就可以通过JuiceFS 的虚拟文件系统来管理文件了。
# 注意 这里bucket参数实际上是 https://[bucket].[endpoint] 格式, 最后一个参数是该bucket下的目录名; redis的连接地址如果需要密码的话,注意把密码补上
./juicefs format \
--storage oss \
--bucket https://[bucket].[endpoint] \
--access-key [ACC_KEY] \
--secret-key [SEC_KEY] \
redis://:{PASSWORD}@{HOST}:26379/0 \
test-wankun
# 挂载juicefs到本地目录
./juicefs mount -d redis://:{PASSWORD}@{HOST}:26379/0 ~/test-wankun
Hadoop 访问 JuiceFS 存储
将前面的hadoop SDK 放到Hadoop的lib目录( /opt/cloudera/parcels/CDH/lib/hadoop/lib/juicefs-hadoop-0.11.0.jar ),然后修改hadoop配置文件,使hadoop支持对juiceFS的访问。
注意: 官方文档中的 juicefs.accesskey 和 juicefs.secretkey 可以无需配置
<xml>
<property>
<name>fs.jfs.impl</name>
<value>io.juicefs.JuiceFileSystem</value>
</property>
<property>
<name>fs.AbstractFileSystem.jfs.impl</name>
<value>io.juicefs.JuiceFS</value>
</property>
<property>
<name>juicefs.meta</name>
<value>redis://{PASSWORD}:{HOST}:{PORT}/{DB}</value>
</property>
<property>
<name>juicefs.cache-dir</name>
<value>/data*/jfs</value>
</property>
<property>
<name>juicefs.cache-size</name>
<value>1024</value>
</property>
<property>
<name>juicefs.access-log</name>
<value>/tmp/juicefs.access.log</value>
</property>
</xml>
参考
边栏推荐
- 分布式锁
- 西瓜书《机器学习》阅读笔记之第一章绪论
- Network equipment hard core technology insider router Chapter 5 tompkinson roaming the network world (Part 1)
- The mobile terminal uses the list component of vantui. When multiple tab items are switched back and forth, the list is loaded many times, resulting in the failure of normal display of data
- Cap theory and base theory
- Network equipment hard core technology insider router Chapter 7 tompkinson roaming the network world (Part 2)
- Leetcode 240. search two-dimensional matrix II medium
- Network equipment hard core technology insider router Chapter 21 reconfigurable router
- 《剑指Offer》数组中的逆序对
- Adaptation verification new occupation is coming! Huayun data participated in the preparation of the national vocational skill standard for information system adaptation verifiers
猜你喜欢

Unity性能优化------渲染优化(GPU)之Occlusion culling(遮挡剔除)

The mobile terminal uses the list component of vantui. When multiple tab items are switched back and forth, the list is loaded many times, resulting in the failure of normal display of data

EMC design scheme of RS485 interface

Watermelon book machine learning reading notes Chapter 1 Introduction

Tools - common methods of markdown editor

Dialog manager Chapter 3: create controls

JMeter recording interface automation

Unity性能优化------渲染优化(GPU)之LOD(Level of detail)

Huayun data creates a perfect information technology and innovation talent training system to help the high-quality development of information technology and innovation industry

Digital storage oscilloscope based on FIFO idt7202-12
随机推荐
Unity性能优化------渲染优化(GPU)之LOD(Level of detail)
Huayun data creates a perfect information technology and innovation talent training system to help the high-quality development of information technology and innovation industry
Simple mathematical knowledge related to 3D
初探STM32掉电复位PDR
generic paradigm
Network equipment hard core technology insider router Chapter 3 Jia Baoyu sleepwalking in Taixu Fantasy (middle)
微信公众平台开发概述
Network equipment hard core technology insider router Chapter 18 dpdk and its prequel (III)
Leetcode 240. search two-dimensional matrix II medium
《剑指Offer》 合并两个排序的链表
工具 - markdown编辑器常用方法
Unity mouse controls the first person camera perspective
Comparison of advantages and disadvantages between instrument amplifier and operational amplifier
2022-07-27 Daily: IJCAI 2022 outstanding papers were published, and 298 Chinese mainland authors won the first place in two items
Kubernetes CNI classification / operation mechanism
Basic usage of kotlin
Introduction to STM32 learning can controller
STM32F10x_硬件I2C读写EEPROM(标准外设库版本)
Leetcode 244周赛-赛后补题题解【西兰花选手】
Problem solving in magic tower project