我們使用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