seaweedfs使用记录

搭建seaweedfs 

    在github上面clone,然后cd到docker目录使用docker-compose up -d就可以启动seaweedfs

启动以后通过xxx:9333可以看到效果

上传单个文件的python代码:

import requests
url = "http://172.18.9.155"

with open("cat.jpg","rb") as file:

post_res = requests.post(url + ":9333/dir/assign").json()['fid']
print(post_res)
input_path = url + ":8080/" + post_res
put_res = requests.put(input_path,files = {'file':file})
print(put_res.text)

成功结果:

5,0aaf78d66f
{"name":"cat.jpg","size":83795}

然后就可以通过url访问图片

猜你喜欢

转载自www.cnblogs.com/youmuchen/p/9211352.html
今日推荐