Skip to content
Discussion options

You must be logged in to vote

JuiceFS 支持多个 Volume 共享一个 MySQL 数据库! 这是通过 table_prefix 参数实现的。

解决方案:使用 table_prefix 参数

从 JuiceFS 1.3 版本开始,您可以在 META-URL 中添加 table_prefix 查询参数,让不同的文件系统使用不同的表名前缀来共享同一个数据库。

使用方法:

# 用户1的卷
juicefs format mysql://user:password@(host:3306)/juicefs?table_prefix=user1 s3://bucket1

# 用户2的卷  
juicefs format mysql://user:password@(host:3306)/juicefs?table_prefix=user2 s3://bucket2

# 用户3的卷
juicefs format mysql://user:password@(host:3306)/juicefs?table_prefix=user3 s3://bucket3

挂载时也需要指定相同的 table_prefix:

# 挂载用户1的卷
juicefs mount mysql://user:password@(host:3306)/juicefs?table_prefix=user1 /mnt/user1

# 挂载用户2的卷
juicefs mount mysql://user:password@(host:3306)/juicefs?table_prefix=user2 /mnt/user2
  • 默认前缀是 jfs_

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Xuyuchao-juice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants