docker-compose FastDfs安装
FCAT 2020/9/12 fastdfs
构建环境:docker、docker-compose
# 介绍
Host 模式: 如果启动容器的时候使用host模式,那么这个容器将不会获得一个独立的Network Namespace,而是和宿主机共用一个 Network Namespace。容器将不会虚拟出自己的网卡,配置自己的 IP 等,而是使用宿主机的 IP 和端口。但是,容器的其他方面,如文件系统、进程列表等还是和宿主机隔离的。
创建对应的文件夹
├── nginx
│ └── nginx.conf
├── storage
│ └── data
└── tracker
│ └── conf
│ └── client.conf
└── store_path
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 配置文件
vim /docker/docker-compose.yml
version: "3.9"
services:
fastdfs-tracker:
hostname: fastdfs-tracker
container_name: fastdfs-tracker
image: season/fastdfs:1.2
network_mode: "host"
command: tracker
volumes:
- /docker/fastdfs/tracker/data:/fastdfs/tracker/data
- /docker/fastdfs/tracker/conf:/etc/fdfs
fastdfs-storage:
hostname: fastdfs-storage
container_name: fastdfs-storage
image: season/fastdfs:1.2
network_mode: "host"
volumes:
- /docker/fastdfs/storage/data:/fastdfs/storage/data
- /docker/fastdfs/store_path:/fastdfs/store_path
environment:
- TRACKER_SERVER=39.107.60.53:22122
command: storage
depends_on:
- fastdfs-tracker
fastdfs-nginx:
hostname: fastdfs-nginx
container_name: fastdfs-nginx
image: season/fastdfs:1.2
network_mode: "host"
volumes:
- /docker/fastdfs/nginx/nginx.conf:/etc/nginx/conf/nginx.conf
- /docker/fastdfs/store_path:/fastdfs/store_path
environment:
- TRACKER_SERVER=39.107.60.53:22122
command: nginx
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
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
# tracker
vim /docker/fastdfs/tracker/conf/client.conf
# connect timeout in seconds
# default value is 30s
connect_timeout=30
# network timeout in seconds
# default value is 30s
network_timeout=60
# the base path to store log files
base_path=/fastdfs/client
# tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
# 需要修改此处 ip
tracker_server=39.107.60.53:22122
#standard log level as syslog, case insensitive, value list:
### emerg for emergency
### alert
### crit for critical
### error
### warn for warning
### notice
### info
### debug
log_level=info
# if use connection pool
# default value is false
# since V4.05
use_connection_pool = false
# connections whose the idle time exceeds this time will be closed
# unit: second
# default value is 3600
# since V4.05
connection_pool_max_idle_time = 3600
# if load FastDFS parameters from tracker server
# since V4.05
# default value is false
load_fdfs_parameters_from_tracker=false
# if use storage ID instead of IP address
# same as tracker.conf
# valid only when load_fdfs_parameters_from_tracker is false
# default value is false
# since V4.05
use_storage_id = false
# specify storage ids filename, can use relative or absolute path
# same as tracker.conf
# valid only when load_fdfs_parameters_from_tracker is false
# since V4.05
storage_ids_filename = storage_ids.conf
#HTTP settings
http.tracker_server_port=80
#use "#include" directive to include HTTP other settiongs
##include http.conf
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
50
51
52
53
54
55
56
57
58
59
60
61
62
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
50
51
52
53
54
55
56
57
58
59
60
61
62
# nginx
vim /docker/fastdfs/nginx/nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 7003;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /group1/M00 {
root /fastdfs/store_path/data;
ngx_fastdfs_module;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
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
50
51
52
53
54
55
56
57
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
50
51
52
53
54
55
56
57
# 运行
运行:docker-compose up -d
1