一、FastDFS介绍
1.1.简介
FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。
FastDFS为互联网量身定制,充分考虑了冗余备份、负载均衡、线性扩容等机制,并注重高可用、高性能等指标,使用FastDFS很容易搭建一套高性能的文件服务器集群提供文件上传、下载等服务。
FastDFS构成:
(1)Tracker Server:跟踪服务器。主要起到负载均衡和调度作用。在客户端上传文件时通过策略找到storage server提供上传服务。每个 storage 在启动后会连接 Tracker,告知自己所属 group 等信息,并保持周期性心跳。
(2)Storage Server:存储服务器。主要提供容量和备份服务。以 group 为单位,每个 group 内可以有多个 storage server,数据互为备份。
(3)Client:客户端。通过接口,使用 TCP/IP 协议与跟踪器服务器或存储节点进行数据交互。
1.2.架构图
1.3.fastdfs存储策略
存储节点(服务器)为了支持大容量采用了分卷(或分组)的组织方式。存储系统由一个或多个卷组成,卷与卷之间的文件是相互独立的,所有卷的文件容量累加就是整个存储系统中的文件容量。一个卷可以由一台或多台存储服务器组成,一个卷下的存储服务器中的文件都是相同的,卷中的多台存储服务器起到了冗余备份和负载均衡的作用。在卷中增加服务器时,同步已有的文件由系统自动完成,同步完成后,系统自动将新增服务器切换到线上提供服务。当存储空间不足或即将耗尽时,可以动态添加卷。只需要增加一台或多台服务器,并将它们配置为一个新的卷,这样就扩大了存储系统的容量。
1.4.fastdfs上传过程
FastDFS提供了基本文件访问接口,如:upload、download、append、delete等。Storage Server会定期的向 Tracker Server发送自己的存储信息。当Tracker集群中的 Tracker Server不止一个时,各个Tracker之间的关系是对等的,所以客户端上传时可以选择任意一个Tracker。当 Tracker 收到客户端上传文件连接请求时,会为该文件分配一个可以存储文件的group,接着给客户端分配group中的具体的 storage server 并返回 storage 相关信息(ip与端口) 给客户端。接着客户端向 storage 发送写文件请求后 storage 将会为文件分配一个数据存储目录,然后为文件分配一个file_id并写入磁盘之后返回给客户端。
1.5.fastdfs文件同步
文件同步只能在同组内的storage之间进行,采用push方式, 即源服务器同步到目标服务器。在storage server 写完文件后同时刷入binlog,binlog里不包含文件数据,只包含文件名等元信息,并由后台线程将binlog 文件同步至同group内其他的storage server。同时storage会记录向group内其他storage同步的进度,以便重启后能接上次的进度继续同步。进度以时间戳的方式进行记录,所以最好能保证集群内所有server的时钟保持同步。storage的同步进度会作为元数据的一部分汇报到tracker,tracke在选择读storage 的时候会以同步进度作为参考。
1.6.fastdfs下载过程
客户端上传文件成功后,会拿到一个storage生成的file_id,客户端根据这个file_id即可访问到该文件。跟上传一样,在下载文件时客户端可以选择任意 tracker server。客户端发送下载连接请求给某个tracker,必须带上文件名信息,tracke从文件名中解析出文件的group,大小和创建时间等信息,然后为该请求选择一个storage用来服务读请求。
二、准备工作
2.1.源码编译器安装 yum -y install gcc gcc-c++ perl zlib-devel
2.2.解压缩工具安装 yum -y install unzip
2.3.预装软件包下载
(1)下载存储路径选择如下:
源码包下载(上传)目录
[root@localhost ~]# cd /usr/local/src
数据存储目录 /home/fastdfs/
(2)需要安装的组件下载
# FastDFS下载
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
# Nginx fastdfs插件包下载
wget https://github.com/happyfish100/fastdfs-nginx-module/archive/5e5f3566bbfa57418b5506aaefbe107a42c9fcb1.zip
# FastDFS依赖源码下载
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
# Nginx包下载
wget -c https://nginx.org/download/nginx-1.12.1.tar.gz
(3)源码包下载完成如下:
三、FastDFS安装
3.1.libfastcommon安装
3.1.1.解压 > 编译 > 安装
1.进入usr/local/src目录[root@localhost src]# cd /usr/local/src
2.解压 [root@localhost src]# tar -zxvf V1.0.7.tar.gz
3.进入解压后目录 [root@localhost src]# cd libfastcommon-1.0.7
4.编译 ./make.sh
[root@localhost libfastcommon-1.0.7]# ./make.sh
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o hash.lo hash.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o chain.lo chain.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o shared_func.lo shared_func.c
shared_func.c: 在函数‘getUserProcIds’中:
shared_func.c:313:25: 警告:‘%s’ directive writing up to 255 bytes into a region of size 127 [-Wformat-overflow=]
sprintf(fullpath, "%s/%s", path, dirp->d_name);
^~
shared_func.c:313:3: 附注:‘sprintf’ output 2 or more bytes (assuming 257) into a destination of size 128
sprintf(fullpath, "%s/%s", path, dirp->d_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ini_file_reader.lo ini_file_reader.c
ini_file_reader.c: 在函数‘iniLoadFromFile’中:
ini_file_reader.c:134:11: 警告:‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
"%s/%s", pContext->config_path, szFilename);
^
ini_file_reader.c:133:4: 附注:‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
snprintf(full_filename, sizeof(full_filename), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s/%s", pContext->config_path, szFilename);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ini_file_reader.c: 在函数‘iniDoLoadItemsFromBuffer’中:
ini_file_reader.c:307:12: 警告:‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
"%s/%s", pContext->config_path, \
^
ini_file_reader.c:306:5: 附注:‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
snprintf(full_filename, sizeof(full_filename), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s/%s", pContext->config_path, \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pIncludeFilename);
~~~~~~~~~~~~~~~~~
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o logger.lo logger.c
logger.c: 在函数‘log_delete_matched_old_files’中:
logger.c:360:5: 警告:‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dir, &ent, &pEntry) == 0)
^~~~~
In file included from /usr/include/features.h:428:0,
from /usr/include/bits/libc-header-start.h:33,
from /usr/include/limits.h:26,
from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/include/limits.h:194,
from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/include/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/include/limits.h:34,
from logger.c:9:
/usr/include/dirent.h:189:12: 附注:在此声明
extern int __REDIRECT (readdir_r,
^
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o sockopt.lo sockopt.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o base64.lo base64.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o sched_thread.lo sched_thread.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o http_func.lo http_func.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o md5.lo md5.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o pthread_func.lo pthread_func.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o local_ip_func.lo local_ip_func.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o avl_tree.lo avl_tree.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ioevent.lo ioevent.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ioevent_loop.lo ioevent_loop.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o fast_task_queue.lo fast_task_queue.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o fast_timer.lo fast_timer.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o process_ctrl.lo process_ctrl.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o fast_mblock.lo fast_mblock.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o connection_pool.lo connection_pool.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o libfastcommon.so -shared hash.lo chain.lo shared_func.lo ini_file_reader.lo logger.lo sockopt.lo base64.lo sched_thread.lo http_func.lo md5.lo pthread_func.lo local_ip_func.lo avl_tree.lo ioevent.lo ioevent_loop.lo fast_task_queue.lo fast_timer.lo process_ctrl.lo fast_mblock.lo connection_pool.lo
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o hash.o hash.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o chain.o chain.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o shared_func.o shared_func.c
shared_func.c: 在函数‘getUserProcIds’中:
shared_func.c:313:25: 警告:‘%s’ directive writing up to 255 bytes into a region of size 127 [-Wformat-overflow=]
sprintf(fullpath, "%s/%s", path, dirp->d_name);
^~
shared_func.c:313:3: 附注:‘sprintf’ output 2 or more bytes (assuming 257) into a destination of size 128
sprintf(fullpath, "%s/%s", path, dirp->d_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ini_file_reader.o ini_file_reader.c
ini_file_reader.c: 在函数‘iniLoadFromFile’中:
ini_file_reader.c:134:11: 警告:‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
"%s/%s", pContext->config_path, szFilename);
^
ini_file_reader.c:133:4: 附注:‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
snprintf(full_filename, sizeof(full_filename), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s/%s", pContext->config_path, szFilename);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ini_file_reader.c: 在函数‘iniDoLoadItemsFromBuffer’中:
ini_file_reader.c:307:12: 警告:‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
"%s/%s", pContext->config_path, \
^
ini_file_reader.c:306:5: 附注:‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
snprintf(full_filename, sizeof(full_filename), \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s/%s", pContext->config_path, \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pIncludeFilename);
~~~~~~~~~~~~~~~~~
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o logger.o logger.c
logger.c: 在函数‘log_delete_matched_old_files’中:
logger.c:360:5: 警告:‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dir, &ent, &pEntry) == 0)
^~~~~
In file included from /usr/include/features.h:428:0,
from /usr/include/bits/libc-header-start.h:33,
from /usr/include/limits.h:26,
from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/include/limits.h:194,
from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/include/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/include/limits.h:34,
from logger.c:9:
/usr/include/dirent.h:189:12: 附注:在此声明
extern int __REDIRECT (readdir_r,
^
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o sockopt.o sockopt.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o base64.o base64.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o sched_thread.o sched_thread.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o http_func.o http_func.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o md5.o md5.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o pthread_func.o pthread_func.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o local_ip_func.o local_ip_func.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o avl_tree.o avl_tree.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ioevent.o ioevent.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ioevent_loop.o ioevent_loop.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fast_task_queue.o fast_task_queue.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fast_timer.o fast_timer.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o process_ctrl.o process_ctrl.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fast_mblock.o fast_mblock.c
cc -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o connection_pool.o connection_pool.c
ar rcs libfastcommon.a hash.o
5.安装[root@localhost libfastcommon-1.0.7]# ./make.sh install
3.1.2.创建软连接
# libfastcommon.so 默认安装目录为 /usr/lib64/libfastcommon.so,由于后续FastDFS主程序设置的lib目录是/usr/local/lib,所以这里需要创建软链接
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.sor
建立完成没有则建立,有则返回文件已存在
3.2.fastdfs安装
3.2.1.解压 > 编译 > 安装
1.进入usr/local/src目录cd /usr/local/src
2.解压 [root@localhost src]# tar -zxvf V5.05.tar.gz
3.进入解压后目录 [root@localhost src]# cd fastdfs-5.05
4.编译 [root@localhost fastdfs-5.05]# ./make.sh
[root@localhost fastdfs-5.05]# ./make.sh
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../common/fdfs_global.o ../common/fdfs_global.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_proto.o tracker_proto.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_mem.o tracker_mem.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_service.o tracker_service.c -I../common -I/usr/include/fastcommon
tracker_service.c: 在函数‘tracker_deal_reselect_leader’中:
tracker_service.c:1743:21: 警告:变量‘pClientInfo’被设定但未被使用 [-Wunused-but-set-variable]
TrackerClientInfo *pClientInfo;
^~~~~~~~~~~
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_status.o tracker_status.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_global.o tracker_global.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_func.o tracker_func.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fdfs_shared_func.o fdfs_shared_func.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_nio.o tracker_nio.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_relationship.o tracker_relationship.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_dump.o tracker_dump.c -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../common/linux_stack_trace.o ../common/linux_stack_trace.c -I../common -I/usr/include/fastcommon
../common/linux_stack_trace.c: 在函数‘signal_stack_trace_print’中:
../common/linux_stack_trace.c:81:33: 警告:格式 ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘greg_t {或称 long long int}’ [-Wformat=]
pCurrent += sprintf(pCurrent, "\treg[%02d] = 0x"REGFORMAT"\n",
^~~~~~~~~~~~~~~~~~
i, ucontext->uc_mcontext.gregs[i]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../common/linux_stack_trace.c:46:26: 附注:format string is defined here
# define REGFORMAT "%016lx"
~~~~~^
%016llx
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_trackerd fdfs_trackerd.c ../common/fdfs_global.o tracker_proto.o tracker_mem.o tracker_service.o tracker_status.o tracker_global.o tracker_func.o fdfs_shared_func.o tracker_nio.o tracker_relationship.o tracker_dump.o ../common/linux_stack_trace.o -L/usr/local/lib -lpthread -ldl -rdynamic -lfastcommon -I../common -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o tracker_client_thread.o tracker_client_thread.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_global.o storage_global.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_func.o storage_func.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_service.o storage_service.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_sync.o storage_sync.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_nio.o storage_nio.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_dio.o storage_dio.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_ip_changed_dealer.o storage_ip_changed_dealer.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_param_getter.o storage_param_getter.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_disk_recovery.o storage_disk_recovery.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
storage_disk_recovery.c: 在函数‘storage_disk_recovery_start’中:
storage_disk_recovery.c:927:37: 警告:‘%s’ directive writing up to 127 bytes into a region of size between 114 and 124 [-Wformat-overflow=]
sprintf(trunkFileId.line, "%d %c %s", \
^~
storage_disk_recovery.c:929:21:
record.op_type, record.filename);
~~~~~~
storage_disk_recovery.c:927:4: 附注:‘sprintf’ output between 5 and 142 bytes into a destination of size 128
sprintf(trunkFileId.line, "%d %c %s", \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(int)record.timestamp, \
~~~~~~~~~~~~~~~~~~~~~~~~
record.op_type, record.filename);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o trunk_mgr/trunk_mem.o trunk_mgr/trunk_mem.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o trunk_mgr/trunk_shared.o trunk_mgr/trunk_shared.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o trunk_mgr/trunk_sync.o trunk_mgr/trunk_sync.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o trunk_mgr/trunk_client.o trunk_mgr/trunk_client.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o trunk_mgr/trunk_free_block_checker.o trunk_mgr/trunk_free_block_checker.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../client/client_global.o ../client/client_global.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../client/tracker_client.o ../client/tracker_client.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../client/storage_client.o ../client/storage_client.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../client/client_func.o ../client/client_func.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fdht_client/fdht_proto.o fdht_client/fdht_proto.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fdht_client/fdht_client.o fdht_client/fdht_client.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fdht_client/fdht_func.o fdht_client/fdht_func.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o fdht_client/fdht_global.o fdht_client/fdht_global.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o storage_dump.o storage_dump.c -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_storaged fdfs_storaged.c ../common/fdfs_global.o ../tracker/fdfs_shared_func.o ../tracker/tracker_proto.o tracker_client_thread.o storage_global.o storage_func.o storage_service.o storage_sync.o storage_nio.o storage_dio.o storage_ip_changed_dealer.o storage_param_getter.o storage_disk_recovery.o trunk_mgr/trunk_mem.o trunk_mgr/trunk_shared.o trunk_mgr/trunk_sync.o trunk_mgr/trunk_client.o trunk_mgr/trunk_free_block_checker.o ../client/client_global.o ../client/tracker_client.o ../client/storage_client.o ../client/client_func.o fdht_client/fdht_proto.o fdht_client/fdht_client.o fdht_client/fdht_func.o fdht_client/fdht_global.o storage_dump.o ../common/linux_stack_trace.o -L/usr/local/lib -lpthread -ldl -rdynamic -lfastcommon -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../common/fdfs_http_shared.o ../common/fdfs_http_shared.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -o ../common/mime_file_parser.o ../common/mime_file_parser.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ../common/fdfs_global.lo ../common/fdfs_global.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ../common/fdfs_http_shared.lo ../common/fdfs_http_shared.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ../common/mime_file_parser.lo ../common/mime_file_parser.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ../tracker/tracker_proto.lo ../tracker/tracker_proto.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ../tracker/fdfs_shared_func.lo ../tracker/fdfs_shared_func.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o ../storage/trunk_mgr/trunk_shared.lo ../storage/trunk_mgr/trunk_shared.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o tracker_client.lo tracker_client.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o client_func.lo client_func.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o client_global.lo client_global.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -c -fPIC -o storage_client.lo storage_client.c -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_monitor fdfs_monitor.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_test fdfs_test.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_test1 fdfs_test1.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_crc32 fdfs_crc32.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_upload_file fdfs_upload_file.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_download_file fdfs_download_file.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_delete_file fdfs_delete_file.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_file_info fdfs_file_info.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_appender_test fdfs_appender_test.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_appender_test1 fdfs_appender_test1.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_append_file fdfs_append_file.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o fdfs_upload_appender fdfs_upload_appender.c ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o -lpthread -ldl -rdynamic -lfastcommon -I../common -I../tracker -I/usr/include/fastcommon
ar cru libfdfsclient.a ../common/fdfs_global.o ../common/fdfs_http_shared.o ../common/mime_file_parser.o ../tracker/tracker_proto.o ../tracker/fdfs_shared_func.o ../storage/trunk_mgr/trunk_shared.o tracker_client.o client_func.o client_global.o storage_client.o
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -o libfdfsclient.so -shared ../common/fdfs_global.lo ../common/fdfs_http_shared.lo ../common/mime_file_parser.lo ../tracker/tracker_proto.lo ../tracker/fdfs_shared_func.lo ../storage/trunk_mgr/trunk_shared.lo tracker_client.lo client_func.lo client_global.lo storage_client.lo -lpthread -ldl -rdynamic -lfastcommon
[root@localhost fastdfs-5.05]#
View Code
5.安装 [root@localhost fastdfs-5.05]# ./make.sh install
这里熟悉下安装后的相应文件与目录后续配置会涉及:
# fastdfs服务脚本,配置文件所在路径
etc/
├── init.d/ # 服务脚本所在路径
│ ├── fdfs_storaged
│ └── fdfs_tracker
│
└── fdfs/ # 配置文件(样例模板)所在路径
├── client.conf.sample
├── storage.conf.sample
└── tracker.conf.sample
# fastdfs 命令工具所在路径
usr/
└── bin/
├── fdfs_appender_test
├── fdfs_appender_test1
├── fdfs_append_file
├── fdfs_crc32
├── fdfs_delete_file
├── fdfs_download_file
├── fdfs_monitor
├── fdfs_storaged
├── fdfs_test
├── fdfs_test1
├── fdfs_trackerd
├── fdfs_upload_appender
├── fdfs_upload_file
├── stop.sh
└── restart.sh
3.2.2.创建软连接
# FastDFS 服务脚本 bin 目录是cd /usr/local/bin, 但实际命令安装在cd /usr/bin/ 下。我们需要建立 /usr/bin 到 /usr/local/bin 的软链接
ln -s /usr/bin/fdfs_trackerd /usr/local/bin
ln -s /usr/bin/fdfs_storaged /usr/local/bin
ln -s /usr/bin/stop.sh /usr/local/bin
ln -s /usr/bin/restart.sh /usr/local/bin
创建完成如下:
3.2.3.配置启动Tracker服务
3.2.3.1. 配置Tracker
1.进入 fastdfs 的服务脚本目录 cd /etc/fdfs
2.复制 fastdfs 跟踪器样例配置文件 tracker.conf.sample,并重命名为 tracker.conf cp tracker.conf.sample tracker.conf
3.编辑配置 tracker.conf vi tracker.conf
4.修改以下两个配置
(1) tracker存储数据和日志根路径(配置后需要提前创建好)# Tracker 数据和日志目录地址(根目录必须存在,子目录会自动创建) base_path=/home/fastdfs/tracker 原有的base_path注释掉
(2)http端口(需要和nginx配置相同)。其它保持默认,保存退出 # HTTP 服务端口 http.server_port=80
附:tracker.conf配置文件解析
配置文件是否不生效,false 为生效 disabled=false
提供服务的端口 port=22122
5.创建tracker存储数据和日志目录(base_path对应的目录)
mkdir -p /home/fastdfs/tracker
3.2.3.2 .启动Tracker
1.启动 tracker(初次启动会在 base_path 路径下自动创建data、logs目录)cd /etc/init.d/-->./fdfs_trackerd start
直接执行命令:/etc/init.d/fdfs_trackerd start
2.查看 tracker 是否启动成功,22122端口正在被监听,则Tracker服务安装成功
netstat -unltp|grep fdfs
3.查看 base_path 目录结构确认已经创建data,logs目录ls /home/fastdfs/tracker/
这里简单的认识下base_path目录下data,logs结构:
base_path/
├── data/ # tracker数据存储目录
│ ├── fdfs_trackerd.pid # 记录程序运行的pid
│ ├── storage_changelog.dat # 记录更新的stroage情况
│ ├── storage_groups.dat # 存储分组信息
│ └── storage_servers.dat # 存储服务器(storage)列表
│
└── logs/ # 配置文件(样例模板)所在路径
└── trackerd.log # 日志文件,记录启动停止等信息
附:tracker服务常用命令
fdfs_trackerd start
重启动tracker服务/etc/init.d/fdfs_trackerd restart
停止tracker服务/etc/init.d/fdfs_trackerd stop
自启动tracker服务chkconfig fdfs_trackerd on
3.2.4.配置启动Storage服务
3.2.4.1.配置Storage
1.进入 fastdfs 的服务脚本目录cd /etc/fdfs
2.复制 fastdfs 存储器样例配置文件 storage.conf.sample,并重命名为 storage.conf
cp storage.conf.sample storage.conf
3.编辑配置 storage.conf
vi storage.conf
4.修改以下配置(包括注释掉配置)tracker_server配置为你安装的tracker服务所在ip。其它保持默认,保存退出
base_path=/home/fastdfs/storage 源码注释掉重新创建一行
#store_path0=/home/yuqing/fastdfs
tracker_server=192.168.65.132:22122
http.server_port=80
5.创建storage存储数据和日志目录(base_path对应的目录)
mkdir -p /home/fastdfs/storage
附:storage.conf 配置文件解析(红色为上文修改过的配置项)
# 配置文件是否不生效,lse 为生效
disabled=false
# 指定此 storage server 所在 组(卷)
group_name=group1
# storage server 服务端口
port=23000
# 心跳间隔时间,单位为秒 (这里是指主动向 tracker server 发送心跳)
heart_beat_interval=30
# Storage 数据和日志目录地址(根目录必须存在,子目录会自动生成)
base_path=/home/fastdfs/storage
# 存放文件时 storage server 支持多个路径。这里配置存放文件的基路径数目,通常只配一个目录。
store_path_count=1
# 逐一配置 store_path_count 个路径,索引号基于 0。
# 如果不配置 store_path0,那它就和 base_path 对应的路径一样,此处直接注释掉。
#store_path0=/home/yuqing/fastdfs
# FastDFS 存储文件时,采用了两级目录。这里配置存放文件的目录个数。
# 如果本参数只为 N(如: 256),那么 storage server 在初次运行时,会在 store_path 下自动创建 N * N 个存放文件的子目录。
subdir_count_per_path=256
# tracker_server 的列表 ,会主动连接 tracker_server
# 有多个 tracker server 时,每个 tracker server 写一行
tracker_server=192.168.65.132:22122
# 允许系统同步的时间段 (默认是全天) 。一般用于避免高峰同步产生一些问题而设定。
sync_start_time=00:00
sync_end_time=23:59
# 访问端口
http.server_port=80
3.2.4.1.启动Storage
1.启动 storage(初次启动会在 base_path 路径下自动创建data、logs目录)
/etc/init.d/fdfs_storaged start
2.查看 storage是否启动成功,23000端口正在被监听,则storage服务安装成功
netstat -unltp|grep fdfs
3.查看 storage 是否和 tracker在通信
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
[root@localhost ~]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
[2023-03-10 16:44:50] DEBUG - base_path=/home/fastdfs/storage, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
server_count=1, server_index=0
tracker server is 192.168.65.132:22122
group count: 1
Group 1:
group name = group1
disk total space = 50043 MB
disk free space = 20458 MB
trunk free space = 0 MB
storage server count = 1
active server count = 1
storage server port = 23000
storage HTTP port = 80
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 192.168.65.132
ip_addr = 192.168.65.132 (localhost.localdomain) ACTIVE
http domain =
version = 5.05
join time = 2023-03-10 16:43:45
up time = 2023-03-10 16:43:45
total storage = 50043 MB
free storage = 20458 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 80
current_write_path = 0
source storage id =
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 0
connection.max_count = 0
total_upload_count = 0
success_upload_count = 0
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 0
success_download_count = 0
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 0
success_upload_bytes = 0
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 0
success_download_bytes = 0
total_sync_in_bytes = 0
success_sync_in_bytes = 0
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 0
success_file_open_count = 0
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 0
success_file_write_count = 0
last_heart_beat_time = 2023-03-10 16:44:46
last_source_update = 1970-01-01 08:00:00
last_sync_update = 1970-01-01 08:00:00
last_synced_timestamp = 1970-01-01 08:00:00
ACTIVE表示storage 和 tracker在通信
同样Storage 启动成功后,在base_path 下创建了data、logs目录,且在 store_path0 目录下创建了N*N个子目录用来存放文件,由于配置文件store_path0 上文注释了,所以其路径默认为 base_path 路径。如下图所示:
[root@localhost data]# cd /home/fastdfs/storage
附:storage服务常用命令
# 启动storage服务
/etc/init.d//etc/init.d/fdfs_storaged start
# 重启动storage服务
/etc/init.d//etc/init.d/fdfs_storaged restart
# 停止storage服务
/etc/init.d//etc/init.d/fdfs_storaged stop
# 自启动storage服务
chkconfig fdfs_storaged on
3.2.5.客户端上传文件
3.2.5.1.配置Client
1.进入 fastdfs 的服务脚本目录
cd /etc/fdfs
2.复制 client 样例配置文件 client.conf.sample,并重命名为 client.conf
cp client.conf.sample client.conf
3.编辑配置 client.conf
vi client.conf
4.修改以下配置(包括注释掉配置)tracker_server配置为你安装的tracker服务所在ip。其它保持默认,保存退出base_path=/home/fastdfs/client
tracker_server=192.168.65.132:22122
5.创建client存储数据和日志目录(base_path对应的目录)
mkdir -p /home/fastdfs/client
3.2.5.1.文件上传
1.在当前操作目录下准备一张图片(我这里是在 /usr/local/src/images/ 路径下)执行以下命令上传,上传成功后返回文件id。文件id由 group+存储目录+两级子目录+文件名+文件后缀名构成
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf xxx.jpeg
、Nginx安装
4.1、安装编译工具及库文件
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
[root@localhost ~]# yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
[root@localhost ~]# yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
上次元数据过期检查:2:09:40 前,执行于 2023年03月10日 星期五 15时13分54秒。
软件包 make-1:4.3-1.ky10.x86_64 已安装。
软件包 zlib-1.2.11-18.ky10.x86_64 已安装。
软件包 zlib-devel-1.2.11-18.ky10.x86_64 已安装。
软件包 gcc-c++-7.3.0-20220207.45.p01.ky10.x86_64 已安装。
软件包 libtool-2.4.6-33.ky10.x86_64 已安装。
软件包 openssl-1:1.1.1f-15.p06.ky10.x86_64 已安装。
软件包 openssl-devel-1:1.1.1f-15.p06.ky10.x86_64 已安装。
依赖关系解决。
==========================================================================================================
Package Architecture Version Repository Size
==========================================================================================================
升级:
openssl x86_64 1:1.1.1f-15.p07.ky10 ks10-adv-updates 442 k
openssl-devel x86_64 1:1.1.1f-15.p07.ky10 ks10-adv-updates 1.8 M
openssl-help noarch 1:1.1.1f-15.p07.ky10 ks10-adv-updates 3.1 M
openssl-libs x86_64 1:1.1.1f-15.p07.ky10 ks10-adv-updates 1.4 M
openssl-perl x86_64 1:1.1.1f-15.p07.ky10 ks10-adv-updates 16 k
事务概要
==========================================================================================================
升级 5 软件包
总下载:6.7 M
下载软件包:
[MIRROR] openssl-1.1.1f-15.p07.ky10.x86_64.rpm: Curl error (28): Timeout was reached for https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/x86_64/Packages/openssl-1.1.1f-15.p07.ky10.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[MIRROR] openssl-help-1.1.1f-15.p07.ky10.noarch.rpm: Curl error (28): Timeout was reached for https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/x86_64/Packages/openssl-help-1.1.1f-15.p07.ky10.noarch.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[MIRROR] openssl-devel-1.1.1f-15.p07.ky10.x86_64.rpm: Curl error (28): Timeout was reached for https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/x86_64/Packages/openssl-devel-1.1.1f-15.p07.ky10.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[MIRROR] openssl-1.1.1f-15.p07.ky10.x86_64.rpm: Curl error (28): Timeout was reached for https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/x86_64/Packages/openssl-1.1.1f-15.p07.ky10.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[FAILED] openssl-1.1.1f-15.p07.ky10.x86_64.rpm: No more mirrors to try - All mirrors were already tried without success
(2-3/5): openssl-help-1.1.1f-15.p 26% [========- ] 81 kB/s | 1.8 MB 01:02 ETA
下载的软件包保存在缓存中,直到下次成功执行事务。
您可以通过执行 'yum clean packages' 删除软件包缓存。
错误:下载软件包出错
openssl-1:1.1.1f-15.p07.ky10.x86_64: Cannot download, all mirrors were already tried without success
再次更新一次
[root@localhost ~]# yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
Kylin Linux Advanced Server 10 - Updates
Kylin Linux Advanced Server 10 - Updates 6% [=== Kylin Linux Advanced Server 10 - Updates 2.8 kB/s | 351 kB 02:07
Errors during downloading metadata for repository 'ks10-adv-updates':
- Curl error (28): Timeout was reached for https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/x86_64/repodata/c09c746fe6f42f48363a7d883c770146a4d9bfacc3ab46c9e4c0d6dd5f80e287-filelists.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
- Curl error (28): Timeout was reached for https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/x86_64/repodata/9ce9ebc0b108f1db7aeb40e58baaeabade55f498c791f13284322251450e4087-primary.xml.gz [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
错误:Failed to download metadata for repo 'ks10-adv-updates': Yum repo downloading error: Downloading error(s): repodata/c09c746fe6f42f48363a7d883c770146a4d9bfacc3ab46c9e4c0d6dd5f80e287-filelists.xml.gz - Cannot download, all mirrors were already tried without success; repodata/9ce9ebc0b108f1db7aeb40e58baaeabade55f498c791f13284322251450e4087-primary.xml.gz - Cannot download, all mirrors were already tried without success
View Code
4.2、首先要安装 PCRE
PCRE 作用是让 Nginx 支持 Rewrite 功能。
1、下载 PCRE 安装包,下载地址: http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@bogon src]# cd /usr/local/src/
[root@bogon src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
2、解压安装包:
[root@bogon src]# tar zxvf pcre-8.35.tar.gz
3、进入安装包目录
[root@bogon src]# cd pcre-8.35
4、编译安装
[root@bogon pcre-8.35]# ./configure
[root@bogon pcre-8.35]# make && make install
5、查看pcre版本
[root@bogon pcre-8.35]# pcre-config --version
4.1.nginx安装
4.1.1.解压 > 编译 > 安装
1.进入usr/local/src目录
cd /usr/local/src
2.解压
tar -zxvf nginx-1.12.1.tar.gz
3.进入解压后目录
cd nginx-1.12.1
4.使用默认配置
./configure
[root@localhost nginx-1.12.1]# ./configure
checking for OS
+ Linux 4.19.90-52.15.v2207.ky10.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 7.3.0 (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... found
checking for O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for sched_setaffinity() ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for nobody group ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_RECVDSTADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for eventfd() ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for zlib library ... found
creating objs/Makefile
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
[root@localhost nginx-1.12.1]#
View Code
5.编译
make
[root@localhost nginx-1.12.1]# make
make -f objs/Makefile
make[1]: 进入目录“/usr/local/src/nginx-1.12.1”
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/nginx.o \
src/core/nginx.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_log.o \
src/core/ngx_log.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_palloc.o \
src/core/ngx_palloc.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_array.o \
src/core/ngx_array.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_list.o \
src/core/ngx_list.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_hash.o \
src/core/ngx_hash.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_buf.o \
src/core/ngx_buf.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_queue.o \
src/core/ngx_queue.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_output_chain.o \
src/core/ngx_output_chain.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_string.o \
src/core/ngx_string.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_parse.o \
src/core/ngx_parse.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_parse_time.o \
src/core/ngx_parse_time.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_inet.o \
src/core/ngx_inet.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_file.o \
src/core/ngx_file.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_crc32.o \
src/core/ngx_crc32.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_murmurhash.o \
src/core/ngx_murmurhash.c
src/core/ngx_murmurhash.c: 在函数‘ngx_murmur_hash2’中:
src/core/ngx_murmurhash.c:37:11: 错误:this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[2] << 16;
~~^~~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:38:5: 附注:here
case 2:
^~~~
src/core/ngx_murmurhash.c:39:11: 错误:this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[1] << 8;
~~^~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:40:5: 附注:here
case 1:
^~~~
cc1:所有的警告都被当作是错误
make[1]: *** [objs/Makefile:462:objs/src/core/ngx_murmurhash.o] 错误 1
make[1]: 离开目录“/usr/local/src/nginx-1.12.1”
make: *** [Makefile:8:build] 错误 2
View Code
6.安装
make install
未完待续,安装的nginx-1.12.1不成功,又安装nginx-1.6.2还是失败
4.1.2.启动Nginx
# 1.进入安装目录
cd /usr/local/nginx/sbin/
# 2.启动 nginx
./nginx
# 3.查看nginx版本信息(确认是否启动成功)
/usr/local/nginx/sbin/nginx -V