我怎样在 JuiceFS 中添加存储桶?

huangapple go评论48阅读模式
英文:

How can I add storage bucket in JuiceFS?

问题

I am trying to learn how JuiceFS works.

So if I had two computers on the LAN with 192.168.1.11 and 192.168.1.12 IP addresses, and a third with 192.168.1.100 (for metadata), and a fourth computer on the same LAN where I did this:

juicefs format
--storage sftp
--bucket 192.168.1.11:myjfs/ \ #remote sftp/ssh addresss and path
--access-key tom \ #user
--secret-key 123456 \ #pass
redis://192.168.1.100:6379/1 myjfs #metadata db

juicefs format
--storage sftp
--bucket 192.168.1.12:myjfs/ \ #remote sftp/ssh addresss and path
--access-key tom \ #user
--secret-key 123456 \ #pass
redis://192.168.1.100:6379/1 myjfs #metadata db

Can I mount the JuiceFS like this:

juicefs mount redis://192.168.1.100:6379/1 ~/jfs

Will it appear as a filesystem with storage capacity of the two computer (192.168.1.11 and 192.168.1.12)?

英文:

I am trying to learn how JuiceFS works.

So if I had two computers on the LAN with 192.168.1.11 and 192.168.1.12 IP addresses, and a third with 192.168.1.100 (for metadata), and a fourth computer on the same LAN where I did this:

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.11:myjfs/ \ #remote sftp/ssh addresss and path
    --access-key tom \ #user
    --secret-key 123456 \ #pass
    redis://192.168.1.100:6379/1 myjfs  #metadata db

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.12:myjfs/ \ #remote sftp/ssh addresss and path
    --access-key tom \ #user
    --secret-key 123456 \ #pass
    redis://192.168.1.100:6379/1 myjfs  #metadata db

Can I mount the JuiceFS like this:

juicefs mount redis://192.168.1.100:6379/1 ~/jfs

Will it appear as a filesystem with storage capacity of the two computer (192.168.1.11 and 192.168.1.12)?

答案1

得分: 1

不,一个 JuiceFS 文件系统由一个数据库和一个存储组成。所以,只需执行以下命令之一即可:

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.11:myjfs/ \ #远程 sftp/ssh 地址和路径
    --access-key tom \ #用户
    --secret-key 123456 \ #密码
    redis://192.168.1.100:6379/1 myjfs  #元数据数据库

或者只需执行以下命令之一即可:

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.12:myjfs/ \ #远程 sftp/ssh 地址和路径
    --access-key tom \ #用户
    --secret-key 123456 \ #密码
    redis://192.168.1.100:6379/1 myjfs  #元数据数据库

第一个命令成功执行后,第二个命令将报告错误。

所以,当您通过以下命令挂载文件系统时:

juicefs mount redis://192.168.1.100:6379/1 ~/jfs

您将使用位于 192.168.1.11:myjfs/ 上的存储,而不是 192.168.1.12:myjfs/。

当然,如果您希望充分利用两台计算机上的存储空间,那么您可以为每个文件系统格式化两个文件系统,注意每个文件系统应使用不同的数据库。例如:

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.11:myjfs/ \ #远程 sftp/ssh 地址和路径
    --access-key tom \ #用户
    --secret-key 123456 \ #密码
    redis://192.168.1.100:6379/1 myjfs1  #元数据数据库

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.12:myjfs/ \ #远程 sftp/ssh 地址和路径
    --access-key tom \ #用户
    --secret-key 123456 \ #密码
    redis://192.168.1.100:6379/2 myjfs2  #元数据数据库

请注意文件系统名称redis数据库编号,然后您可以通过以下命令挂载它们:

juicefs mount redis://192.168.1.100:6379/1 ~/jfs1
juicefs mount redis://192.168.1.100:6379/2 ~/jfs2
英文:

Nope, a juicefs filesystem composed of one database and one storage. So, only:

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.11:myjfs/ \ #remote sftp/ssh addresss and path
    --access-key tom \ #user
    --secret-key 123456 \ #pass
    redis://192.168.1.100:6379/1 myjfs  #metadata db

or only

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.12:myjfs/ \ #remote sftp/ssh addresss and path
    --access-key tom \ #user
    --secret-key 123456 \ #pass
    redis://192.168.1.100:6379/1 myjfs  #metadata db

is enough.

After the first command to create the file system is executed successfully, the second command will report an error.

So, when you mount the filesystem via:

juicefs mount redis://192.168.1.100:6379/1 ~/jfs

You will be using the storage on 192.168.1.11:myjfs/, not 192.168.1.12:myjfs/.

Of course, if you wish to make full use of the storage space on both PCs, then you can format two file systems for use, noting that each file system should use a separate db. For example:

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.11:myjfs/ \ #remote sftp/ssh addresss and path
    --access-key tom \ #user
    --secret-key 123456 \ #pass
    redis://192.168.1.100:6379/1 myjfs1  #metadata db

juicefs format  \
    --storage sftp \
    --bucket 192.168.1.12:myjfs/ \ #remote sftp/ssh addresss and path
    --access-key tom \ #user
    --secret-key 123456 \ #pass
    redis://192.168.1.100:6379/2 myjfs2  #metadata db

Please note that the filesystem name and the number of redis db, and then you can mount them via:

juicefs mount redis://192.168.1.100:6379/1 ~/jfs1
juicefs mount redis://192.168.1.100:6379/2 ~/jfs2

huangapple
  • 本文由 发表于 2023年2月14日 00:40:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75438787.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定