阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

FastDFS分布式文件系统安装与使用(单节点)

428次阅读
没有评论

共计 13880 个字符,预计需要花费 35 分钟才能阅读完成。

FastDFS 是由淘宝的余庆先生所开发,是一个轻量级、高性能的开源分布式文件系统,用纯 C 语言开发,包括文件存储、文件同步、文件访问(上传、下载)、存取负载均衡、在线扩容、相同内容只存储一份等功能,适合有大容量存储需求的应用或系统。做分布式系统开发时,其中要解决的一个问题就是图片、音视频、文件共享的问题,分布式文件系统正好可以解决这个需求。同类的分布式文件系统有谷歌的 GFS、HDFS(Hadoop)、TFS(淘宝)等。

源码开放下载地址:https://github.com/happyfish100
早期源码开放下载地址:https://sourceforge.net/projects/fastdfs/files/

CentOS6 环境单服务器 FastDFS+Nginx+fastdfs-nginx-module 安装配置 http://www.linuxidc.com/Linux/2015-01/111889.htm

Ubuntu 14.04 下部署 FastDFS 5.08+Nginx 1.9.14 http://www.linuxidc.com/Linux/2016-07/133485.htm

CentOS 6.2 下 fastDFS 的完整安装和配置步骤 http://www.linuxidc.com/Linux/2012-12/75989.htm

FastDFS 在 Ubuntu 下的安装,PHP 客户端 http://www.linuxidc.com/Linux/2012-09/71459.htm

FastDFS 分布式文件服务器安装,及配置,测试 http://www.linuxidc.com/Linux/2012-09/71458.htm

CentOS 7 安装配置分布式文件系统 FastDFS 5.0.5  http://www.linuxidc.com/Linux/2016-09/135537.htm

FastDFS 分布式存储服务器安装过程详解 http://www.linuxidc.com/Linux/2016-10/136544.htm

FastDFS 之文件服务器集群部署详解 http://www.linuxidc.com/Linux/2017-01/139891.htm

FastDFS 系统架构

FastDFS 分布式文件系统安装与使用(单节点)

FastDFS 文件上传流程:

FastDFS 分布式文件系统安装与使用(单节点)

1、client 询问 tracker 上传到的 storage,不需要附加参数;
2、tracker 返回一台可用的 storage;
3、client 直接和 storage 通讯完成文件上传。

FastDFS 文件下载流程:

FastDFS 分布式文件系统安装与使用(单节点)

1、client 询问 tracker 下载文件的 storage,参数为文件标识(组名和文件名);
2、tracker 返回一台可用的 storage;
3、client 直接和 storage 通讯完成文件下载。

术语

FastDFS 两个主要的角色:Tracker Server 和 Storage Server
Tracker Server:跟踪服务器,主要负责调度 storage 节点与 client 通信,在访问上起负载均衡的作用,和记录 storage 节点的运行状态,是连接 client 和 storage 节点的枢纽。
Storage Server:存储服务器,保存文件和文件的 meta data(元数据)
Group:文件组,也可以称为卷。同组内服务器上的文件是完全相同的,做集群时往往一个组会有多台服务器,上传一个文件到同组内的一台机器上后,FastDFS 会将该文件即时同步到同组内的其它所有机器上,起到备份的作用。
meta data:文件相关属性,键值对(Key Value Pair)方式,如:width=1024, height=768。和阿里云 OSS 的 meta data 相似。

FastDFS 单节点安装 – 服务器规划:

跟踪服务器(Tracker Server):192.168.0.200
存储服务器(Storage Server):192.168.0.201
操作系统:CentOS7
用户:root
数据存储目录:/fastdfs
安装包:
fastdfs-master-V5.05.zip:FastDFS 源码
libfastcommon-master.zip:(从 FastDFS 和 FastDHT 中提取出来的公共 C 函数库)
fastdfs-nginx-module-master.zip:storage 节点 http 服务 nginx 模块
nginx-1.10.0.tar.gz:Nginx 安装包
ngx_cache_purge-2.3.tar.gz:图片缓存清除 Nginx 模块(集群环境会用到)

可以到 Linux 公社资源站下载所有安装包:

—————————————— 分割线 ——————————————

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2017 年资料 / 2 月 / 9 日 /FastDFS 分布式文件系统安装与使用(单节点)/

