文档章节

CentOS_6.5安装FastDFS_5.05

凯文加内特
 凯文加内特
发布于 2016/02/20 17:38
字数 1072
阅读 216
收藏 0

1.安装依赖包和开发工具:

yum install vim vim-enhanced wget zip unzip telnet ntsysv compat* apr* pcre* pcre-* nasm* gcc gcc* gcc-c++ ntp make imake cmake automake autoconf zlib zlib-devel glibc glibc-devel glib2 libxml glib2-devel libxml2 libxml2-devel bzip2 bzip2-devel libXpm libXpm-devel libidn libidn-devel libtool libtool-ltdl-devel* libmcrypt libmcrypt-devel libevent-devel libmcrypt* curl curl-devel perl perl-Net-SSLeay pcre pcre-devel ncurses ncurses-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers krb5 krb5-devel e2fsprogs e2fsprogs-devel libjpeg libpng libjpeg-devel libjpeg-6b libjpeg-devel-6b libpng-devel libtiff-devel freetype freetype-devel fontconfig-devel gd gd-devel kernel screen sysstat flex bison nss_ldap pam-devel compat-libstdc++-33 gettext-devel libXft-devel libXtst-devel


2.安装libfastcommon:

tar zxvf libfastcommon-1.0.7.tar.gz -C /usr/src

cd /usr/src/libfastcommon-1.0.7/

./make.sh

./make.sh install

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.so


3.安装FastDFS_5.02:

tar zxvf FastDFS_v5.05.tar.gz -C /usr/src/

cd /usr/src/fastdfs-5.05/

sed -i 's#/usr/local/bin/#/usr/bin/#g' init.d/fdfs_storaged

sed -i 's#/usr/local/bin/#/usr/bin/#g' init.d/fdfs_trackerd

./make.sh

./make.sh install


4.编辑tracker.conf配置文件:

mkdir -p /home/fdfs/tracker

cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf

vim /etc/fdfs/tracker.conf

disabled=false

bind_addr=

port=22122

connect_timeout=30

network_timeout=60

base_path=/home/fdfs/tracker/

max_connections=256

accept_threads=1

work_threads=4

store_lookup=1

store_group=group1

store_server=0

store_path=0

download_server=0

reserved_storage_space = 10%

log_level=info

run_by_group=

run_by_user=

allow_hosts=*

sync_log_buff_interval = 10

check_active_interval = 120

thread_stack_size = 64KB

storage_ip_changed_auto_adjust = true

storage_sync_file_max_delay = 86400

storage_sync_file_max_time = 300

use_trunk_file = false

slot_min_size = 256

slot_max_size =16MB

trunk_file_size = 64MB

trunk_create_file_advance = false

trunk_create_file_time_base = 02:00

trunk_create_file_interval = 86400

trunk_create_file_space_threshold = 20G

trunk_init_check_occupying = false

trunk_init_reload_from_binlog = false

trunk_compress_binlog_min_interval = 0

use_storage_id = false

storage_ids_filename = storage_ids.conf

id_type_in_filename = ip

store_slave_file_use_link = false

rotate_error_log = false

error_log_rotate_time=00:00

rotate_error_log_size = 0

log_file_keep_days = 0

use_connection_pool = false

connection_pool_max_idle_time = 3600

http.server_port=8080

http.check_alive_interval=30

http.check_alive_type=tcp

http.check_alive_uri=/status.html


5.启动trackerd服务:

service fdfs_trackerd start

cat /home/fdfs/tracker/logs/trackerd.log

chkconfig --level 2345 fdfs_trackerd on

ps -aux | grep fdfs_trackerd


6.编辑storage.conf配置文件:

mkdir -p /home/fdfs/storage

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

vim /etc/fdfs/storage.conf

disabled=false

group_name=group1

bind_addr=

client_bind=true

port=23000

connect_timeout=30

network_timeout=60

heart_beat_interval=30

stat_report_interval=60

base_path=/home/fdfs/storage/

max_connections=256

buff_size = 256KB

accept_threads=1

work_threads=4

disk_rw_separated = true

disk_reader_threads = 1

disk_writer_threads = 1

sync_wait_msec=50

sync_interval=0

sync_start_time=00:00

sync_end_time=23:59

write_mark_file_freq=500

store_path_count=1

store_path0=/home/fdfs/storage/

subdir_count_per_path=256

tracker_server=127.0.0.1:22122

log_level=info

run_by_group=

run_by_user=

allow_hosts=*

