前提:搭建后redis,并配置无密码和远程访问。并且juicefs要使用1.1.0以上版本。
参考juicefs官网:
使用glusterfs作为后端存储
https://juicefs.com/docs/zh/community/how_to_setup_object_storage#gluster
编译安装juicefs
https://juicefs.com/docs/zh/community/installation
编译安装juicefs步骤整理如下,要求系统为Ubuntu 22.04.1 LTS
bash
#编译依赖
apt-get install -y wget
wget https://golang.google.cn/dl/go1.20.6.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.6.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc
go version
apt-get install libglusterfs-dev glusterfs-common -y
apt-get install uuid uuid-dev uuid-runtime uuidcdef gcc -y
apt install make -y
apt install make-guile -y
#编译
cd ~
git clone https://github.com/juicedata/juicefs.git
cd juicefs
git checkout v1.1.0-beta2
make juicefs.gluster
cp juicefs.gluster /usr/local/bin/
1、格式化juicefs文件系统
bash
juicefs.gluster format \
--storage gluster \
--bucket gluster01,gluster02,gluster03/gv1 \
"redis://10.0.0.26:6379/2" \
thin-myjfs
2、在每个主机上挂载
bash
juicefs.gluster mount -d "redis://10.0.0.26:6379/2" /mnt/thin-jfs
3、写点文件
bash
cd /mnt/thin-jfs
for i in `seq 100`;do echo "this is $i file" >> $i.txt;cat /etc/passwd >> $i.txt;done
4、删除文件
bash
rm -rf *
删除文件后,会在挂载点目录的.trash目录下有备份(类似垃圾箱)
bash
ls /mnt/thin-jfs/.trash/2023-07-19-07/
1-5301-1.txt 1-5316-16.txt 1-5331-31.txt 1-5346-46.txt 1-5361-61.txt 1-5376-76.txt 1-5391-91.txt
1-5302-2.txt 1-5317-17.txt 1-5332-32.txt 1-5347-47.txt 1-5362-62.txt 1-5377-77.txt 1-5392-92.txt
1-5303-3.txt 1-5318-18.txt 1-5333-33.txt 1-5348-48.txt 1-5363-63.txt 1-5378-78.txt 1-5393-93.txt
1-5304-4.txt 1-5319-19.txt 1-5334-34.txt 1-5349-49.txt 1-5364-64.txt 1-5379-79.txt 1-5394-94.txt
1-5305-5.txt 1-5320-20.txt 1-5335-35.txt 1-5350-50.txt 1-5365-65.txt 1-5380-80.txt 1-5395-95.txt
1-5306-6.txt 1-5321-21.txt 1-5336-36.txt 1-5351-51.txt 1-5366-66.txt 1-5381-81.txt 1-5396-96.txt
1-5307-7.txt 1-5322-22.txt 1-5337-37.txt 1-5352-52.txt 1-5367-67.txt 1-5382-82.txt 1-5397-97.txt
1-5308-8.txt 1-5323-23.txt 1-5338-38.txt 1-5353-53.txt 1-5368-68.txt 1-5383-83.txt 1-5398-98.txt
1-5309-9.txt 1-5324-24.txt 1-5339-39.txt 1-5354-54.txt 1-5369-69.txt 1-5384-84.txt 1-5399-99.txt
1-5310-10.txt 1-5325-25.txt 1-5340-40.txt 1-5355-55.txt 1-5370-70.txt 1-5385-85.txt 1-5400-100.txt
1-5311-11.txt 1-5326-26.txt 1-5341-41.txt 1-5356-56.txt 1-5371-71.txt 1-5386-86.txt
1-5312-12.txt 1-5327-27.txt 1-5342-42.txt 1-5357-57.txt 1-5372-72.txt 1-5387-87.txt
1-5313-13.txt 1-5328-28.txt 1-5343-43.txt 1-5358-58.txt 1-5373-73.txt 1-5388-88.txt
1-5314-14.txt 1-5329-29.txt 1-5344-44.txt 1-5359-59.txt 1-5374-74.txt 1-5389-89.txt
1-5315-15.txt 1-5330-30.txt 1-5345-45.txt 1-5360-60.txt 1-5375-75.txt 1-5390-90.txt