下载方法见 http://www.linuxidc.com/Linux/2013-07/87684.htm

—————————————— 分割线 ——————————————

你也可以从作者 github 官网去下载。

下载完成后,将压缩包解压到 /usr/local/src 目录下

一、所有 tracker 和 storage 节点都执行如下操作

1、安装所需的依赖包

shell> yum install make cmake gcc gcc-c++

2、安装 libfatscommon

shell> cd /usr/local/src
shell> unzip libfastcommon-master.zip
shell> cd libfastcommon-master
shell> ll
-rw-r--r--. 1 root root 6670 10 月  8 09:39 HISTORY
-rw-r--r--. 1 root root  566 10 月  8 09:39 INSTALL
-rw-r--r--. 1 root root 1438 10 月  8 09:39 libfastcommon.spec
-rwxr-xr-x. 1 root root 3099 108 09:39 make.sh
drwxr-xr-x. 2 root root 4096 108 09:39 php-fastcommon
-rw-r--r--. 1 root root  812 10 月  8 09:39 README
drwxr-xr-x. 3 root root 4096 108 09:39 src
## 编译、安装
shell> ./make.sh
shell> ./make.sh install

3、安装 FastDFS

shell> cd /usr/local/src
shell> unzip fastdfs-master-V5.05.zip
shell> cd fastdfs-master
shell> ll
[root@localhost fastdfs-master]# ll
drwxr-xr-x. 3 root root  4096 8 月   8 15:17 client
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 common
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 conf
-rw-r--r--. 1 root root 35067 88 15:17 COPYING-3_0.txt
-rw-r--r--. 1 root root  2881 88 15:17 fastdfs.spec
-rw-r--r--. 1 root root 32259 88 15:17 HISTORY
drwxr-xr-x. 2 root root    46 8 月   8 15:17 init.d
-rw-r--r--. 1 root root  7755 88 15:17 INSTALL
-rwxr-xr-x. 1 root root  5548 88 15:17 make.sh
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 php_client
-rw-r--r--. 1 root root  2380 88 15:17 README.md
-rwxr-xr-x. 1 root root  1768 88 15:17 restart.sh
-rwxr-xr-x. 1 root root  1680 88 15:17 stop.sh
drwxr-xr-x. 4 root root  4096 8 月   8 15:17 storage
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 test
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 tracker
## 编译、安装
shell> ./make.sh
shell> ./make.sh install

采用默认安装方式,相应的文件与目录如下:

1> 服务脚本:

/etc/init.d/fdfs_storaged
/etc/init.d/fdfs_trackerd

2> 配置文件(示例配置文件):

/etc/fdfs
shell> ll /etc/fdfs/
总用量 20
-rw-r--r--. 1 root root 1461 10 月 17 15:15 client.conf.sample
-rw-r--r--. 1 root root 7927 10 月 17 15:15 storage.conf.sample
-rw-r--r--. 1 root root 7200 10 月 17 15:15 tracker.conf.sample

3> 命令行工具(/usr/bin 目录下)

shell> ll /usr/bin/ | grep fdfs
-rwxr-xr-x.   1 root root      315391 1017 15:15 fdfs_appender_test
-rwxr-xr-x.   1 root root      315168 1017 15:15 fdfs_appender_test1
-rwxr-xr-x.   1 root root      302016 1017 15:15 fdfs_append_file
-rwxr-xr-x.   1 root root      301692 1017 15:15 fdfs_crc32
-rwxr-xr-x.   1 root root      302075 1017 15:15 fdfs_delete_file
-rwxr-xr-x.   1 root root      302810 1017 15:15 fdfs_download_file
-rwxr-xr-x.   1 root root      302400 1017 15:15 fdfs_file_info
-rwxr-xr-x.   1 root root      316229 1017 15:15 fdfs_monitor
-rwxr-xr-x.   1 root root     1101974 1017 15:15 fdfs_storaged
-rwxr-xr-x.   1 root root      325327 1017 15:15 fdfs_test
-rwxr-xr-x.   1 root root      320448 1017 15:15 fdfs_test1
-rwxr-xr-x.   1 root root      447878 1017 15:15 fdfs_trackerd
-rwxr-xr-x.   1 root root      303002 1017 15:15 fdfs_upload_appender
-rwxr-xr-x.   1 root root      304022 1017 15:15 fdfs_upload_file

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2017-02/140419p2.htm

