新版单机fastdfs安装
2023-10-24 / 杜俊刚   

1, 拉取最新镜像

1
2
3
docker pull ygqygq2/fastdfs-nginx:V6.9.4
docker tag ygqygq2/fastdfs-nginx:V6.9.4 192.168.0.79:5000/libray/fastdfs-nginx:V6.9.4
docker push 192.168.0.79:5000/libray/fastdfs-nginx:V6.9.4

2, 编写部署文件

1
2
3
mkdir -p /opt/fastdfs
cd /opt/fastdfs
vi docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
version: '3'
#networks:
# fastdfs-net:
# external: true
networks:
fastdfs-net:
driver: bridge
services:
tracker:
container_name: tracker
image: 192.168.0.79:5000/library/fastdfs-nginx:V6.9.4
command: tracker
#network_mode: host
networks:
- fastdfs-net
volumes:
- /var/fdfs/tracker:/var/fdfs
ports:
- 22122:22122
storage0:
container_name: storage0
image: 192.168.0.79:5000/library/fastdfs-nginx:V6.9.4
command: storage
#network_mode: host
networks:
- fastdfs-net
environment:
- TRACKER_SERVER=tracker:22122
volumes:
- /var/fdfs/storage0:/var/fdfs
ports:
- 28080:8080
depends_on:
- tracker
storage1:
container_name: storage1
image: 192.168.0.79:5000/library/fastdfs-nginx:V6.9.4
command: storage
#network_mode: host
networks:
- fastdfs-net
environment:
- TRACKER_SERVER=tracker:22122
volumes:
- /var/fdfs/storage1:/var/fdfs
ports:
- 28081:8080
depends_on:
- tracker

3, 启动应用并验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
docker compose up -d

docker exec -it tracker bash
[root@936b4a677e5b fdfs]# date >aaa.txt
[root@936b4a677e5b fdfs]# fdfs_upload_file /etc/fdfs/client.conf aaa.txt
group1/M00/00/00/rBIAA2R-lRCAYKF3AAAAHVN3P3Y136.txt

打开另一终端访问
[root@fastdfs1 ~]# curl localhost:28080/group1/M00/00/00/rBIAA2R-lRCAYKF3AAAAHVN3P3Y136.txt
Tue Jun 6 02:07:29 UTC 2023
[root@fastdfs1 ~]# curl localhost:28081/group1/M00/00/00/rBIAA2R-lRCAYKF3AAAAHVN3P3Y136.txt
Tue Jun 6 02:07:29 UTC 2023


本文遵循 CC BY-NC-SA 4.0 许可协议
本文链接:
https://www.jiamiao.net.cn/2023/10/24/新版单机fastdfs安装/