|
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允许以另一种方式上传文件 $ y: E* h0 ~; M' C0 y
- 安装启动
4 f8 M/ V' X; |: A 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" Y0 n" ~- t" W' \& W/ D
- 启动& k- y& h1 ?9 C/ |
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 &
7 B& F$ E' ^' g - 上传文件* T' t# G" H; p+ r% @* H
[root@seaweedfs ~]# curl -F "filename=@/usr/src/go1.11.10.linux-amd64.tar.gz" "http://192.168.120.47:8888/path/to/sources/"1 ]# W2 n# v6 k0 Y: Y
{"name":"go1.11.10.linux-amd64.tar.gz","size":121074848}[root@seaweedfs~]#
$ D% }8 ^( I! [& Q% Z* c - 返回结果
, i6 W( S) d( m {"name":"volume.log","size":1656,"fid":"13,0da7c2b7ff","url":"http://192.168.88.130:9222/13,0da7c2b7ff"}& L% I" {9 a6 {% U: T
可以看到,前面的上传需要两步,现在用filer上传,只需要一步,并且可以指定文件夹,这里的/path/to/sources/就是文件路径5 L3 k2 ^( E) k0 W- t9 F: |3 A
- 可直接输入http://192.168.120.47:8888/ 地址进行访问.下载和前面的流程一样.6 N( o& u& }; h5 d- T& z: A- ~
mount挂载
# K/ L. h1 e- s$ T - [root@seaweedfs ~]# mkdir -p /data/seaweedfs/seaweedfs/data/mount2 P& `. c9 S/ i7 s3 e7 N
- 指定文件管理器挂载到/seaweedfs/data/mount目录下
5 H) H( S! p6 B" I" Q& ?
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目录下.' _1 w) M7 m+ D P/ t6 u
具体信息以官方wiki为主. - _. t* k$ l& s4 `3 b! |
|