赞
踩
yum install -y yum-utils
- yum-config-manager \
- --add-repo \
- https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
docker -v
systemctl start docker
docker search fastdfs
- [root@localhost ~]# docker search fastdfs
- NAME DESCRIPTION STARS OFFICIAL AUTOMATED
- season/fastdfs FastDFS 87
- ygqygq2/fastdfs-nginx 整合了nginx的fastdfs 29 [OK]
- luhuiguo/fastdfs FastDFS is an open source high performance d… 25 [OK]
- morunchang/fastdfs A FastDFS image 20
- delron/fastdfs 15
- qbanxiaoli/fastdfs FastDFS+FastDHT(单机+集群版) 14 [OK]
- moocu/fastdfs fastdfs5.11 9
- dodotry/fastdfs 更新到最新版本,基于Centos8/nginx1.19.8/Fast… 6
- ecarpo/fastdfs-storage 4
- imlzw/fastdfs-tracker fastdfs的tracker服务 3 [OK]
- ecarpo/fastdfs 3
- imlzw/fastdfs-storage-dht fastdfs的storage服务,并且集成了fastdht的服务… 2 [OK]
- manuku/fastdfs-fastdht fastdfs fastdht 2 [OK]
- perfree/fastdfsweb go-fastdfs文件系统的web管理系统 2
- manuku/fastdfs-tracker fastdfs tracker 1 [OK]
- lionheart/fastdfs_tracker fastdfs file system‘s tracker node 1
- appcrash/fastdfs_nginx fastdfs with nginx 1
- basemall/fastdfs-nginx fastdfs with nginx 1 [OK]
- leaon/fastdfs fastdfs 1
- tsl0922/fastdfs FastDFS is an open source high performance d… 0 [OK]
- manuku/fastdfs-storage-dht fastdfs storage dht 0 [OK]
- manuku/fastdfs-storage-proxy fastdfs storage proxy 0 [OK]
- germicide/fastdfs The image provides pptx\docx\xlsx to pdf,mp… 0
- mypjb/fastdfs this is a fastdfs docker project 0 [OK]
- chenfengwei/fastdfs
docker pull delron/fastdfs
- [root@localhost ~]# docker pull delron/fastdfs
- Using default tag: latest
- latest: Pulling from delron/fastdfs
- 469cfcc7a4b3: Downloading [====================================> ] 53.55MB/73.17MB
- 4b4f08bd0171: Downloading [===============================> ] 55.65MB/88.7MB
- 95eef9978b96: Download complete
- aff83d00c747: Download complete
- 1e95dffa1075: Download complete
- f114184ac28c: Download complete
- 649b2ad6afe2: Download complete
- 8ab2127a38c5: Download complete
- 4d12f9bd27c7: Download complete
- bfc05d82f0a6: Download complete
- 76f2a6d84a19: Download complete
- 89bd9c4e6fea: Download complete
- 6c06548e40ac: Download complete
- 11186700b494: Download complete
- [root@localhost ~]# mkdir DockerDFS
- [root@localhost ~]# cd DockerDFS/
- [root@localhost DockerDFS]# ll
- total 0
- [root@localhost DockerDFS]# mkdir tracker
- [root@localhost DockerDFS]# mkdir storage
- [root@localhost DockerDFS]# ls
- storage tracker
- [root@localhost DockerDFS]#
使用docker镜像构建tracker容器,用于启动跟踪服务器,起到调度的作用。
其中-v参数将本地的目录与容器中的/var/fdfs目录进行挂载
使用的网络模式是–net=host
–name容器名
-d后台启动
docker run -d --network=host --name tracker -v /data/fastDFS/tracker/:/var/fdfs delron/fastdfs tracker
- [root@localhost DockerDFS]# docker run -d --network=host --name tracker -v /data/fastDFS/tracker/:/var/fdfs delron/fastdfs tracker
- c4c768ff0de669d4a5f82d402600e4aab280d79163991801f0e21681da9d016e
- [root@localhost DockerDFS]# docker ps
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- c4c768ff0de6 delron/fastdfs "/usr/bin/start1.sh …" 24 seconds ago Up 24 seconds
使用docker镜像构建storage容器,用于启动存储服务器,提供容量和备份服务。
在执行下面命令时特别需要提醒的时,对应的IP地址,需要修改为tracker服务的IP地址,由于是在同一台电脑上操作,这里使用本机的内网地址即可,22122是tracker对应的端口。
其中8888为Nginx对应的访问端口,23000是storage服务端口。
docker run -d --network=host --name storage -e TRACKER_SERVER=192.168.216.130:22122 -v /data/fastDFS/storage/:/var/fdfs -e GROUP_NAME=group1 delron/fastdfs storage
- [root@localhost DockerDFS]# docker run -d --network=host --name storage -e TRACKER_SERVER=192.168.216.130:22122 -v /data/fastDFS/storage/:/var/fdfs -e GROUP_NAME=group1 delron/fastdfs storage
- cd9de13334ebf8284b3088b08e7375c4cf43fe5c106db990ab37b877927ddaec
-
- [root@localhost DockerDFS]# docker ps -a
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- cd9de13334eb delron/fastdfs "/usr/bin/start1.sh …" About a minute ago Up About a minute storage
- c4c768ff0de6 delron/fastdfs "/usr/bin/start1.sh …" 8 minutes ago Up 8 minutes tracker
经过上面的步骤,tracker和storage都启动完成。我们可以进入对应的docker容器查看一下默认的配置情况。
进入docker的命令为:docker exec -it [CONTAINER ID] bash
先进入storage,查看其对应配置文件中关于http访问的配置,配置文件在/etc/fdfs目录下的storage.conf。在最后一行可以看到如下配置:http.server_port=8888
也就是说,这个docker镜像中默认监听的是8888端口,当然此配置是需要修改的。如果修改为其他端口,对应的Nginx配置也需要修改
- [root@localhost DockerDFS]# docker exec -it cd9de13334eb bash
- [root@localhost nginx-1.12.2]# ll
- total 708
- -rw-r--r--. 1 1001 1001 278202 Oct 17 2017 CHANGES
- -rw-r--r--. 1 1001 1001 423948 Oct 17 2017 CHANGES.ru
- -rw-r--r--. 1 1001 1001 1397 Oct 17 2017 LICENSE
- -rw-r--r--. 1 root root 376 Apr 29 2018 Makefile
- -rw-r--r--. 1 1001 1001 49 Oct 17 2017 README
- drwxr-xr-x. 6 1001 1001 4096 Apr 29 2018 auto
- drwxr-xr-x. 2 1001 1001 168 Apr 29 2018 conf
- -rwxr-xr-x. 1 1001 1001 2481 Oct 17 2017 configure
- drwxr-xr-x. 4 1001 1001 72 Apr 29 2018 contrib
- drwxr-xr-x. 2 1001 1001 40 Apr 29 2018 html
- drwxr-xr-x. 2 1001 1001 21 Apr 29 2018 man
- drwxr-xr-x. 4 root root 187 Apr 29 2018 objs
- drwxr-xr-x. 9 1001 1001 91 Apr 29 2018 src
- [root@localhost nginx-1.12.2]# cd conf
- [root@localhost conf]# ll
- total 36
- -rw-r--r--. 1 1001 1001 1077 Oct 17 2017 fastcgi.conf
- -rw-r--r--. 1 1001 1001 1007 Oct 17 2017 fastcgi_params
- -rw-r--r--. 1 1001 1001 2837 Oct 17 2017 koi-utf
- -rw-r--r--. 1 1001 1001 2223 Oct 17 2017 koi-win
- -rw-r--r--. 1 1001 1001 3957 Oct 17 2017 mime.types
- -rw-r--r--. 1 1001 1001 2656 Oct 17 2017 nginx.conf
- -rw-r--r--. 1 1001 1001 636 Oct 17 2017 scgi_params
- -rw-r--r--. 1 1001 1001 664 Oct 17 2017 uwsgi_params
- -rw-r--r--. 1 1001 1001 3610 Oct 17 2017 win-utf
-
修改后的内容如下
vi nginx.conf
- server {
- listen 8888;
- server_name localhost;
-
- location ~/group[0-9]/ {
- ngx_fastdfs_module;
- #root html;
- #index index.html index.htm;
- }
-
- }
查看storage.conf
确保storage.conf中的配置http.server_port=8888与刚刚nginxd的配置文件中监听的端口号一致
-
- [root@localhost conf]# cd /etc/fdfs/
- [root@localhost fdfs]# ll
- total 88
- -rw-rw-r--. 1 root root 1452 Nov 17 01:07 client.conf
- -rw-r--r--. 1 root root 1461 Apr 29 2018 client.conf.sample
- -rw-r--r--. 1 root root 955 Apr 29 2018 http.conf
- -rw-r--r--. 1 root root 31172 Apr 29 2018 mime.types
- -rw-r--r--. 1 root root 3680 Nov 17 01:07 mod_fastdfs.conf
- -rw-rw-r--. 1 root root 7894 Nov 17 01:07 storage.conf
- -rw-r--r--. 1 root root 7927 Apr 29 2018 storage.conf.sample
- -rw-rw-r--. 1 root root 105 Apr 29 2018 storage_ids.conf
- -rw-r--r--. 1 root root 105 Apr 29 2018 storage_ids.conf.sample
- -rw-rw-r--. 1 root root 7307 Apr 29 2018 tracker.conf
- -rw-r--r--. 1 root root 7389 Apr 29 2018 tracker.conf.sample
vi storage.conf
- 退出docker
- [root@localhost /]# exit
- exit
设置自启动
- [root@localhost fastDFS]# docker update --restart=always tracker
- tracker
- [root@localhost fastDFS]# docker update --restart=always storage
- storage
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。