拉取镜像

docker pull season/fastdfs:1.2

启动Tracker

docker run -ti -d --name trakcer -v /opt/fastdfs/tracker_data:/fastdfs/tracker/data --net=host season/fastdfs:1.2 tracker

启动Storage

注意替换{ipaddress}

docker run -ti -d --name storage -v /opt/fastdfs/storage_data:/fastdfs/storage/data -v /opt/fastdfs/store_path:/fastdfs/store_path --net=host -e TRACKER_SERVER:{ipaddress}:22122 season/fastdfs:1.2 storage

修改配置文件

vim的目录为cp后的目录,如我的目录为/usr/local/fastdfs/conf
将配置文件中下面的参数替换为自己相应的ip即可

docker cp storage:/fdfs_conf/. /usr/local/fastdfs/conf

vim tracker.conf
bind_addr=${ipaddress}

vim storage.conf
tracker_server=${ipaddress}:22122

vim client.conf
tracker_server=${ipaddress}:22122

#将修改完的配置文件cp回镜像中
docker cp /usr/local/fastdfs/conf/. storage:/fdfs_conf

#重启storage服务
docker restart storage

配置Nginx

在storage服务中将nginx.conf和mod_fastdfs.conf挂载出来

#nginx.conf配置文件中添加
location /group1/M00 {
      #root  /fastdfs/store_path/data;
      ngx_fastdfs_module;
}

#在server里面配置跨域配置跨域 在server里面
add_header 'Access-Control-Allow-Origin' '*';
  add_header 'Access-Control-Allow-Credentials' 'true';
  add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

#mod_fastdfs.conf中添加
url_have_group_name=true

启动Nginx

注意:启动nginx时需要将上一步挂载出来的nginx.conf和mod_fastdfs.conf映射路径,所以需要根据自己的路径来写,同时记得替换{ipaddress}参数

docker run -id --name fastdfs_nginx --restart=always -v /opt/fastdfs/store_path:/fastdfs/store_path -v /usr/local/fastdfs/nginx_conf/nginx.conf:/etc/nginx/conf/nginx.conf -v /usr/local/fastdfs/nginx_conf/mod_fastdfs.conf:/etc/fdfs/mod_fastdfs.conf -p 8888:80 -e GROUP_NAME=group1 -e TRACKER_SERVER={ipaddress}:22122 -e STORAGE_SERVER_PORT=23000 season/fastdfs:1.2 nginx

配置防火墙

firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --zone=public --add-port=23000/tcp --permanent
firewall-cmd --reload
标签:
Docker安装FastDFS

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com

评论“Docker安装FastDFS的方法步骤”

暂无“Docker安装FastDFS的方法步骤”评论...