我们使用Docker搭建FastDFS的开发环境
拉取镜像
docker pull morunchang/fastdfs
运行tracker
docker run -d --name tracker --net=host morunchang/fastdfs sh tracker.sh
运行storage
docker run -d --name storage --net=host -e TRACKER_IP=<your tracker server address>:22122 -e GROUP_NAME=<group name> morunchang/fastdfs
- 使用的网络模式是–net=host, <your tracker server address> 替换为你机器的Ip即可
- <group name> 是组名,即storage的组
- 如果想要增加新的storage服务器,再次运行该命令,注意更换 新组名
(4)修改nginx的配置
进入storage的容器内部,修改nginx.conf
docker exec -it storage /bin/bash
进入后
vi /data/nginx/conf/nginx.conf
添加以下内容
location /group1/M00 {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_cache http-cache;
proxy_cache_valid 200 304 12h;
proxy_cache_key $uri$is_args$args;
proxy_pass http://fdfs_group1;
expires 30d;
}
(5)退出容器
exit
(6)重启storage容器
docker restart storage