Docker安装及fastdfs安装(单机版本)

Docker安装及fastdfs安装(单机版本)

运行环境:centos7.0,docker-18.06.1-ce,fastdfs v6.0.7 ip地址:192.168.189.15

1.获取安装包及安装脚本文件(百度云连接)

链接:https://pan.baidu.com/s/18Z2ahkjFXBfJiVYf7eT2fw
提取码:69hw

2.上传文件到linux服务器dockerfastdfsservice.sh脚本文件和docker.tar.gz在同一目录

3.赋dockerfastdfsservice.sh脚本文件,执行权限

chmod +x  dockerfastdfsservice.sh

4.dockerfastdfsservice.sh脚本文件内容 重点注意修改:hosts文件里面ip地址:

#!/bin/sh
echo '解压docker.tar.gz'
tar -zxvf docker.tar.gz

echo '进入安装目录,安装安装docker'
cd docker/dockerlx
./install.sh docker-18.06.1-ce.tgz

#卸载./uninstall.sh docker-18.06.1-ce.tgz
echo '进入目录fastdfs6jx'
cd ../fastdfs6jx

echo '加载fastdfs服务'
docker load -i *.tar.gz

echo 'tracker 节点启动'
docker run -dit -e FASTDFS_MODE=tracker -v /fastdfs/tracker/:/home/dfs -v /etc/fdfs/:/etc/fdfs:ro --net=host --name tracker schdai/fastdfs-nginx:v8

echo '移动client.conf  storage.conf  mod_fastdfs.conf   onginx.conf 等文件'
cp -r *.conf /etc/fdfs
cp -r *.types /etc/fdfs

echo '修改hosts文件'
echo '192.168.189.15 server1' >> /etc/hosts


echo 'storage节点启动'
docker run -dit -e FASTDFS_MODE=storage  -v /fastdfs/storage:/home/dfs -v /etc/fdfs/:/etc/fdfs:ro --net=host  --name storage schdai/fastdfs-nginx:v8
echo 'nginx启动'
docker run -dit -e FASTDFS_MODE=nginx  -v /etc/fdfs/:/etc/fdfs:ro --net=host  --name nginx schdai/fastdfs-nginx:v8


echo '停止并重启storage'
docker stop storage
docker start storage

echo '停止并重启tracker'
docker stop tracker
docker start tracker


echo '停止并重启nginx'
docker stop nginx
docker start nginx

echo 'Fdfs服务启动状态'
ps -ef|grep fdfs

echo 'nginx服务启动状态'
ps -ef|grep nginx

5.运行安装脚本

./dockerfastdfsservice.sh

等待安装完成,此时已经安装完成,

安装的存储位置:
Docker安装及fastdfs安装(单机版本)
配置文件比较重要:
Docker安装及fastdfs安装(单机版本)

6.测试fastdfs服务,进入容器命令

docker exec -it storage bash
或docker exec -it storage /bin/bash

7.查看fastdfs服务状态

fdfs_monitor /etc/fdfs/storage.conf

8.执行上传命令,上传图片tomcat.png 文件路径:/etc/fdfs/tomcat.png(可替换)

fdfs_test /etc/fdfs/client.conf upload /etc/fdfs/tomcat.png
成功路径:http://192.168.189.15/group1/M00/00/00/wKi9D2DCOz-ANQpkAAAT7xB89zE699.png

Docker安装及fastdfs安装(单机版本)

9.测试文件删除

fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKi9D2DCOz-ANQpkAAAT7xB89zE699.png

10.防火墙相关命令

 查看防火墙状态
 systemctl status firewalld
 停止防火墙
 systemctl stop firewalld
 启动防火墙
 systemctl start firewalld
 禁止防火墙开启
systemctl disable firewalld

(根据防火墙状态决定是否开放端口号)(fastdfs所需端口号):

firewall-cmd --zone=public  --permanent --add-port=23000/tcp
firewall-cmd --zone=public  --permanent --add-port=22122/tcp
firewall-cmd --zone=public  --permanent --add-port=8888/tcp

11.fastdfs日志位置:
tail /fastdfs/storage/logs/storaged.log tail /fastdfs/tracker/logs/trackerd.log

上一篇:FastDFS安装


下一篇:FastDFS安装教程(单机)