seaweed简单部署
Weed(Weed File System)是一个高性能的分布式文件系统,主要用于存储大量小文件。
Weed 由三个主要组件组成:Master、Volume 和 Filer。每个组件都有自己的配置参数,以满足不同的需求。
除了 Master、Volume 和 Filer 之外,Weed 还有一些其他参数和配置选项,用于优化性能、安全性和可管理性。
---------
主要组件及其参数
Master
master.dataCenter: 指定数据中心名称。
master.port: Master 服务监听的端口,默认是 9333。
master.raftPeers: 指定 Raft 协议的对等节点列表,用于高可用性。
master.volumeSizeLimitMB: 单个 Volume 的大小限制(以 MB 为单位)。
master.defaultReplicaPlacement: 默认的副本放置策略,例如 "000" 表示同一数据中心内的不同机架。
master.publicUrl: Master 的公共 URL,用于外部访问。
master.readOnly: 是否将 Master 设置为只读模式。
Volume
volume.port: Volume 服务监听的端口,默认是 8080。
volume.dir: 存储 Volume 文件的目录。
volume.max: 最大 Volume 数量。
volume.sizeLimit: 单个 Volume 的大小限制(以 MB 为单位)。
volume.replicaPlacement: 副本放置策略,例如 "000" 表示同一数据中心内的不同机架。
volume.publicUrl: Volume 的公共 URL,用于外部访问。
volume.heartbeatIntervalSec: 心跳间隔时间(以秒为单位)。
volume.readOnly: 是否将 Volume 设置为只读模式。
Filer
filer.port: Filer 服务监听的端口,默认是 8888。
filer.dir: 存储 Filer 数据的目录。
filer.masterAddress: Master 服务的地址。
filer.publicUrl: Filer 的公共 URL,用于外部访问。
filer.collection: Filer 的集合名称。
filer.chunkSizeLimitMB: 单个 Chunk 的大小限制(以 MB 为单位)。
filer.heartbeatIntervalSec: 心跳间隔时间(以秒为单位)。
filer.readOnly: 是否将 Filer 设置为只读模式。
其他参数
安全性和认证
auth.secret: 用于生成和验证 JWT 的密钥。
auth.publicKeyFile: 公钥文件路径,用于验证 JWT。
auth.privateKeyFile: 私钥文件路径,用于生成 JWT。
auth.enabled: 是否启用认证。
日志和调试
log.level: 日志级别,例如 "debug", "info", "warn", "error"。
log.file: 日志文件路径。
log.format: 日志格式,例如 "text", "json"。
性能优化
cache.sizeMB: 缓存大小(以 MB 为单位)。
cache.expirySec: 缓存过期时间(以秒为单位)。
readBufferSize: 读取缓冲区大小。
writeBufferSize: 写入缓冲区大小。
网络和连接
http.port: HTTP 服务监听的端口。
grpc.port: gRPC 服务监听的端口。
peerDiscovery.enabled: 是否启用对等节点发现。
peerDiscovery.intervalSec: 对等节点发现的间隔时间(以秒为单位)。
备份和恢复
backup.dir: 备份数据的目录。
backup.intervalSec: 备份的间隔时间(以秒为单位)。
restore.dir: 恢复数据的目录。
示例配置文件
以下是一个示例配置文件,展示了如何配置 Master、Volume 和 Filer:
# Master 配置 master: port: 9333 dataCenter: dc1 raftPeers: ["localhost:9334", "localhost:9335"] volumeSizeLimitMB: 10240 defaultReplicaPlacement: "000" publicUrl: "http://localhost:9333" # Volume 配置 volume: port: 8080 dir: "/data/volume" max: 100 sizeLimit: 10240 replicaPlacement: "000" publicUrl: "http://localhost:8080" heartbeatIntervalSec: 30 # Filer 配置 filer: port: 8888 dir: "/data/filer" masterAddress: "localhost:9333" publicUrl: "http://localhost:8888" collection: "default" chunkSizeLimitMB: 1024 heartbeatIntervalSec: 30 # 安全性和认证 auth: secret: "mysecretkey" enabled: true # 日志和调试 log: level: "info" file: "/var/log/weed.log" format: "text" # 性能优化 cache: sizeMB: 1024 expirySec: 3600 # 网络和连接 http: port: 8081 grpc: port: 8082 # 备份和恢复 backup: dir: "/data/backup" intervalSec: 3600 restore: dir: "/data/restore"
快速启动
mkdir seaweedfs && cd seaweedfs wget tar -zxvf linux_amd64.tar.gz && chomd +x ./weed mkdir volume01 volume01 nohup ./weed master & nohup ./weed volume -dir="volume01" -max=100 -mserver="127.0.0.1:9333" -port=10001 & nohup ./weed volume -dir="volume02" -max=100 -mserver="127.0.0.1:9333" -port=10002 & nohup ./weed filer -master="127.0.0.1:9333" -port=9888 &
总结
Weed 提供了丰富的配置参数,用于优化性能、安全性和可管理性。
通过合理配置这些参数,可以确保 Weed 文件系统在生产环境中高效、稳定地运行。
以上示例配置文件展示了如何配置 Master、Volume 和 Filer 的常见参数,以及其他一些重要的配置选项。