使用FastDFS--storage文件上传出现以下问题
>>> ret = client.upload_by_filename('/home/python/Desktop/1.jpg')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/python/.virtualenvs/meiduo/lib/python3.5/site-packages/fdfs_client/client.py", line 90, in upload_by_filename
store_serv = tc.tracker_query_storage_stor_without_group()
File "/home/python/.virtualenvs/meiduo/lib/python3.5/site-packages/fdfs_client/tracker_client.py", line 381, in tracker_query_storage_stor_without_group
raise DataError('[-] Error: %d, %s' % (th.status, os.strerror(th.status)))
fdfs_client.exceptions.DataError: [-] Error: 2, No such file or directory
出现此类问题的原因是因为storage启动时设置的IP或端口和python中链接文件(如:client.conf)中的IP地址不一致所导致的
解决方案:
将本机地址设置为固定IP后将本机IP和storage启动时设置的IP以及端口和python中链接文件(如:client.conf)中的IP地址保持一致
步骤:
第一步:设置本机固定IP
第二步:将storange停下后删除重新跑起来
命令如下:
sudo docker container stop storage
sudo docker container rm storage
docker run -dti --network=host --name storage -e TRACKER_SERVER=192.168.233.131:22122 -v /var/fdfs/storage:/var/fdfs delron/fastdfs storage
sudo docker container start storage
第三步:设置python中链接文件的IP
|
|