温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

docker下怎么搭建fastdfs分布式集群

发布时间:2021-07-27 23:32:57 来源:亿速云 阅读:277 作者:chen 栏目:云计算

这篇文章主要讲解了“docker下怎么搭建fastdfs分布式集群”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“docker下怎么搭建fastdfs分布式集群”吧!

本文在centos6.8下,通过一个实例演示fastdfs_in_docker工程的使用方法,利用docker搭建一个fastdfs集群环境。部署结构为:

docker下怎么搭建fastdfs分布式集群

1、前提条件

1)所有机器均能连接外网

2)已安装docker,具体看参考

  docker下怎么搭建fastdfs分布式集群

3)已安装git

4)防火墙开放对下面要使用的端口(端口在fastdfs集群启动前开放即可)

2、搭建步骤

2.1 所有机器上执行:

git clone https://git.oschina.net/zjg23/fastdfs_in_docker.git;#从git服务器下载工程
mkdir -p /home/fastdfs/{tracker,storage};                     #这两个路径用来挂载到docker容器,尤其是/home/fastdfs/storage路径要保证有足够的存储空间
cd fastdfs_in_docker;
docker build -t zjg23/fastdfs:2.0 .;                          #构建镜像

下图表示镜像构建成功

docker下怎么搭建fastdfs分布式集群

2.2 构建tracker,192.168.5.128上执行:

docker run -d --name fdfs_tracker -v /home/fastdfs/tracker:/export/fastdfs/tracker --net=host -e TRACKER_BASE_PATH=/export/fastdfs/tracker -e TRACKER_PORT=22123 zjg23/fastdfs:2.0 sh /usr/local/src/tracker.sh

2.3 构建storage

2.3.1 192.168.5.129上执行:
docker run -d --name fdfs_storage -v /home/fastdfs/storage:/export/fastdfs/storage --net=host -e STORAGE_PORT=23001 -e STORAGE_BASE_PATH=/export/fastdfs/storage -e STORAGE_PATH0=/export/fastdfs/storage -e TRACKER_SERVER=192.168.5.128:22123 -e GROUP_COUNT=2 -e HTTP_SERVER_PORT=8080 -e GROUP_NAME=group1 zjg23/fastdfs:2.0 sh /usr/local/src/storage.sh
2.3.2 192.168.5.130上执行:
docker run -d --name fdfs_storage -v /home/fastdfs/storage:/export/fastdfs/storage --net=host -e STORAGE_PORT=23001 -e STORAGE_BASE_PATH=/export/fastdfs/storage -e STORAGE_PATH0=/export/fastdfs/storage -e TRACKER_SERVER=192.168.5.128:22123 -e GROUP_COUNT=2 -e HTTP_SERVER_PORT=8080 -e GROUP_NAME=group1 zjg23/fastdfs:2.0 sh /usr/local/src/storage.sh
2.3.3 192.168.5.131上执行:
docker run -d --name fdfs_storage -v /home/fastdfs/storage:/export/fastdfs/storage --net=host -e STORAGE_PORT=23001 -e STORAGE_BASE_PATH=/export/fastdfs/storage -e STORAGE_PATH0=/export/fastdfs/storage -e TRACKER_SERVER=192.168.5.128:22123 -e GROUP_COUNT=2 -e HTTP_SERVER_PORT=8080 -e GROUP_NAME=group2 zjg23/fastdfs:2.0 sh /usr/local/src/storage.sh
2.3.4 192.168.5.132上执行:
docker run -d --name fdfs_storage -v /home/fastdfs/storage:/export/fastdfs/storage --net=host -e STORAGE_PORT=23001 -e STORAGE_BASE_PATH=/export/fastdfs/storage -e STORAGE_PATH0=/export/fastdfs/storage -e TRACKER_SERVER=192.168.5.128:22123 -e GROUP_COUNT=2 -e HTTP_SERVER_PORT=8080 -e GROUP_NAME=group2 zjg23/fastdfs:2.0 sh /usr/local/src/storage.sh

命令的解释:

docker下怎么搭建fastdfs分布式集群

3、检查是否搭建成功

docker下怎么搭建fastdfs分布式集群

docker下怎么搭建fastdfs分布式集群

docker下怎么搭建fastdfs分布式集群

结果如下,说明我们已经按照预期部署架构正确的完成安装

docker下怎么搭建fastdfs分布式集群

docker下怎么搭建fastdfs分布式集群

docker下怎么搭建fastdfs分布式集群

docker下怎么搭建fastdfs分布式集群

docker下怎么搭建fastdfs分布式集群

每个storage上装有nginx,所以文件也可以通过http的方式直接访问

docker下怎么搭建fastdfs分布式集群

docker下怎么搭建fastdfs分布式集群

4、项目地址

https://git.oschina.net/zjg23/fastdfs_in_docker.git

如果文章中的图片,附件不能查看,可直接查看工程中的文档:

docker下怎么搭建fastdfs分布式集群

感谢各位的阅读,以上就是“docker下怎么搭建fastdfs分布式集群”的内容了,经过本文的学习后,相信大家对docker下怎么搭建fastdfs分布式集群这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI