|
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允许以另一种方式上传文件
2 H4 T% h" U0 P. s0 l - 安装启动: I# W8 |: G" @4 J" Z) v" n7 |$ W
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" 4 j. H$ H$ S$ X
- 启动
5 T# i, a o) Y3 m, _% g 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 & : o. a) {- Q; d+ x% k% R
- 上传文件1 O7 d- v) ~/ P! M5 @
[root@seaweedfs ~]# curl -F "filename=@/usr/src/go1.11.10.linux-amd64.tar.gz" "http://192.168.120.47:8888/path/to/sources/"" q7 _7 O2 Q' d+ z
{"name":"go1.11.10.linux-amd64.tar.gz","size":121074848}[root@seaweedfs~]#
7 X& o7 o+ w: w0 q7 h' k/ Y - 返回结果
; _# ]# [, @' N& T* Y1 l {"name":"volume.log","size":1656,"fid":"13,0da7c2b7ff","url":"http://192.168.88.130:9222/13,0da7c2b7ff"} `3 }% l( G0 K7 \, Q. T6 p
可以看到,前面的上传需要两步,现在用filer上传,只需要一步,并且可以指定文件夹,这里的/path/to/sources/就是文件路径
/ \' n H9 R. m; {! L - 可直接输入http://192.168.120.47:8888/ 地址进行访问.下载和前面的流程一样. X& X, n4 i' G$ w8 c# n: i
mount挂载 - {# Y* H! m6 I6 y
- [root@seaweedfs ~]# mkdir -p /data/seaweedfs/seaweedfs/data/mount% {" n, K2 T% D
- 指定文件管理器挂载到/seaweedfs/data/mount目录下, ^5 ^0 f5 k8 X7 W# Y% }
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目录下.
, l0 C, b( n0 p) _- N8 Q具体信息以官方wiki为主. 4 O \0 o" Q3 P" A! u" V
|