二、配置 tracker 服务器

1> 复制 tracker 样例配置文件,并重命名

shell> cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
  • 1
  • 1

2> 修改 tracker 配置文件

shell> vim /etc/fdfs/tracker.conf
# 修改的内容如下:
disabled=false              # 启用配置文件
port=22122                  # tracker 服务器端口(默认 22122)
base_path=/fastdfs/tracker  # 存储日志和数据的根目录

其它参数保留默认配置,具体配置解释可参考官方文档说明:http://www.linuxidc.com/Linux/2017-02/140416.htm

3> 创建 base_path 指定的目录

shell> mkdir -p /fastdfs/tracker

4> 防火墙中打开 tracker 服务器端口(默认为 22122)
shell> vi /etc/sysconfig/iptables
添加如下端口行:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22122 -j ACCEPT
重启防火墙:
shell> service iptables restart

5> 启动 tracker 服务器

shell> /etc/init.d/fdfs_trackerd start

初次启动,会在 /fastdfs/tracker 目录下生成 logs、data 两个目录。
FastDFS 分布式文件系统安装与使用(单节点)

检查 FastDFS Tracker Server 是否启动成功:
ps -ef | grep fdfs_trackerd
FastDFS 分布式文件系统安装与使用(单节点)

6> 停止 tracker 服务器

shell> /etc/init.d/fdfs_trackerd stop

7> 设置 tracker 服务开机启动

shell> chkconfig fdfs_trakcerd on

三、配置 storage 服务器

1> 复制 storage 样例配置文件,并重命名

shell> cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf

2> 编辑配置文件

shell> vi /etc/fdfs/storage.conf

# 修改的内容如下:
disabled=false                      # 启用配置文件
port=23000                          # storage 服务端口
base_path=/fastdfs/storage          # 数据和日志文件存储根目录
store_path0=/fastdfs/storage        # 第一个存储目录
tracker_server=192.168.0.200:22122  # tracker 服务器 IP 和端口
http.server_port=8888               # http 访问文件的端口

其它参数保留默认配置,具体配置解释可参考官方文档说明:http://www.linuxidc.com/Linux/2017-02/140416.htm

3> 创建基础数据目录

shell> mkdir -p /fastdfs/storage

4> 防火墙中打开 storage 服务器端口(默认为 23000)
shell> vi /etc/sysconfig/iptables
添加如下端口行:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 23000 -j ACCEPT
重启防火墙:
shell> service iptables restart

5> 启动 storage 服务器

shell> /etc/init.d/fdfs_storaged start

初次启动,会在 /fastdfs/storage 目录下生成 logs、data 两个目录。
FastDFS 分布式文件系统安装与使用(单节点)

检查 FastDFS Tracker Server 是否启动成功:
ps -ef | grep fdfs_storaged
FastDFS 分布式文件系统安装与使用(单节点)

6> 停止 storage 服务器

shell> /etc/init.d/fdfs_storaged stop

7> 设置 storage 服务开机启动

shell> chkconfig fdfs_storaged on

四、文件上传测试(192.168.0.200)

1> 修改 Tracker 服务器客户端配置文件

shell> cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
shell> vim /etc/fdfs/client.conf
# 修改以下配置,其它保持默认
base_path=/fastdfs/tracker
tracker_server=192.168.0.200:22122

2> 执行文件上传命令

shell> /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /usr/include/stdio.h 

返回文件 ID 号:group1/M00/00/00/wKgAyVgEjSGANYtkAAB7mZt7HdQ08538.h
(能返回以上文件 ID,说明文件已经上传成功)
 这里写图片描述

FastDFS 是由淘宝的余庆先生所开发,是一个轻量级、高性能的开源分布式文件系统,用纯 C 语言开发,包括文件存储、文件同步、文件访问(上传、下载)、存取负载均衡、在线扩容、相同内容只存储一份等功能,适合有大容量存储需求的应用或系统。做分布式系统开发时,其中要解决的一个问题就是图片、音视频、文件共享的问题,分布式文件系统正好可以解决这个需求。同类的分布式文件系统有谷歌的 GFS、HDFS(Hadoop)、TFS(淘宝)等。

