docker 和 FastDFS上传和下载文件

匿名 (未验证) 提交于 2019-12-03 00:14:01

1,从仓库拉取镜像

sudo docker image pull delron/fastdfs

 也可以解压已经打包好的镜像文件

$ sudo docker load -i 文件路径/fastdfs_docker.tar

2,开启tracker容器

  将tracker运行目录映射到宿主机的/var/fdfs/tracker目录中

sudo docker run -dit --name=tracker --network=host -v /var/fdfs/tracker:/var/fdfs delron/fastdfs tracker 
delron/fastdfs 为镜像,可用sudo docker image ls 查看3,开启storage 容器
sudo docker run -dit --name=storage --network=host -e TRACKER_SERVER=192.168.174.168:22122 -v /var/fdfs/storage:/var/fdfs delron/fastdfs storage

4,查看宿主机的映射路径

5,DFS服务端配置好以后,进入Django项目进行配置服务端

  1,在环境中安装下面三个模块,第一个是已经下载好的模块,

6,项目配置

cilent.config 配置文件内容如下,创建client.conf文件后,直接复制修改下面的配置就好

# connect timeout in seconds # default value is 30s connect_timeout=30  # network timeout in seconds # default value is 30s network_timeout=60  # the base path to store log files base_path=/Users/meihao/Desktop  # tracker_server can ocur more than once, and tracker_server format is #  "host:port", host can be hostname or ip address tracker_server=172.16.238.128:22122  #standard log level as syslog, case insensitive, value list: ### emerg for emergency ### alert ### crit for critical ### error ### warn for warning ### notice ### info ### debug log_level=info  # if use connection pool # default value is false # since V4.05 use_connection_pool = false  # connections whose the idle time exceeds this time will be closed # unit: second # default value is 3600 # since V4.05 connection_pool_max_idle_time = 3600  # if load FastDFS parameters from tracker server # since V4.05 # default value is false load_fdfs_parameters_from_tracker=false  # if use storage ID instead of IP address # same as tracker.conf # valid only when load_fdfs_parameters_from_tracker is false # default value is false # since V4.05 use_storage_id = false  # specify storage ids filename, can use relative or absolute path # same as tracker.conf # valid only when load_fdfs_parameters_from_tracker is false # since V4.05 storage_ids_filename = storage_ids.conf   #HTTP settings http.tracker_server_port=80  #use "#include" directive to include HTTP other settiongs ##include http.conf
View Code

 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!