file_distribute_path_mode=0

file_distribute_rotate_count=100

fsync_after_written_bytes=0

sync_log_buff_interval=10

sync_binlog_buff_interval=10

sync_stat_file_interval=300

thread_stack_size=512KB

upload_priority=10

if_alias_prefix=

check_file_duplicate=0

file_signature_method=hash

key_namespace=FastDFS

keep_alive=0

use_access_log = false

rotate_access_log = false

access_log_rotate_time=00:00

rotate_error_log = false

error_log_rotate_time=00:00

rotate_access_log_size = 0

rotate_error_log_size = 0

log_file_keep_days = 0

file_sync_skip_invalid_record=false

use_connection_pool = false

connection_pool_max_idle_time = 3600

http.domain_name=

http.server_port=80


7.启动storaged服务:

service fdfs_storaged start

cat /home/fdfs/storage/logs/storaged.log

chkconfig --level 2345 fdfs_storaged on

ps -aux | grep fdfs_storaged


8.安装Nginx:

tar zxvf fastdfs-nginx-module_v1.16.tar.gz -C /usr/src

vim /usr/src/fastdfs-nginx-module/src/config

ngx_addon_name=ngx_http_fastdfs_module

HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"

NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"

CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

CORE_LIBS="$CORE_LIBS -L/usr/local/lib -lfastcommon -lfdfsclient"

CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"


groupadd www

useradd -s /sbin/nologin -g www www

mkdir -p /home/www/log

mkdir -p /home/www/pid


tar zxvf nginx-1.9.0.tar.gz -C /usr/src/

cd /usr/src/nginx-1.9.0/

./configure --prefix=/usr/local/nginx \

--add-module=/usr/src/fastdfs-nginx-module/src \

--user=www \

--group=www \

--with-http_gunzip_module \

--with-pcre

make && make install


9.配置Nginx:

cp /usr/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/

cp /usr/src/fastdfs-5.05/conf/{anti-steal.jpg,http.conf,mime.types} /etc/fdfs/

touch /home/www/log/mod_fastdfs.log

ln -s /home/fdfs/storage/data /home/fdfs/storage/data/M00


vim /usr/local/nginx/conf/nginx.conf

user www www;

worker_processes auto;

error_log /home/www/log/error.log error;

pid /home/www/pid/nginx.pid;

worker_rlimit_nofile 51200;

events {

    worker_connections  51200;

}

http {

    include       mime.types;

    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

    sendfile        on;

    keepalive_timeout  65;

    server {

        listen       80;

        server_name  localhost;

        access_log  /home/www/log/access.log  main;

        location / {

            root   html;

            index  index.html index.htm;

        }

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }

    location /group1/M00{

    root /home/fdfs/storage/;

    ngx_fastdfs_module;

    }

    }

}


vim /etc/fdfs/mod_fastdfs.conf

connect_timeout=2

network_timeout=30

base_path=/tmp

load_fdfs_parameters_from_tracker=true

storage_sync_file_max_delay = 86400

use_storage_id = false

storage_ids_filename = storage_ids.conf

tracker_server=127.0.0.1:22122

storage_server_port=23000

group_name=group1

url_have_group_name = true

store_path_count=1

store_path0=/home/fdfs/storage/

log_level=info

log_filename=/home/www/log/mod_fastdfs.log

response_mode=proxy

if_alias_prefix=

#include http.conf

flv_support = true

flv_extension = flv

group_count = 1

[group1]

group_name=group1

storage_server_port=23000

store_path_count=1

store_path0=/home/fdfs/storage/


chown -R www:www /home/www/pid

chown -R www:www /home/www/log

chown -R www:www /home/www/log/mod_fastdfs.log


10.启动nginx服务:

service nginx start

ps -aux | grep nginx

netstat -anptu | grep 80


11.配置客户端:

ln -s /home/fdfs/storage/data /home/fdfs/storage/data/M00

cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf

vim /etc/fdfs/client.conf

connect_timeout=30

network_timeout=60

base_path=/tmp

tracker_server=127.0.0.1:22122

log_level=info

use_connection_pool = false

connection_pool_max_idle_time = 3600

load_fdfs_parameters_from_tracker=false

use_storage_id = false

storage_ids_filename = storage_ids.conf

http.tracker_server_port=80


12.测试:

上传:

fdfs_upload_file /etc/fdfs/client.conf /etc/fdfs/anti-steal.jpg