源码开放下载地址:https://github.com/happyfish100
早期源码开放下载地址:https://sourceforge.net/projects/fastdfs/files/

CentOS6 环境单服务器 FastDFS+Nginx+fastdfs-nginx-module 安装配置 http://www.linuxidc.com/Linux/2015-01/111889.htm

Ubuntu 14.04 下部署 FastDFS 5.08+Nginx 1.9.14 http://www.linuxidc.com/Linux/2016-07/133485.htm

CentOS 6.2 下 fastDFS 的完整安装和配置步骤 http://www.linuxidc.com/Linux/2012-12/75989.htm

FastDFS 在 Ubuntu 下的安装,PHP 客户端 http://www.linuxidc.com/Linux/2012-09/71459.htm

FastDFS 分布式文件服务器安装,及配置,测试 http://www.linuxidc.com/Linux/2012-09/71458.htm

CentOS 7 安装配置分布式文件系统 FastDFS 5.0.5  http://www.linuxidc.com/Linux/2016-09/135537.htm

FastDFS 分布式存储服务器安装过程详解 http://www.linuxidc.com/Linux/2016-10/136544.htm

FastDFS 之文件服务器集群部署详解 http://www.linuxidc.com/Linux/2017-01/139891.htm

FastDFS 系统架构

FastDFS 分布式文件系统安装与使用(单节点)

FastDFS 文件上传流程:

FastDFS 分布式文件系统安装与使用(单节点)

1、client 询问 tracker 上传到的 storage,不需要附加参数;
2、tracker 返回一台可用的 storage;
3、client 直接和 storage 通讯完成文件上传。

FastDFS 文件下载流程:

FastDFS 分布式文件系统安装与使用(单节点)

1、client 询问 tracker 下载文件的 storage,参数为文件标识(组名和文件名);
2、tracker 返回一台可用的 storage;
3、client 直接和 storage 通讯完成文件下载。

术语

FastDFS 两个主要的角色:Tracker Server 和 Storage Server
Tracker Server:跟踪服务器,主要负责调度 storage 节点与 client 通信,在访问上起负载均衡的作用,和记录 storage 节点的运行状态,是连接 client 和 storage 节点的枢纽。
Storage Server:存储服务器,保存文件和文件的 meta data(元数据)
Group:文件组,也可以称为卷。同组内服务器上的文件是完全相同的,做集群时往往一个组会有多台服务器,上传一个文件到同组内的一台机器上后,FastDFS 会将该文件即时同步到同组内的其它所有机器上,起到备份的作用。
meta data:文件相关属性,键值对(Key Value Pair)方式,如:width=1024, height=768。和阿里云 OSS 的 meta data 相似。

FastDFS 单节点安装 – 服务器规划:

跟踪服务器(Tracker Server):192.168.0.200
存储服务器(Storage Server):192.168.0.201
操作系统:CentOS7
用户:root
数据存储目录:/fastdfs
安装包:
fastdfs-master-V5.05.zip:FastDFS 源码
libfastcommon-master.zip:(从 FastDFS 和 FastDHT 中提取出来的公共 C 函数库)
fastdfs-nginx-module-master.zip:storage 节点 http 服务 nginx 模块
nginx-1.10.0.tar.gz:Nginx 安装包
ngx_cache_purge-2.3.tar.gz:图片缓存清除 Nginx 模块(集群环境会用到)

可以到 Linux 公社资源站下载所有安装包:

—————————————— 分割线 ——————————————

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2017 年资料 / 2 月 / 9 日 /FastDFS 分布式文件系统安装与使用(单节点)/

下载方法见 http://www.linuxidc.com/Linux/2013-07/87684.htm

—————————————— 分割线 ——————————————

你也可以从作者 github 官网去下载。

下载完成后,将压缩包解压到 /usr/local/src 目录下

一、所有 tracker 和 storage 节点都执行如下操作

1、安装所需的依赖包

shell> yum install make cmake gcc gcc-c++

2、安装 libfatscommon

