使用Docker配置FastDFS
搭建FastDFS
docker pull delron/fastdfs # 拉取镜像
docker run -d --network=host --name tracker -v /home/dockerfile/fastDFS/var/fdfs/tracker:/var/fdfs delron/fastdfs tracker # 安装tracker
docker run -d --network=host --name storage -e TRACKER_SERVER=106.14.61.173:22122 -v /home/dockerfile/fastDFS/var/fdfs/storage:/var/fdfs delron/fastdfs storage # 安装storage
cd /var/fdfs && echo "hello FastDFS" > one.txt #测试
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf one.txt #上传文件
#出现连接超时connect to ****:22122 fail 添加安全组后,关闭防火墙或者开启8888、22122、23000端口
firewall-cmd --zone=public --permanent --add-port=8888/tcp
firewall-cmd --zone=public --permanent --add-port=22122/tcp
firewall-cmd --zone=public --permanent --add-port=23000/tcp
firewall-cmd --reload
firewall-cmd --zone=public --list-ports #查看开启端口
http://ip:8888/group1/M00/00/00/rBi4d2EBGrCASQOoAAAAE67wVdw044.txt #文件查看
相关默认配置
#----------------------------------------- /usr/local/nginx/conf/nginx.conf配置
server {
listen 8888;
server_name localhost;
location ~/group[0-9]/ {
ngx_fastdfs_module;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
#---------------------------------------- /etc/fdfs/storage.conf 配置
# the storage server port
port=23000
# the port of the web server on this storage server
http.server_port=8888
# tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
tracker_server=192.168.142.132:22122
#---------------------------------------- /etc/fdfs/tracker.conf配置
# the tracker server port
port=22122
# the base path to store data and log files
base_path=/var/fdfs
# HTTP port on this tracker server
http.server_port=8080
#---------------------------------------- /etc/fdfs/client.conf配置
#HTTP settings
http.tracker_server_port=80