在CentOS7上使用Docker安装FastDFS(分布式文件系统)

一、安装环境: 在CentOS7上使用Docker安装FastDFS(分布式文件系统)。
二、准备环境:
1、关于CentOS7上Docker的安装可以参考: https://blog.csdn.net/qq_43602335/article/details/100928144
2、关闭防火墙

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# vi /etc/sysconfig/selinux
找到SELINUX=enforcing把enforcing修改成disabled
在CentOS7上使用Docker安装FastDFS(分布式文件系统)_第1张图片
3、重启
[root@localhost ~]reboot

三、进行安装:
1、查询FastDFS镜像文件

[root@localhost ~]# docker search fastdfs
在CentOS7上使用Docker安装FastDFS(分布式文件系统)_第2张图片

2、下载镜像

[root@localhost ~]# docker pull season/fastdfs
在CentOS7上使用Docker安装FastDFS(分布式文件系统)_第3张图片

3、启动tracker服务器。tracker:跟踪服务器,起到调度的作用。
注意:启动这个容器之前先确认22122这个端口有没有被占用 ,命令:netstat -aon | grep 22122。

[root@localhost ~]# netstat -aon | grep 22122
[root@localhost ~]# docker run -ti -d --name tracker01 -v /etc/localtime:/etc/localtime:ro -v /data/fastdfs/tracker_data:/fastdfs/tracker/data --net=host --restart=always season/fastdfs tracker
在这里插入图片描述

4、启动Storage服务器。storage:存储服务器,提供容量和备份服务。
注意:默认配置的ip地址不会生效需要自己重新配置。

[root@localhost ~]#docker run -tid --name storage -v /etc/localtime:/etc/localtime:ro -v /data/fastdfs/storage_data:/fastdfs/storage/data -v /data/fastdfs/store_path:/fastdfs/store_path --net=host -e TRACKER_SERVER:192.168.40.141:22122 --restart=always season/fastdfs storage
在这里插入图片描述
ip地址的配置命令:
(1)[root@localhost ~]# docker cp storage:/fdfs_conf/storage.conf ~/ #把storage.conf 拷贝到当前目录
(2)[root@localhost ~]# vi ~/storage.conf #进入vi界面找到tracker_server=192.168.40.141:22122 编辑ip地址 完成之后:wq保存退出
(3)[root@localhost ~]# docker cp ~/storage.conf storage:/fdfs_conf/ #把修改好的文件拷贝回之前的目录下 在重启一下storage就OK了
(重启命令:
docker stop storage #关闭
docker start storage #开启

在CentOS7上使用Docker安装FastDFS(分布式文件系统)_第4张图片
在CentOS7上使用Docker安装FastDFS(分布式文件系统)_第5张图片

5、查看tracker容器和storage容器的关联

(1)[root@localhost ~]# docker exec -it storage bash
(2)[root@localhost ~]# cd fdfs_conf/
(3)[root@localhost ~]# fdfs_monitor storage.conf
在CentOS7上使用Docker安装FastDFS(分布式文件系统)_第6张图片

你可能感兴趣的:(CentOS7,Docker)