shell> cd /usr/local/src
shell> unzip libfastcommon-master.zip
shell> cd libfastcommon-master
shell> ll
-rw-r--r--. 1 root root 6670 10 月  8 09:39 HISTORY
-rw-r--r--. 1 root root  566 10 月  8 09:39 INSTALL
-rw-r--r--. 1 root root 1438 10 月  8 09:39 libfastcommon.spec
-rwxr-xr-x. 1 root root 3099 108 09:39 make.sh
drwxr-xr-x. 2 root root 4096 108 09:39 php-fastcommon
-rw-r--r--. 1 root root  812 10 月  8 09:39 README
drwxr-xr-x. 3 root root 4096 108 09:39 src
## 编译、安装
shell> ./make.sh
shell> ./make.sh install

3、安装 FastDFS

shell> cd /usr/local/src
shell> unzip fastdfs-master-V5.05.zip
shell> cd fastdfs-master
shell> ll
[root@localhost fastdfs-master]# ll
drwxr-xr-x. 3 root root  4096 8 月   8 15:17 client
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 common
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 conf
-rw-r--r--. 1 root root 35067 88 15:17 COPYING-3_0.txt
-rw-r--r--. 1 root root  2881 88 15:17 fastdfs.spec
-rw-r--r--. 1 root root 32259 88 15:17 HISTORY
drwxr-xr-x. 2 root root    46 8 月   8 15:17 init.d
-rw-r--r--. 1 root root  7755 88 15:17 INSTALL
-rwxr-xr-x. 1 root root  5548 88 15:17 make.sh
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 php_client
-rw-r--r--. 1 root root  2380 88 15:17 README.md
-rwxr-xr-x. 1 root root  1768 88 15:17 restart.sh
-rwxr-xr-x. 1 root root  1680 88 15:17 stop.sh
drwxr-xr-x. 4 root root  4096 8 月   8 15:17 storage
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 test
drwxr-xr-x. 2 root root  4096 8 月   8 15:17 tracker
## 编译、安装
shell> ./make.sh
shell> ./make.sh install

采用默认安装方式,相应的文件与目录如下:

1> 服务脚本:

/etc/init.d/fdfs_storaged
/etc/init.d/fdfs_trackerd

2> 配置文件(示例配置文件):

/etc/fdfs
shell> ll /etc/fdfs/
总用量 20
-rw-r--r--. 1 root root 1461 10 月 17 15:15 client.conf.sample
-rw-r--r--. 1 root root 7927 10 月 17 15:15 storage.conf.sample
-rw-r--r--. 1 root root 7200 10 月 17 15:15 tracker.conf.sample

3> 命令行工具(/usr/bin 目录下)

shell> ll /usr/bin/ | grep fdfs
-rwxr-xr-x.   1 root root      315391 1017 15:15 fdfs_appender_test
-rwxr-xr-x.   1 root root      315168 1017 15:15 fdfs_appender_test1
-rwxr-xr-x.   1 root root      302016 1017 15:15 fdfs_append_file
-rwxr-xr-x.   1 root root      301692 1017 15:15 fdfs_crc32
-rwxr-xr-x.   1 root root      302075 1017 15:15 fdfs_delete_file
-rwxr-xr-x.   1 root root      302810 1017 15:15 fdfs_download_file
-rwxr-xr-x.   1 root root      302400 1017 15:15 fdfs_file_info
-rwxr-xr-x.   1 root root      316229 1017 15:15 fdfs_monitor
-rwxr-xr-x.   1 root root     1101974 1017 15:15 fdfs_storaged
-rwxr-xr-x.   1 root root      325327 1017 15:15 fdfs_test
-rwxr-xr-x.   1 root root      320448 1017 15:15 fdfs_test1
-rwxr-xr-x.   1 root root      447878 1017 15:15 fdfs_trackerd
-rwxr-xr-x.   1 root root      303002 1017 15:15 fdfs_upload_appender
-rwxr-xr-x.   1 root root      304022 1017 15:15 fdfs_upload_file

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2017-02/140419p2.htm

五、在所有 storage 节点安装 fastdfs-nginx-module

