docker下怎么搭建fastdfs分布式集群-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

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

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

成都创新互联主营简阳网站建设的网络公司,主营网站建设方案,app软件定制开发,简阳h5小程序开发搭建,简阳网站营销推广欢迎简阳等地区企业咨询

本文在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分布式集群这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


当前文章:docker下怎么搭建fastdfs分布式集群
网站地址:http://kswsj.cn/article/pjeodc.html

其他资讯