
参见 INSTALL 文件
cd libfastcommon
./make.sh
./make.sh install
#生成的文件
mkdir -p /usr/lib64
mkdir -p /usr/lib
install -m 755 libfastcommon.so /usr/lib64
install -m 755 libfastcommon.so /usr/lib
mkdir -p /usr/include/fastcommon
install -m 644 common_define.h hash.h chain.h logger.h base64.h shared_func.h pthread_func.h ini_file_reader.h _os_define.h sockopt.h sched_thread.h http_func.h md5.h local_ip_func.h avl_tree.h ioevent.h ioevent_loop.h fast_task_queue.h fast_timer.h process_ctrl.h fast_mblock.h connection_pool.h fast_mpool.h fast_allocator.h fast_buffer.h skiplist.h multi_skiplist.h flat_skiplist.h skiplist_common.h system_info.h fast_blocked_queue.h php7_ext_wrapper.h id_generator.h char_converter.h char_convert_loader.h /usr/include/fastcommon
直接运行 make.shfastdfs nginx,sh make.sh install直接安装
也可以修改 make.sh, 指定安装位置,第51行添加
DESTDIR=/Users/sky/all/web/fastdfs
这样所有文件都在选定目录中,方便管理.
如果指定了安装位置,安装 fastdfs-nginx-module 会找不到文件.可以只留下 bin 文件的内容,将其它文件复制至平台对应的位置.
修改配置文件
vi /etc/fdfs/tracker.conf
# the base path to store data and log files
# modify
base_path=/Users/sky/all/web/fastdfs/base/trackerd
启动
/Users/sky/all/web/fastdfs/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
修改 storage.conf
#拷贝一份新的storage配置文件:
cp storage.conf.sample storage.conf
#修改storage.conf
vi storage.conf
group_name=group1
base_path=base_path=/Users/sky/all/web/fastdfs/base/storaged
store_path0=/Users/sky/all/web/fastdfs/store
#如果有多个挂载磁盘则定义多个store_path,如下
#store_path1=.....
#store_path2=......
tracker_server=192.168.1.103:22122 #配置tracker服务器:IP
#如果有多个则配置多个tracker
#tracker_server=192.168.101.4:22122
#配置http端口
http.server_port=80

启动
/Users/sky/all/web/fastdfs/bin/fdfs_storaged /etc/fdfs/storage.conf restart
fdfs_monitor /etc/fdfs/storage.conf
/Users/sky/all/web/fastdfs/bin/fdfs_monitor /etc/fdfs/storage.conf
/Users/sky/all/web/fastdfs/bin/fdfs_monitor /etc/fdfs/client.conf
test
/Users/sky/all/web/fastdfs/bin/fdfs_test /etc/fdfs/client.conf upload /Users/sky/Pictures/pretty.jpg
测试结果
$ /Users/sky/all/web/fastdfs/bin/fdfs_test /etc/fdfs/client.conf upload /Users/sky/Pictures/pretty.jpg
This is FastDFS client test program v5.12
Copyright (C) 2008, Happy Fish / YuQing
FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
for more detail.
[2018-04-27 15:16:09] DEBUG - base_path=/Users/sky/all/web/fastdfs/base/client, 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
tracker_query_storage_store_list_without_group:
server 1. group_name=, ip_addr=192.168.1.103, port=23000
group_name=group1, ip_addr=192.168.1.103, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKgBZ1rizjmAIoMoAAAiJgI2OLI651.jpg
source ip address: 192.168.1.103
file timestamp=2018-04-27 15:16:09
file size=8742
file crc32=37107890
example file url: http://192.168.1.103:8080/group1/M00/00/00/wKgBZ1rizjmAIoMoAAAiJgI2OLI651.jpg
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKgBZ1rizjmAIoMoAAAiJgI2OLI651_big.jpg
source ip address: 192.168.1.103
file timestamp=2018-04-27 15:16:09
file size=8742
file crc32=37107890
example file url: http://192.168.1.103:8080/group1/M00/00/00/wKgBZ1rizjmAIoMoAAAiJgI2OLI651_big.jpg
配置
./configure \
--prefix=/Users/sky/all/web/nginx \
--with-http_ssl_module \
--with-pcre \
--sbin-path=/Users/sky/all/web/nginx/bin/nginx \
--with-cc-opt='-I/usr/local/opt/pcre/include -I/usr/local/opt/openssl/include' \
--with-ld-opt='-L/usr/local/opt/pcre/lib -L/usr/local/opt/openssl/lib' \
--conf-path=/Users/sky/all/web/nginx/nginx.conf \
--pid-path=/Users/sky/all/web/nginx/run/nginx.pid \
--lock-path=/Users/sky/all/web/nginx/run/nginx.lock \
--http-client-body-temp-path=/Users/sky/all/web/nginx/run/nginx/client_body_temp \
--http-proxy-temp-path=/Users/sky/all/web/nginx/run/nginx/proxy_temp \
--http-fastcgi-temp-path=/Users/sky/all/web/nginx/run/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/Users/sky/all/web/nginx/run/nginx/uwsgi_temp \
--http-scgi-temp-path=/Users/sky/all/web/nginx/run/nginx/scgi_temp \
--http-log-path=/Users/sky/all/web/nginx/log/access.log \
--error-log-path=/Users/sky/all/web/nginx/log/error.log \
--with-http_gzip_static_module \
--with-http_v2_module \
--with-http_addition_module \
--add-module=/Users/sky/all/source/nginx/ngx-fancyindex \
--add-module=/Users/sky/all/source/nginx/fastdfs-nginx-module/src
说明:
--prefix=/Users/sky/all/web/nginx : nginx 主目录--sbin-path=/Users/sky/all/web/nginx/bin/nginx : nginx 的可执行文件--conf-path=/Users/sky/all/web/nginx/nginx.conf :nginx 的配置文件--http-log-path=/Users/sky/all/web/nginx/log/access.log :访问日志--error-log-path=/Users/sky/all/web/nginx/log/error.log :错误日志--add-module=/Users/sky/all/source/nginx/ngx-fancyindex :一个 nginx 目录美化插件,教程地址:nginx目录列表及美化--add-module=/Users/sky/all/source/nginx/fastdfs-nginx-module/src : fastdfs-nginx-module,插件目录
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-139370-1.html
警告后还不是滚出去了
中国人不惹事