1> fastdfs-nginx-module 作用说明
FastDFS 通过 Tracker 服务器,将文件放在 Storage 服务器存储,但是同组存储服务器之间需要进入文件复制,有同步延迟的问题。假 Tracker 服务器将文件上传到了 192.168.0.201,上传成功后文件 ID 已经返回给客户端。此时 FastDFS 存储集群机制会将这个文件同步到同组存储 192.168.0.202,在文件还没有复制完成的情况下,客户端如果用这个文件 ID 在 192.168.4.126 上取文件,就会出现文件无法访问的错误。而 fastdfs-nginx-module 可以重定向文件连接到源服务器取文件,避免客户端由于复制延迟导致的文件无法访问错误

2> 解压 fastdfs-nginx-module-master.zip

shell> cd /usr/local/src
shell> unzip fastdfs-nginx-module-master.zip

3> 安装 Nginx
Nginx 安装请参考《Nginx 源码安装》

注意:在执行./configure 配置 nginx 参数的时候,需要将 fastdfs-nginx-moudle 源码作为模块编译进去:./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src

4> 复制 fastdfs-nginx-module 源码中的配置文件到 /etc/fdfs 目录,并修改

shell> cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
shell> vi /etc/fdfs/mod_fastdfs.conf

修改以下配置:

connect_timeout=10                  # 客户端访问文件连接超时时长(单位:秒)
base_path=/tmp                      # 临时目录
tracker_server=192.168.0.200:22122  # tracker 服务 IP 和端口
storage_server_port=23000           # storage 服务端口
group_name=group1                   # 组名
url_have_group_name=true            # 访问链接前缀加上组名
store_path0=/fastdfs/storage        # 文件存储路径

其它配置保持默认即可。

5> 复制 FastDFS 的部分配置文件到 /etc/fdfs 目录

shell> cd /usr/local/src/fastdfs-master/conf
shell> cp http.conf mime.types /etc/fdfs/

6> 在 /fastdfs/storage 文件存储目录下创建软连接,将其链接到实际存放数据的目录

shell> ln -s /fastdfs/storage/data/ /fastdfs/storage/data/M00

7> 配置 nginx 访问 storage 文件
简洁版 nginx 配置:

user nobody;
worker_processes 1;
events {worker_connections 1024;}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    server {
        listen 8888;
        server_name localhost;
        location ~/group([0-9])/M00 {ngx_fastdfs_module;}
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {root html;}
    }
}

注意事项:
A> 8888 端口值是要与 /etc/fdfs/storage.conf 中的 http.server_port=8888 相对应,因为 http.server_port 默认为 8888,如果想改成 80,则要对应修改过来。
B> Storage 对应有多个 group 的情况下,访问路径带 group 名,如/group1/M00/00/00/xxx,对应的 Nginx 配置为:

location ~/group([0-9])/M00 {ngx_fastdfs_module;}

C> 如查下载时如发现老报 404,将 nginx.conf 第一行 user nobody 修改为 user root 后重新启动。

8> 防火墙中打开 Nginx 的 8888 端口
vi /etc/sysconfig/iptables

添加:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8888 -j ACCEPT

重新启动防火墙:

shell> service iptables restart

9> 启动 Nginx

shell> /usr/bin/nginx
ngx_http_fastdfs_set pid=xxx

nginx 重启命令为:/usr/sbin/nginx -s reload
启动 nginx 后,如果打印出 ngx_http_fastdfs_set pid=xxx,表示 fastdfs-nginx-module 模块加载成功了,xxx 表示模块的进程 ID。

10> 通过浏览器访问测试时上传的文件
测试上传后返回的文件 ID 为:group1/M00/00/00/wKgAyVgEjSGANYtkAAB7mZt7HdQ08538.h,用浏览访问的地址为:http://192.168.0.201:8888/group1/M00/00/00/wKgAyVgEjSGANYtkAAB7mZt7HdQ08538.h

注意:千万不要使用 kill -9 命令强杀 FastDFS 进程,否则可能会导致 binlog 数据丢失。

FastDFS 的详细介绍:请点这里
FastDFS 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-02/140419.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计13880字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中

星哥玩云

星哥玩云
星哥玩云
分享互联网知识
用户数
4
文章数
19350
评论数
4
阅读量
7956707
文章搜索
热门文章
星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛 NAS-6:抖音视频同步工具,视频下载自动下载保存 前言 各位玩 NAS 的朋友好,我是星哥!...
星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛 NAS-3:安装飞牛 NAS 后的很有必要的操作 前言 如果你已经有了飞牛 NAS 系统,之前...
我把用了20年的360安全卫士卸载了

