go-FastDFS 简介
项目地址:https://github.com/sjqzhang/go-fastdfs
编译版本下载地址:https://github.com/sjqzhang/go-fastdfs/releases
中文Wiki地址:https://github.com/sjqzhang/go-fastdfs/blob/master/README-en.md
gitee:https://gitee.com/sjqzhang/go-fastdfs
文档:https://sjqzhang.github.io/go-fastdfs/install.html
下载go-fastdfs
wget https://github.com/sjqzhang/go-fastdfs/releases/download/v1.3.1/fileserver sudo mv fileserver /opt/godfs/fileserver sudo chmod -R 777 /opt/godfs # 更改go-fastdfs文件夹权限 /opt/godfs/fileserver & # 运行go-fastdfs
注意:fileserver 会在当前目录下生成配置文件,所以,启动前先进入fileserver根目录
检测是否启动成功(下列文件会自动生成)
xxx@ubuntu:/opt/godfs$ ls conf data files fileserver log static
启动
fileserver
默认启动端口8080
xxx@ubuntu:/opt/godfs$ sudo netstat -nlp | grep 8080 tcp6 0 0 :::8080 :::* LISTEN 34164/./fileserver
命令行上传文件测试
xxx@ubuntu:~/Pictures$ curl -F file=@test.jpg -F path=test http://127.0.0.1:8080/upload http://127.0.0.1:8080/group1/test/test.jpg
代码上传(选项参阅浏览器上传)
import requests url = 'http://10.1.5.9:8080/upload' files = {'file': open('report.xls', 'rb')} options={'output':'json','path':'','scene':''} #参阅浏览器上传的选项 r = requests.post(url,data=options, files=files) print(r.text)
在django中使用请查阅:https://cloud.tencent.com/developer/article/1491583
supervios管理go-fastdfs
[group:godfs] programs=godfs-7022 [program:godfs-7022] command=/opt/godfs/fileserver directory=/opt/godfs user=www-data autorestart=true redirect_stderr=true stdout_logfile=/home/xxx/logs/supervisor.log loglevel=info
go-fastdfs-web 监控工具安装
项目地址:https://github.com/perfree/go-fastdfs-web
各打包版本下载地址:https://github.com/perfree/go-fastdfs-web/releases
1.安装
下载地址:https://github.com/perfree/go-fastdfs-web/releases/download/v1.3.4/go-fastdfs-web-1.3.4.tar.gz
到 官方下载页面 下载所需的版本(带jre或者不到jre)
运行:
./goFastDfsWeb.sh start
也可以:
java -jar go-fastdfs-web.jar
访问监控页面:
127.0.0.1:8088