Docker安裝FastDFS的方法步驟
拉取鏡像
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
將配置文件中下面的參數(shù)替換為自己相應的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映射路徑,所以需要根據(jù)自己的路徑來寫,同時記得替換{ipaddress}參數(shù)
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
到此這篇關(guān)于Docker安裝FastDFS的方法步驟的文章就介紹到這了,更多相關(guān)Docker安裝FastDFS內(nèi)容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。