我把用了20年的360安全卫士卸载了

我把用了 20 年的 360 安全卫士卸载了 是的,正如标题你看到的。 原因 偷摸安装自家的软件 莫名其妙安装...
再见zabbix!轻量级自建服务器监控神器在Linux 的完整部署指南

再见zabbix!轻量级自建服务器监控神器在Linux 的完整部署指南

再见 zabbix!轻量级自建服务器监控神器在 Linux 的完整部署指南 在日常运维中,服务器监控是绕不开的...
飞牛NAS中安装Navidrome音乐文件中文标签乱码问题解决、安装FntermX终端

飞牛NAS中安装Navidrome音乐文件中文标签乱码问题解决、安装FntermX终端

飞牛 NAS 中安装 Navidrome 音乐文件中文标签乱码问题解决、安装 FntermX 终端 问题背景 ...
阿里云CDN
阿里云CDN-提高用户访问的响应速度和成功率
随机文章
我用AI做了一个1978年至2019年中国大陆企业注册的查询网站

我用AI做了一个1978年至2019年中国大陆企业注册的查询网站

我用 AI 做了一个 1978 年至 2019 年中国大陆企业注册的查询网站 最近星哥在 GitHub 上偶然...
星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛 NAS-3:安装飞牛 NAS 后的很有必要的操作 前言 如果你已经有了飞牛 NAS 系统,之前...
零成本上线!用 Hugging Face免费服务器+Docker 快速部署HertzBeat 监控平台

零成本上线!用 Hugging Face免费服务器+Docker 快速部署HertzBeat 监控平台

零成本上线!用 Hugging Face 免费服务器 +Docker 快速部署 HertzBeat 监控平台 ...
每年0.99刀,拿下你的第一个顶级域名,详细注册使用

每年0.99刀,拿下你的第一个顶级域名,详细注册使用

每年 0.99 刀,拿下你的第一个顶级域名,详细注册使用 前言 作为长期折腾云服务、域名建站的老玩家,星哥一直...
【1024程序员】我劝你赶紧去免费领一个AWS、华为云等的主机

【1024程序员】我劝你赶紧去免费领一个AWS、华为云等的主机

【1024 程序员】我劝你赶紧去免费领一个 AWS、华为云等的主机 每年 10 月 24 日,程序员们都会迎来...

免费图片视频管理工具让灵感库告别混乱

一言一句话
-「
手气不错
星哥带你玩飞牛NAS硬件 01:捡垃圾的最爱双盘,暴风二期矿渣为何成不老神话?

星哥带你玩飞牛NAS硬件 01:捡垃圾的最爱双盘,暴风二期矿渣为何成不老神话?

星哥带你玩飞牛 NAS 硬件 01:捡垃圾的最爱双盘,暴风二期矿渣为何成不老神话? 前言 在选择 NAS 用预...
让微信公众号成为 AI 智能体:从内容沉淀到智能问答的一次升级

让微信公众号成为 AI 智能体:从内容沉淀到智能问答的一次升级

让微信公众号成为 AI 智能体:从内容沉淀到智能问答的一次升级 大家好,我是星哥,之前写了一篇文章 自己手撸一...
支付宝、淘宝、闲鱼又双叕崩了,Cloudflare也瘫了连监控都挂,根因藏在哪?

支付宝、淘宝、闲鱼又双叕崩了,Cloudflare也瘫了连监控都挂,根因藏在哪?

支付宝、淘宝、闲鱼又双叕崩了,Cloudflare 也瘫了连监控都挂,根因藏在哪? 最近两天的互联网堪称“故障...
手把手教你,购买云服务器并且安装宝塔面板

手把手教你,购买云服务器并且安装宝塔面板

手把手教你,购买云服务器并且安装宝塔面板 前言 大家好,我是星哥。星哥发现很多新手刚接触服务器时,都会被“选购...
星哥带你玩飞牛NAS-16:飞牛云NAS换桌面,fndesk图标管理神器上线!

星哥带你玩飞牛NAS-16:飞牛云NAS换桌面,fndesk图标管理神器上线!

  星哥带你玩飞牛 NAS-16:飞牛云 NAS 换桌面,fndesk 图标管理神器上线! 引言 哈...