Docker安装FastDFS的方法步骤

本站所有内容来自互联网收集,仅供学习和交流,请勿用于商业用途。如有侵权、不妥之处,请第一时间联系我们删除!Q群:迪思分享

免费资源网 – https://freexyz.cn/

拉取镜像

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
免费资源网 – https://freexyz.cn/


© 版权声明
THE END
★喜欢这篇文章吗?喜欢的话,麻烦动动手指支持一下!★
点赞13 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容