马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
Seaweedfs 安装 安装Go1、下载go 2、解压 tar xfgo1.11.10.linux-amd64.tar.gz -C /usr/local/ 3、修改/etc/profile vim /etc/profile export GOPATH=/opt/go exportGOROOT=/usr/local/go export GOOS=linux exportGOBIN=$GOROOT/bin exportGOTOOLS=$GOROOT/pkg/tool/ exportPATH=$PATH:$GOBIN:$GOTOOLS source /etc/profile 安装weed1、Github下载指定版本 2、上传并解压 tar xflinux_amd64.tar.gz -C /usr/local/ 3、创建安装目录 mkdir -p /data/seaweedfs/logs mkdir -p /data/seaweedfs/data mkdir -p /data/seaweedfs/vol/vol01 mkdir -p /data/seaweedfs/vol/vol1/ 4、添加启动脚本 vim/data/seaweedfs/weedfs.sh #!/bin/bash nohup /data/seaweedfs/weedmaster -mdir="/data/seaweedfs/data/" -ip="192.168.120.47" -ip.bind="192.168.120.47"-port=9333 -peers="192.168.120.47:9333,192.168.120.47:9333,192.168.120.47:9333"-defaultReplication="200" &>> /data/seaweedfs/logs/master.log& nohup /data/seaweedfs/weedvolume -dataCenter=Center1 -rack rack1 -ip=192.168.120.47 -port=9991 -ip.bind192.168.120.47 -max 20 -dir=/data/seaweedfs/vol/vol1/ -mserver=192.168.120.47:9333-publicUrl 192.168.120.47:9222 &>> /data/seaweedfs/logs/vol1.log & nohup ./weed volume-dataCenter dc1 -rack rack1 -dir ./seaweedfs/volume -ip 192.168.88.129 -port9222 -ip.bind 192.168.88.129 -max 20 -mserver192.168.88.129:9333,192.168.88.130:9333,192.168.88.131:9333 -publicUrl192.168.88.129:9222 > ./seaweedfs/volume/volume.log & nohup /data/weedmaster -mdir="/data/seaweedfs/data/" -ip="192.168.120.47"-ip.bind="192.168.120.47" -port=9333-peers="192.168.120.47:9333,192.168.120.47:9333,192.168.120.47:9333"-defaultReplication="200" >> /data/seaweedfs/logs/master.log2>&1 & nohup /data/weedvolume -dataCenter=Center1 -ip=192.168.120.47 -port=9991-dir=/data/seaweedfs/vol/vol1/ -mserver=192.168.120.47:9333 >>/data/seaweedfs/logs/vol1.log 2>&1 & chmod +x/data/seaweedfs/weedfs.sh 5、创建启动程序 vim/usr/lib/systemd/system/weedmaster.service [Unit] Description=weedmaster After=network.target rc-local.service [Service] Type=forking PrivateTmp=true ExecStart=/data/seaweedfs/weedfs.sh [Install] WantedBy=multi-user.target 6、启动seaweedfs systemctl enableweedmaster systemctl startweedmaster http://192.168.120.47:9333/ 调试: nohup /data/seaweedfs/weed master -ip=192.168.120.47-port=9333 -mdir=/data/seaweedfs/data -peers=192.168.120.47:9333,192.168.120.47:9333,192.168.120.47:9333>> /data/seaweedfs/data/master.log & nohup /data/seaweedfs/weed volume -dataCenter dc1-rack rack1 -dir /data/seaweedfs/volume -ip 192.168.120.47 -port 9222 -ip.bind192.168.120.47 -max 20 -mserver 192.168.120.47:9333,192.168.120.47:9333,192.168.120.47:9333-publicUrl 192.168.120.47:9222 >> /data/seaweedfs/volume/volume.log & 测试: {"fid":"1,01592b640e","url":"192.168.120.47:9222","publicUrl":"192.168.120.47:9222","count":1}[root@seaweedfs~]# [root@seaweedfs ~]# curl -Ffile=/data/seaweedfs/volume/volume.log 192.168.120.47:9222/1,01592b640e {"size":33,"eTag":"d7a0738f"}[root@seaweedfs~]# [root@seaweedfs ~]# curl -Ffile=@/usr/src/linux_amd64.tar.gz 192.168.120.47:9222/1,01592b640e {"name":"linux_amd64.tar.gz","size":35348455,"eTag":"0747f50b"}[root@seaweedfs~]# 配置运行Filer并挂载到本地目录 Filer允许以另一种方式上传文件 : R5 a7 B! o! C# U1 n) n# @+ o
- 安装启动
$ I p4 A6 G; p; h% p2 r1 G0 b, J mkdir -p /data/seaweedfs cd /data/seaweedfs 创建filter文件: touch filer.toml mkdir -p /data/module/filer_path/level 将 /data/seaweedfs/weed scaffold filer-output="" >filer.toml 打印出的内容写入到 filer.toml中, 并且修改其中的配置 dir = "/data/module/filer_path/level"
( o& z, w$ k0 F. W - 启动- T9 [2 |. l) `' e& V
nohup /data/seaweedfs/weed filer-master=192.168.120.47:9333,192.168.120.47:9333,192.168.120.47:9333-ip=192.168.120.47 -port=8888 &
$ ]) w w6 p- P, ]3 ^% `1 a6 l$ N - 上传文件
+ S4 P5 D9 ]& l! R& A [root@seaweedfs ~]# curl -F "filename=@/usr/src/go1.11.10.linux-amd64.tar.gz" "http://192.168.120.47:8888/path/to/sources/"
3 |2 K! I* E6 e/ g) Y
{"name":"go1.11.10.linux-amd64.tar.gz","size":121074848}[root@seaweedfs~]#
3 a8 |+ m& a! M - 返回结果
* \/ E! G" O% c# u* N4 k5 v {"name":"volume.log","size":1656,"fid":"13,0da7c2b7ff","url":"http://192.168.88.130:9222/13,0da7c2b7ff"}. o4 Z5 C0 m) E8 z3 U ~. ]: H
可以看到,前面的上传需要两步,现在用filer上传,只需要一步,并且可以指定文件夹,这里的/path/to/sources/就是文件路径' ~; G6 @; Z" h- i: L7 @# Y
- 可直接输入http://192.168.120.47:8888/ 地址进行访问.下载和前面的流程一样.+ ~# i$ ]/ `1 J- ^5 v( \' n3 y
mount挂载 - k) U# E. Z! z# y7 Z8 w
- [root@seaweedfs ~]# mkdir -p /data/seaweedfs/seaweedfs/data/mount
1 i: H/ z% ^8 { - 指定文件管理器挂载到/seaweedfs/data/mount目录下
: W5 G% W& D5 O) t8 z& R3 A: o nohup /data/seaweedfs/weed mount-filer=192.168.120.47:8888 -dir=/data/seaweedfs/seaweedfs/data/mount/ & 执行命令后,便可看到通过filer上传的文件已经挂载到了本地/data/seaweedfs/seaweedfs/data/mount/ path/to/sources目录下.! I5 C' o3 w6 m0 Y1 x7 \! A
具体信息以官方wiki为主. 6 ~8 }# D# v9 _
|