版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/E09620126/article/details/86613230
鉴于项目开发要用到分布式文件存储系统FastDFS,而在Linux上安装FastDFS有些繁琐,为了开发方便,我们在虚拟机上用Docker快速安装,详细步骤如下,记录以备查阅.
- 搜索docker镜像
[root@localhost ~]# docker search fastdfs
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/season/fastdfs FastDFS 40
docker.io docker.io/luhuiguo/fastdfs FastDFS is an open source high performance... 18 [OK]
docker.io docker.io/morunchang/fastdfs A FastDFS image 10
docker.io docker.io/ygqygq2/fastdfs-nginx 整合了nginx的fastdfs 6 [OK]
docker.io docker.io/lionheart/fastdfs-tracker just have a try on autobuilded -_-# 3 [OK]
docker.io docker.io/imlzw/fastdfs-tracker fastdfs的tracker服务 2 [OK]
docker.io docker.io/qbanxiaoli/fastdfs FastDFS单机版 2 [OK]
docker.io docker.io/appcrash/fastdfs_nginx fastdfs with nginx 1
docker.io docker.io/delron/fastdfs 1
docker.io docker.io/ecarpo/fastdfs-storage 1
docker.io docker.io/evan1120/fastdfs_storage The fastdfs storage image 1 [OK]
docker.io docker.io/evan1120/fastdfs_tracker The fastdfs tracker docker image, only con... 1 [OK]
docker.io docker.io/imlzw/fastdfs-storage-dht fastdfs的storage服务,并且集成了fastdht的服务,实现文件排重 1 [OK]
docker.io docker.io/john123951/fastdfs_storage fastdfs storage 1 [OK]
docker.io docker.io/lionheart/fastdfs-storage 更加规范的Dockerfile,能够自动构建了。 1 [OK]
docker.io docker.io/lionheart/fastdfs_storage the fastdfs file system's storage node 1
docker.io docker.io/lionheart/fastdfs_tracker fastdfs file system‘s tracker node 1
docker.io docker.io/manuku/fastdfs-tracker fastdfs tracker 1 [OK]
docker.io docker.io/ecarpo/fastdfs 0
docker.io docker.io/john123951/fastdfs_tracker fastdfs tracker 0 [OK]
docker.io docker.io/manuku/fastdfs-fastdht fastdfs fastdht 0 [OK]
docker.io docker.io/manuku/fastdfs-storage-dht fastdfs storage dht 0 [OK]
docker.io docker.io/manuku/fastdfs-storage-proxy fastdfs storage proxy 0 [OK]
docker.io docker.io/mypjb/fastdfs this is a fastdfs docker project 0 [OK]
docker.io docker.io/tsl0922/fastdfs FastDFS is an open source high performance... 0 [OK]
- 拉取镜像
[root@localhost ~]# docker image pull delron/fastdfs
Using default tag: latest
Trying to pull repository docker.io/delron/fastdfs ...
latest: Pulling from docker.io/delron/fastdfs
469cfcc7a4b3: Pull complete
4b4f08bd0171: Pull complete
95eef9978b96: Pull complete
aff83d00c747: Pull complete
1e95dffa1075: Pull complete
f114184ac28c: Pull complete
649b2ad6afe2: Pull complete
8ab2127a38c5: Pull complete
4d12f9bd27c7: Pull complete
bfc05d82f0a6: Pull complete
76f2a6d84a19: Pull complete
89bd9c4e6fea: Pull complete
6c06548e40ac: Pull complete
11186700b494: Pull complete
Digest: sha256:9583cb80170c153bc12615fd077fe364a8fd5a95194b7cf9a8a32d2c11f8a49d
Status: Downloaded newer image for docker.io/delron/fastdfs:latest
- 启动tracker
[root@localhost ~]# docker run -dti --network=host --name tracker -v /var/fdfs/tracker:/var/fdfs delron/fastdfs tracker
- 启动storage
[root@localhost ~]# docker run -dti --network=host --name storage -e TRACKER_SERVER=192.168.0.22:22122 -v /var/fdfs/storage:/var/fdfs delron/fastdfs storage
192.168.0.22这里设置成自己的服务器ip,本地不要设置成127.0.0.1, 端口默认22122
5. 查询启动状态
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
36a530f4857f delron/fastdfs "/usr/bin/start1.s..." 12 minutes ago Up 12 minutes storage
a16c03be9f4c delron/fastdfs "/usr/bin/start1.s..." 12 minutes ago Up 12 minutes tracker
已经启动成功.
注:这里默认的tracker_server_port是8888
,比如上传完文件,得到访问存储的group和地址,访问连接为http://192.168.0.22:8888/group1/M00/00/00/wKgAFlxIJhCADQdhABGTqBTq1EM188.jpg