CentOS Docker 环境中安装及配置 FastDFS 分布式文件系统

搜索fastdfs镜像

 1 [[email protected] usr]# docker search fastdfs
 2 NAME                         DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
 3 season/fastdfs               FastDFS                                         25                                      
 4 luhuiguo/fastdfs             FastDFS is an open source high performance d…   12                                      [OK]
 5 hhland/fastdfs                                                               5                                       [OK]
 6 morunchang/fastdfs           A FastDFS image                                 4                                       
 7 lionheart/fastdfs-tracker    just have a try on autobuilded -_-#             3                                       [OK]
 8 imlzw/fastdfs-tracker        fastdfs的tracker服务                               2                                       [OK]
 9 imlzw/fastdfs-storage        fastdfs的storage服务                               1                                       [OK]
10 lionheart/fastdfs_tracker    fastdfs file system‘s tracker node              1                                       
11 imlzw/fastdfs-storage-dht    fastdfs的storage服务,并且集成了fastdht的服务…              1                                       [OK]
12 evan1120/fastdfs_tracker     The fastdfs tracker docker image,only conta…   1                                       [OK]
13 lionheart/fastdfs-storage    更加规范的Dockerfile,能够自动构建了。                        1                                       [OK]
14 lionheart/fastdfs_storage    the fastdfs file systems storage node          1                                       
15 appcrash/fastdfs_nginx       fastdfs with nginx                              1                                       
16 john123951/fastdfs_storage   fastdfs storage                                 1                                       [OK]
17 evan1120/fastdfs_storage     The fastdfs storage image                       1                                       [OK]
18 lionheart/fastdfs_client     test weather the fastdfs file system is okay    1                                       
19 delron/fastdfs                                                               0                                       
20 manuku/fastdfs-tracker       fastdfs tracker                                 0                                       [OK]
21 john123951/fastdfs_tracker   fastdfs tracker                                 0                                       [OK]
22 manuku/fastdfs-storage-dht   fastdfs storage dht                             0                                       [OK]
23 manuku/fastdfs-fastdht       fastdfs fastdht                                 0                                       [OK]
24 mypjb/fastdfs                this is a fastdfs docker project                0                                       [OK]
25 monkeyk/fastdfs-docker       fastdfs-docker                                  0                                       [OK]
26 lionheart/fastdfs            solve the fastdfss dependence                  0                                       
27 tsl0922/fastdfs              https://github.com/happyfish100/fastdfs         0                                       [OK]

拉取镜像

 docker pull morunchang/fastdfs

运行tracker

docker run -d --name tracker --net=host morunchang/fastdfs sh tracker.sh

运行storage

docker run -d --name storage --net=host -e TRACKER_IP=<your tracker server address>:22122 -e GROUP_NAME=<group name> morunchang/fastdfs sh storage.sh

/*
  1.使用的网络模式是–net=host,<your tracker server address> 替换为你机器的Ip即可
  2.<group name> 是组名,即storage的组
  3.如果想要增加新的storage服务器,再次运行该命令,注意更换 新组名

  4. docker ps 查看容器信息 
[[email protected] ~]# docker ps 
CONTAINER ID        IMAGE                COMMAND             CREATED              STATUS              PORTS               NAMES
ccdf6bbeab48        morunchang/fastdfs   "sh storage.sh"     5 seconds ago        Up 4 seconds                            storage
a7253c93bce1        morunchang/fastdfs   "sh tracker.sh"     About a minute ago   Up About a minute                       tracker

修改nginx的配置,不拦截上传内容

//1.进入容器内部
docker exec -it storage  /bin/bash

     // storage 是 docker ps 中的NAMES
     // exit 退出

[email protected]:/# cd data
[email protected]:/data# ls
fast_data  fastdfs  fastdfs-nginx-module  libfastcommon  nginx  nginx-1.9.11.tar.gz

//2.修改nginx配置文件
[email protected]:/# vi /data/nginx/conf/nginx.conf

//3. 添加修改内容
location /group1/M00 {
   proxy_next_upstream http_502 http_504 error timeout invalid_header;
     proxy_cache http-cache;
     proxy_cache_valid  200 304 12h;
     proxy_cache_key $uri$is_args$args;
     proxy_pass http://fdfs_group1;
     expires 30d;
 }

//4.退出
[email protected]:/data/nginx/conf# exit
exit

//5. 重启storage服务
[[email protected] ~]# docker restart storage
storage

相关文章

文章浏览阅读903次。4.清除缓存目录(/var/cache/yum)下的软件...
文章浏览阅读1.5k次。Python 是一种高级解释性编程语言,已被...
文章浏览阅读2.6k次。打开终端或控制台,以root或具有sudo权...
文章浏览阅读744次,点赞24次,收藏26次。目标:通过AppSrv为...
文章浏览阅读1.1w次,点赞8次,收藏26次。chmod命令来自于英...
文章浏览阅读1.2k次。yum源的URL地址,本例中是文件系统的路...