#能返回类似"group1/M00/00/00/wKgfolWmGAyAQSuqAABdrZgsqUU285.jpg"这样的路径即为成功!


下载:

fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKgfolWmGAyAQSuqAABdrZgsqUU285.jpg


查看文件属性:

fdfs_file_info /etc/fdfs/client.conf group1/M00/00/00/wKgfolWmGAyAQSuqAABdrZgsqUU285.jpg


删除文件:

fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKgfolWmGoOEBO0bAAAAAHf4omo816.log


查看storage状态:

fdfs_monitor /etc/fdfs/client.conf

##################################################

#STORAGE SERVER的状态通常有七种:

# FDFS_STORAGE_STATUS:INIT      :初始化,尚未得到同步已有数据的源服务器

# FDFS_STORAGE_STATUS:WAIT_SYNC :等待同步,已得到同步已有数据的源服务器

# FDFS_STORAGE_STATUS:SYNCING   :同步中

# FDFS_STORAGE_STATUS:DELETED   :已删除,该服务器从本组中摘除

# FDFS_STORAGE_STATUS:OFFLINE   :离线

# FDFS_STORAGE_STATUS:ONLINE    :在线,尚不能提供服务

# FDFS_STORAGE_STATUS:ACTIVE    :在线,可以提供服务

##################################################


本文转载自:http://blog.sina.com.cn/s/blog_6e00431d0102visy.html

凯文加内特
粉丝 341
博文 701
码字总数 110786
作品 0
青岛
后端工程师
私信 提问
Centos7单台服务器搭建FastDFS+Nginx

Fastdfs+Nginx配置操作 单台配置 安装包下载: wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDF......

独狼的小窝
2018/06/26
0
0
Centos 7 搭建 FastDFS文件管理系统

一、FastDFS介绍 FastDFS开源地址:https://github.com/happyfish100 参考:分布式文件系统FastDFS设计原理 参考:FastDFS分布式文件系统 个人封装的FastDFS Java API:https://github.com/...

欧虞山
2018/09/05
0
0
使用FastDFS搭建图片服务器(单实例)

FastDFS是一款类Google FS的开源分布式文件系统,它用纯C语言实现,支持Linux、FreeBSD、AIX等UNIX系统。它只能通过 专有API对文件进行存取访问,不支持POSIX接口方式,不能mount使用。准确地...

haoyuehong
2018/09/12
241
0
Ubuntu 14.04下部署FastDFS 5.08+Nginx 1.13.0

环境 Ubuntu 14.04 用户 admin 数据目录: /fastdfs 安装包:FastDFS v5.05 一、下载安装libfastcommon 1.1、上传或下载 libfastcommon-master.zip 到/usr/local/src 目录 1.2、解压 1.3、编...

paascloud
2017/05/29
0
0
centos搭建FastDFS服务器!

CentOS fastDFS结合nginx的配置以及php端的调用方法 2013-04-18 22:54:55| 分类: 默认分类 | 标签:centos fastdfs nginx php |字号 订阅 fastDFS的介绍就不说了 想了解的人直接百度。 源码...

求学ing
2013/09/10
1K
0

没有更多内容

加载失败,请刷新页面

加载更多

kubernetes pod exec接口调用

正文 一般生产环境上由于网络安全策略,大多数端口是不能为集群外部访问的。多个集群之间一般都是通过k8s的ApiServer组件提供的接口通信,如https://192.168.1.101:6443。所以在做云平台时,...

码农实战
35分钟前
4
0
3_数组

3_数组

行者终成事
今天
8
0
经典系统设计面试题解析:如何设计TinyURL(二)

原文链接:https://www.educative.io/courses/grokking-the-system-design-interview/m2ygV4E81AR 编者注:本文以一道经典的系统设计面试题:《如何设计TinyURL》的参考答案和解析为例,帮助...

APEMESH
今天
7
0
使用logstash同步MySQL数据到ES

概述   在生成业务常有将MySQL数据同步到ES的需求,如果需要很高的定制化,往往需要开发同步程序用于处理数据。但没有特殊业务需求,官方提供的logstash就很有优势了。   在使用logstas...

zxiaofan666
今天
10
0
X-MSG-IM-分布式信令跟踪能力

经过一周多的鏖战, X-MSG-IM的分布式信令跟踪能力已基本具备, 特点是: 实时. 只有要RX/TX就会实时产生信令跟踪事件, 先入kafka, 再入influxdb待查. 同时提供实时sub/pub接口. 完备. 可以完整...

dev5
今天
7
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部