简介

FastDFS是一个开源的轻量级分布式文件系统。它解决了大数据量存储和负载均衡等问题。特别适合以中小文件(建议范围:4KB < file_size <500MB)为载体的在线服务,如相册网站、视频网站等等。在UC基于FastDFS开发向用户提供了:网盘,社区,广告和应用下载等业务的存储服务。

架构

FastDFS服务端有三个角色:跟踪服务器(tracker server)、存储服务器(storage server)和客户端(client)。

  1. tracker server:跟踪服务器,主要做调度工作,起负载均衡的作用。在内存中记录集群中所有存储组和存储服务器的状态信息,是客户端和数据服务器交互的枢纽。相比GFS中的master更为精简,不记录文件索引信息,占用的内存量很少。Tracker cluster中各个tracker server相互独立,不进行相互通信。
  2. storage server:存储服务器(又称:存储节点或数据服务器),文件和文件属性(meta data)都保存到存储服务器上。Storage server直接利用OS的文件系统调用管理文件。Storage cluster中各个storage组(Volume1,Volume2…)相互独立,不进行相互通信,也就是说各个组之间保存的数据是不相同的。但是各个组中的storage server之间是属于互相备份的关系,也就是说storage server之间保存相同的数据。每个storage server会启动一个单独的线程主动向Tracker cluster中每个tracker server报告其状态信息,包括磁盘使用情况,文件同步情况及文件上传下载次数统计等信息。
  3. client:客户端,作为业务请求的发起方,通过专有接口,使用TCP/IP协议与跟踪器服务器或存储节点进行数据交互。

工作流程

  1. 文件上传

    1)Client通过Tracker server将文件上传到Storage server。
    2)Tracker server向Client返回一台可用的Storage server的IP地址和端口号。
    3)Client直接通过Tracker server返回的IP地址和端口与其中一台Storage server建立连接并进行文件上传。
    4)上传完成,Storage server返回给Client上传的文件名和文件组,文件上传结束。
  2. 文件下载

    1)Client通过Tracker server下载指定Storage组中某个Storage server上的某个文件(文件名包括Storage组名称)。
    2)Tracker server向Client返回一台可用的Storage server的IP地址和端口号。
    3)Client直接通过Tracker server返回的IP地址和端口与其中一台Storage server建立连接并进行文件下载。

安装配置集群

一、系统环境

CentOS 7.3 64位
FastDFS_v5.08.tar.gz
nginx-1.8.1.tar.gz
fastdfs-nginx-module_v1.16.tar.gz
libfastcommon

二、服务器规划

  1. tracker server:172.18.10.10:22122
  2. storage server 1:172.18.10.11:23000
  3. storage server 2:172.18.10.12:23000
  4. 2台storage server 互为备份,同属一个group。
  5. 所有服务器按照以下步骤安装,启动时分别启动对应的tracker或storage即可。
  6. tracker服务器中可以安装使用php或者java驱动,上传文件。
  7. nginx安装目录:/application/nginx/
  8. FastDFS配置文件目录:/etc/fdfs/
  9. FastDFS脚本服务文件目录:/etc/init.d/
  10. 上传文件存放目录:/data/fastdfs/
  11. 安装程序存放目录:/home/fdfs/tools/
  12. 配置ip地址可以填写内网地址
  13. 外网访问需要开通相应访问端口

三、安装FastDFS

1、创建并进入程序存放目录

[root@fastdfs-storage ~]# mkdir -p /home/fdfs/tools
[root@fastdfs-storage ~]# cd /home/fdfs/tools/

2、下载并安装FastDFS依赖包 libfastcommon

[root@fastdfs-storage tools]# wget https://codeload.github.com/happyfish100/libfastcommon/zip/master
[root@fastdfs-storage tools]# unzip master
[root@fastdfs-storage tools]# cd libfastcommon-master/
[root@fastdfs-storage libfastcommon-master]# ls
HISTORY  INSTALL  libfastcommon.spec  make.sh  php-fastcommon  README  src
[root@fastdfs-storage libfastcommon-master]# ./make.sh
[root@fastdfs-storage libfastcommon-master]# ./make.sh install

3、下载并安装FastDFS

[root@fastdfs-tracker tools]# wget https://codeload.github.com/happyfish100/fastdfs/zip/V5.11
[root@fastdfs-tracker tools]# unzip V5.11
[root@fastdfs-tracker tools]# cd fastdfs-5.11
[root@fastdfs-tracker FastDFS]# ./make.sh
[root@fastdfs-tracker FastDFS]# ./make.sh install

ps:多tracker情况下,5.10版本以上的FastDFS才支持。

默认方式安装完成之后,文件及目录:

服务脚本:

[root@fastdfs-tracker ~]# ll /etc/init.d/ |grep fdfs
-rwxr-xr-x. 1 root root   918 4月  22 22:08 fdfs_storaged
-rwxr-xr-x. 1 root root   920 4月  22 22:08 fdfs_trackerd

配置文件

[root@fastdfs-tracker ~]# ll /etc/fdfs/
total 20
-rw-r--r--. 1 root root 1461 4月  22 22:08 client.conf.sample
-rw-r--r--. 1 root root 7927 4月  22 22:08 storage.conf.sample
-rw-r--r--. 1 root root 7200 4月  22 22:08 tracker.conf.sample

命令行工具

[root@fastdfs-tracker ~]# ll /usr/bin|grep fdfs
-rwxr-xr-x  1 root root     315496 Aug 19 17:07 fdfs_appender_test
-rwxr-xr-x  1 root root     315272 Aug 19 17:07 fdfs_appender_test1
-rwxr-xr-x  1 root root     302120 Aug 19 17:07 fdfs_append_file
-rwxr-xr-x  1 root root     301800 Aug 19 17:07 fdfs_crc32
-rwxr-xr-x  1 root root     302184 Aug 19 17:07 fdfs_delete_file
-rwxr-xr-x  1 root root     302920 Aug 19 17:07 fdfs_download_file
-rwxr-xr-x  1 root root     302504 Aug 19 17:07 fdfs_file_info
-rwxr-xr-x  1 root root     316336 Aug 19 17:07 fdfs_monitor
-rwxr-xr-x  1 root root    1102216 Aug 19 17:07 fdfs_storaged
-rwxr-xr-x  1 root root     325432 Aug 19 17:07 fdfs_test
-rwxr-xr-x  1 root root     320552 Aug 19 17:07 fdfs_test1
-rwxr-xr-x  1 root root     448032 Aug 19 17:07 fdfs_trackerd
-rwxr-xr-x  1 root root     303112 Aug 19 17:07 fdfs_upload_appender
-rwxr-xr-x  1 root root     304128 Aug 19 17:07 fdfs_upload_file

注意:虽然FastDFS区分tracker和storage服务器,但是安装的软件及步骤均相同,只是不同的配置文件而已,因此以上安装适用tracker server和storage server。
4、配置tracker server

拷贝tracker server和client端配置文件并重命名

[root@fastdfs-tracker ~]# cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
[root@fastdfs-storage ~]# cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf

编辑tracker server配置文件tracker.conf,修改内容如下:

    disabled=false(默认为false,表示是否无效)port=22122(默认为22122)base_path=/data/fastdfs/tracker

创建tracker server数据目录

[root@fastdfs-tracker ~]# mkdir -p /data/fastdfs/tracker

配置client配置文件client.conf,修改内容如下:

ps:php或java程序驱动通过调用该client配置文件,上传文件

    base_path=/data/fastdfs/trackertracker_server=172.18.10.10:22122

测试启动tracker server,启动成功会自动在/data/fastdfs/tracker目录新建data和logs目录

[root@fastdfs-tracker ~]# cd /data/fastdfs/tracker/
[root@fastdfs-tracker tracker]# ls
[root@fastdfs-tracker tracker]# /etc/init.d/fdfs_trackerd start
Starting FastDFS tracker server:
[root@fastdfs-tracker tracker]# ss -lntup|grep 22122
tcp    LISTEN     0      128                    *:22122                 *:*      users:(("fdfs_trackerd",3785,5))
[root@fastdfs-tracker tracker]# ls
data  logs

关闭tracker server命令

[root@fastdfs-tracker tracker]# /etc/init.d/fdfs_trackerd stop

5、配置storage server

拷贝storage server配置文件并重命名

[root@fastdfs-storage ~]# cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf

编辑storage server配置文件storage.conf,修改内容如下:

    disabled=false(默认为false,表示是否无效)port=23000(默认为23000)base_path=/data/fastdfs/storagetracker_server=172.18.10.10:22122store_path0=/data/fastdfs/storagehttp.server_port=8888(默认为8888,nginx中配置的监听端口那之一致)

ps:两台storage server配置相同

创建storage server数据目录

[root@fastdfs-storage ~]# mkdir -p /data/fastdfs/storage

测试启动storage server,启动成功会自动在/data/fastdfs/tracker目录新建data和logs目录,启动storage server时,tracker server已启动

[root@fastdfs-storage ~]# cd /data/fastdfs/storage/
[root@fastdfs-storage storage]# ls
[root@fastdfs-storage storage]# /etc/init.d/fdfs_storaged start
Starting FastDFS storage server:
[root@fastdfs-storage storage]# ss -lntup|grep 23000
tcp    LISTEN     0      128                    *:23000                 *:*      users:(("fdfs_storaged",3786,5))
[root@fastdfs-storage storage]# ls
data  logs

6、测试文件上传
在tracker server中,执行以下命令,并在/home/fdfs/image/下存在test.jpg图片

[root@fastdfs-tracker ~]# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/fdfs/image/test.jpg
group1/M00/00/00/tBIK6VcaP0aARXasAAHrUgHEviQ394.jpg

返回文件名字,即说明文件上传成功。
7、存储服务器tracker server 安装并配置nginx

下载并安装fastdfs-nginx-module模块

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

进入/home/fdfs/tools文件夹

[root@fastdfs-tracker ~]# cd /home/fdfs/tools
[root@fastdfs-storage  tools]# wget http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
[root@fastdfs-storage tools]# tar xf fastdfs-nginx-module_v1.16.tar.gz
[root@fastdfs-storage tools]# cd fastdfs-nginx-module/src/

修改config文件,执行如下命令,进行批量替换,并保存退出

[root@fastdfs-storage src]# vim config
:%s+/usr/local/+/usr/+g

拷贝fastdfs-nginx-module模块中配置文件到/etc/fdfs目录中并编辑

[root@fastdfs-storage ~]# cp /home/fdfs/tools/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
[root@fastdfs-storage ~]# vim /etc/fdfs/mod_fastdfs.conf

修改配置文件如下:

connect_timeout=10
base_path=/tmp(默认为/tmp)
tracker_server=172.18.10.10:22122
storage_server_port=23000(默认配置为23000)
url_have_group_name = true
store_path0=/data/fastdfs/storage
group_name=group1(默认配置为group1)

安装nginx依赖库

[root@fastdfs-storage nginx-1.8.1]# yum install -y pcre-devel zlib-devel

下载并安装nginx

[root@fastdfs-storage  tools]# wget http://nginx.org/download/nginx-1.8.1.tar.gz
[root@fastdfs-storage tools]# tar xf nginx-1.8.1.tar.gz
[root@fastdfs-storage tools]# cd nginx-1.8.1
[root@fastdfs-storage nginx-1.8.1]# ./configure --prefix=/application/nginx/ --add-module=../fastdfs-nginx-module/src/
[root@fastdfs-storage nginx-1.8.1]# make && make install

如果报错缺少gcc,需要先安装gcc

[root@fastdfs-storage nginx-1.8.1]# yum install gcc gcc-c++

拷贝FastDFS中的部分配置文件到/etc/fdfs目录中

[root@fastdfs-storage ~]# cp /home/fdfs/tools/FastDFS/conf/http.conf /etc/fdfs/
[root@fastdfs-storage ~]# cp /home/fdfs/tools/FastDFS/conf/mime.types /etc/fdfs/

配置nginx,如下:

[root@fastdfs-storage ~]# vim /application/nginx/conf/nginx.confuser  root;    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  www.baidu.com;location ~/group[0-9]/ {ngx_fastdfs_module;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}}

主要配置server下的内容,接收请求到对应的文件。

a、"user root"是解决下载操作时报404的问题
b、8888端口号与/etc/fdfs/storage.conf中的http.server_port=8888相对应
c、storage对应有多个group的情况下,访问路径带group名称,例如:/group1/M00/00/00/**,对应nginx配置:location ~/group[0-9]/ {ngx_fastdfs_module;}

拷贝nginx服务到/etc/init.d/目录下,并启动nginx

[root@fastdfs-storage ~]# cp /application/nginx/sbin/nginx /etc/init.d/
[root@fastdfs-storage ~]# /etc/init.d/nginx

配置storage server中的nginx 配置文件中的server部分

server {listen       80;server_name  localhost;access_log  logs/fdfs.access.log;location ~/group[0-9]/ {ngx_fastdfs_module;}}

通过浏览器可以访问上传的文件

http://www.baidu.com:8888/group1/M00/00/00/tBIK6VcaP0aARXasAAHrUgHEviQ394.jpg

在2台storage server对应目录下可以检查是否有该文件存在

/data/fastdfs/storage/data/00/00/

8、使用php程序在tracker中做上传服务后台

安装php

yum install php
yum install php-devel

安装php-fpm依赖

yum install php-mysql php-mbstring

安装php-fpm

yum install php-fpm

安装FastDFS中php客户端上传支持

cd /home/fastdfs/tools/FastDFS/php_client/
phpize
./configure --with-php-config=/usr/bin/php-config
make
make install
cat /home/fastdfs/tools/FastDFS/php_client/fastdfs_client.ini >> /etc/php.ini

启动php-fpm

systemctl start php-fpm

配置nginx中支持php server

主要配置server内容

server {listen       80;server_name  www.google.com;index index.php;root /data/www/fdfsclient;access_log  logs/google.log;location / {if (!-e $request_filename) {rewrite  ^(.*)$  /index.php?s=/$1  last;break;}}location ~ .php($|/) {set $script $uri;set $path_info "";if ($uri ~ "^(.+.php)(/.+)") {set $script $1;set $path_info $2;}fastcgi_param SCRIPT_FILENAME $document_root$script;fastcgi_param SCRIPT_NAME $script;fastcgi_param PATH_INFO $path_info;try_files $uri =404;fastcgi_pass  127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf;}
}

附上FastDFS官方php操作方法


Copyright (C) 2008 Happy Fish / YuQingFastDFS client php extension may be copied only under the terms of
the Less GNU General Public License (LGPL).Please visit the FastDFS Home Page for more detail.
Google code (English language): http://code.google.com/p/fastdfs/
Chinese language: http://www.csource.com/In file fastdfs_client.ini, item fastdfs_client.tracker_group# point to
the FastDFS client config filename. Please read ../INSTALL file to know
about how to config FastDFS client.FastDFS client php extension compiled under PHP 5.2.x, Steps:
phpize
./configure
make
make install#copy lib file to php extension directory, eg. /usr/lib/php/20060613/
cp modules/fastdfs_client.so  /usr/lib/php/20060613/#copy fastdfs_client.ini to PHP etc directory, eg. /etc/php/
cp fastdfs_client.ini /etc/php/#modify config file fastdfs_client.ini, such as:
vi /etc/php/fastdfs_client.ini#run fastdfs_test.php
php fastdfs_test.phpFastDFS PHP functions:string fastdfs_client_version()
return client library versionlong fastdfs_get_last_error_no()
return last error nostring fastdfs_get_last_error_info()
return last error infostring fastdfs_http_gen_token(string remote_filename, int timestamp)
generate anti-steal token for HTTP download
parameters:remote_filename: the remote filename (do NOT including group name)timestamp: the timestamp (unix timestamp)
return token string for success, false for errorarray fastdfs_get_file_info(string group_name, string filename)
get file info from the filename
parameters:group_name: the group name of the fileremote_filename: the filename on the storage server
return assoc array for success, false for error. the assoc array including following elements:create_timestamp: the file create timestamp (unix timestamp)file_size: the file size (bytes)source_ip_addr: the source storage server ip addressarray fastdfs_get_file_info1(string file_id)
get file info from the file id
parameters:file_id: the file id (including group name and filename) or remote filename
return assoc array for success, false for error. the assoc array including following elements:create_timestamp: the file create timestamp (unix timestamp)file_size: the file size (bytes)source_ip_addr: the source storage server ip addressbool fastdfs_send_data(int sock, string buff)
parameters:sock: the unix socket descriptionbuff: the buff to send
return true for success, false for errorstring fastdfs_gen_slave_filename(string master_filename, string prefix_name[, string file_ext_name])
generate slave filename by master filename, prefix name and file extension name
parameters:master_filename: the master filename / file id to generate the slave filenameprefix_name: the prefix name  to generate the slave filenamefile_ext_name: slave file extension name, can be null or emtpy (do not including dot)
return slave filename string for success, false for errorboolean fastdfs_storage_file_exist(string group_name, string remote_filename[, array tracker_server, array storage_server])
check file exist
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for exist, false for not existboolean fastdfs_storage_file_exist1(string file_id[, array tracker_server, array storage_server])
parameters:file_id: the file id of the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for exist, false for not existarray fastdfs_storage_upload_by_filename(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_by_filename1(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for error.array fastdfs_storage_upload_by_filebuff(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_by_filebuff1(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray fastdfs_storage_upload_by_callback(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamearray fastdfs_storage_upload_by_callback1(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray fastdfs_storage_upload_appender_by_filename(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server as appender file
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_appender_by_filename1(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server as appender file
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for error.array fastdfs_storage_upload_appender_by_filebuff(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server as appender file
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_appender_by_filebuff1(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server as appender file
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray fastdfs_storage_upload_appender_by_callback(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback as appender file
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_appender_by_callback1(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback as appender file
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorboolean fastdfs_storage_append_by_filename(string local_filename, string group_name, appender_filename[, array tracker_server, array storage_server])
append local file to the appender file of storage server
parameters:local_filename: the local filenamegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorstring fastdfs_storage_append_by_filename1(string local_filename, string appender_file_id [, array tracker_server, array storage_server])
append local file to the appender file of storage server
parameters:local_filename: the local filenameappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_append_by_filebuff(string file_buff, string group_name, string appender_filename[, array tracker_server, array storage_server])
append file buff to the appender file of storage server
parameters:file_buff: the file contentgroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_append_by_filebuff1(string file_buff, string appender_file_id [, array tracker_server, array storage_server])
append file buff to the appender file of storage server
parameters:file_buff: the file contentappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_append_by_callback(array callback_array,string group_name, string appender_filename[, array tracker_server, array storage_server])
append file to the appender file of storage server by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functiongroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_append_by_callback1(array callback_array,string appender_file_id [, array tracker_server, array storage_server])
append file buff to the appender file of storage server
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_modify_by_filename(string local_filename, long file_offset, string group_name, appender_filename, [array tracker_server, array storage_server])
modify appender file by local file
parameters:local_filename: the local filenamefile_offset: offset of appender filegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_modify_by_filename1(string local_filename, long file_offset, string appender_file_id[, array tracker_server, array storage_server])
modify appender file by local file
parameters:local_filename: the local filenamefile_offset: offset of appender fileappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_modify_by_filebuff(string file_buff, long file_offset, string group_name, string appender_filename[, array tracker_server, array storage_server])
modify appender file by file buff
parameters:file_buff: the file contentfile_offset: offset of appender filegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_modify_by_filebuff1(string file_buff, long file_offset, string appender_file_id[, array tracker_server, array storage_server])
modify appender file by file buff
parameters:file_buff: the file contentfile_offset: offset of appender fileappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_modify_by_callback(array callback_array, long file_offset, string group_name, string appender_filename[, array tracker_server, array storage_server])
modify appender file by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_offset: offset of appender filegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_modify_by_callback1(array callback_array, long file_offset, string group_name, string appender_filename[, array tracker_server, array storage_server])
modify appender file by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_offset: offset of appender fileappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_truncate_file(string group_name, string appender_filename [, long truncated_file_size = 0, array tracker_server, array storage_server])
truncate appender file to specify size
parameters:group_name: the the group name of appender fileappender_filename: the appender filenametruncated_file_size: truncate the file size totracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_truncate_file1(string appender_file_id[, long truncated_file_size = 0, array tracker_server, array storage_server])
truncate appender file to specify size
parameters:appender_file_id: the appender file idtruncated_file_size: truncate the file size totracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorstring/array fastdfs_storage_upload_slave_by_filename(string local_filename, string group_name, string master_filename, string prefix_name [, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload local file to storage server (slave file mode)
parameters:file_buff: the file contentgroup_name: the group name of the master filemaster_filename: the master filename to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_slave_by_filename1(string local_filename, string master_file_id, string prefix_name [, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload local file to storage server (slave file mode)
parameters:local_filename: the local filenamemaster_file_id: the master file id to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for error.array fastdfs_storage_upload_slave_by_filebuff(string file_buff, string group_name, string master_filename, string prefix_name [, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file buff to storage server (slave file mode)
parameters:file_buff: the file contentgroup_name: the group name of the master filemaster_filename: the master filename to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_slave_by_filebuff1(string file_buff, string master_file_id, string prefix_name[, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file buff to storage server (slave file mode)
parameters:file_buff: the file contentmaster_file_id: the master file id to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray fastdfs_storage_upload_slave_by_callback(array callback_array,string group_name, string master_filename, string prefix_name [, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file to storage server by callback (slave file mode)
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functiongroup_name: the group name of the master filemaster_filename: the master filename to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring fastdfs_storage_upload_slave_by_callback1(array callback_array,string master_file_id, string prefix_name[, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file to storage server by callback (slave file mode)
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionmaster_file_id: the master file id to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorboolean fastdfs_storage_delete_file(string group_name, string remote_filename [, array tracker_server, array storage_server])
delete file from storage server
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_delete_file1(string file_id[, array tracker_server, array storage_server])
delete file from storage server
parameters:file_id: the file id to be deletedtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorstring fastdfs_storage_download_file_to_buff(string group_name, string remote_filename [, long file_offset, long download_bytes,array tracker_server, array storage_server])
get file content from storage server
parameters:group_name: the group name of the fileremote_filename: the filename on the storage serverfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return the file content for success, false for errorstring fastdfs_storage_download_file_to_buff1(string file_id[, long file_offset, long download_bytes,array tracker_server, array storage_server])
get file content from storage server
parameters:file_id: the file id of the filefile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return the file content for success, false for errorboolean fastdfs_storage_download_file_to_file(string group_name, string remote_filename, string local_filename [, long file_offset, long download_bytes, array tracker_server, array storage_server])
download file from storage server to local file
parameters:group_name: the group name of the fileremote_filename: the filename on the storage serverlocal_filename: the local filename to save the file contentfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_download_file_to_file1(string file_id, string local_filename [, long file_offset, long download_bytes, array tracker_server, array storage_server])
download file from storage server to local file
parameters:file_id: the file id of the filelocal_filename: the local filename to save the file contentfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_download_file_to_callback(string group_name,string remote_filename, array download_callback [, long file_offset, long download_bytes, array tracker_server, array storage_server])
parameters:group_name: the group name of the fileremote_filename: the filename on the storage serverdownload_callback: the download callback array, elements as:callback  - the php callback function namecallback function prototype as:function my_download_file_callback($args, $file_size, $data)args      - use argument for callback functionfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_download_file_to_callback1(string file_id,array download_callback [, long file_offset, long download_bytes, array tracker_server, array storage_server])
parameters:file_id: the file id of the filedownload_callback: the download callback array, elements as:callback  - the php callback function namecallback function prototype as:function my_download_file_callback($args, $file_size, $data)args      - use argument for callback functionfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_set_metadata(string group_name, string remote_filename,array meta_list [, string op_type, array tracker_server, array storage_server])
set meta data of the file
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servermeta_list: meta data assoc array to be set, such asarray('width'=>1024, 'height'=>768)op_type: operate flag, can be one of following flags:FDFS_STORAGE_SET_METADATA_FLAG_MERGE: combined with the old meta dataFDFS_STORAGE_SET_METADATA_FLAG_OVERWRITE: overwrite the old meta datatracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_storage_set_metadata1(string file_id, array meta_list[, string op_type, array tracker_server, array storage_server])
set meta data of the file
parameters:file_id: the file id of the filemeta_list: meta data assoc array to be set, such asarray('width'=>1024, 'height'=>768)op_type: operate flag, can be one of following flags:FDFS_STORAGE_SET_METADATA_FLAG_MERGE: combined with the old meta dataFDFS_STORAGE_SET_METADATA_FLAG_OVERWRITE: overwrite the old meta datatracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorarray fastdfs_storage_get_metadata(string group_name, string remote_filename[, array tracker_server, array storage_server])
get meta data of the file
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorreturned array like: array('width' => 1024, 'height' => 768)array fastdfs_storage_get_metadata1(string file_id[, array tracker_server, array storage_server])
get meta data of the file
parameters:file_id: the file id of the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorreturned array like: array('width' => 1024, 'height' => 768)array fastdfs_connect_server(string ip_addr, int port)
connect to the server
parameters:ip_addr: the ip address of the serverport: the port of the server
return assoc array for success, false for errorboolean fastdfs_disconnect_server(array server_info)
disconnect from the server
parameters:server_info: the assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean fastdfs_active_test(array server_info)
send ACTIVE_TEST cmd to the server
parameters:server_info: the assoc array including elements:ip_addr, port and sock, sock must be connected
return true for success, false for errorarray fastdfs_tracker_get_connection()
get a connected tracker server
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockboolean fastdfs_tracker_make_all_connections()
connect to all tracker servers
return true for success, false for errorboolean fastdfs_tracker_close_all_connections()
close all connections to the tracker servers
return true for success, false for errorarray fastdfs_tracker_list_groups([string group_name, array tracker_server])
get group stat info
parameters:group_name: specify the group name, null or empty string means all groupstracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return index array for success, false for error, each group as a array elementarray fastdfs_tracker_query_storage_store([string group_name, array tracker_server])
get the storage server info to upload file
parameters:group_name: specify the group nametracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the assoc array includingelements: ip_addr, port, sock and store_path_indexarray fastdfs_tracker_query_storage_store_list([string group_name, array tracker_server])
get the storage server list to upload file
parameters:group_name: specify the group nametracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return indexed storage server array for success, false for error.each element is an ssoc array including elements: ip_addr, port, sock and store_path_indexarray fastdfs_tracker_query_storage_update(string group_name, string remote_filename [, array tracker_server])
get the storage server info to set metadata
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray fastdfs_tracker_query_storage_update1(string file_id, [, array tracker_server])
get the storage server info to set metadata
parameters:file_id: the file id of the filetracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray fastdfs_tracker_query_storage_fetch(string group_name, string remote_filename [, array tracker_server])
get the storage server info to download file (or get metadata)
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray fastdfs_tracker_query_storage_fetch1(string file_id [, array tracker_server])
get the storage server info to download file (or get metadata)
parameters:file_id: the file id of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray fastdfs_tracker_query_storage_list(string group_name, string remote_filename [, array tracker_server])
get the storage server list which can retrieve the file content or metadata
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return index array for success, false for error.each server as an array elementarray fastdfs_tracker_query_storage_list1(string file_id[, array tracker_server])
get the storage server list which can retrieve the file content or metadata
parameters:file_id: the file id of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return index array for success, false for error. each server as an array elementboolean fastdfs_tracker_delete_storage(string group_name, string storage_ip)
delete the storage server from the cluster
parameters:group_name: the group name of the storage serverstorage_ip: the ip address of the storage server to be deleted
return true for success, false for errorFastDFS Class Info:class FastDFS([int config_index, boolean bMultiThread]);
FastDFS class constructor
params:config_index: use which config file, base 0. default is 0bMultiThread: if in multi-thread, default is falselong FastDFS::get_last_error_no()
return last error nostring FastDFS::get_last_error_info()
return last error infobool FastDFS::send_data(int sock, string buff)
parameters:sock: the unix socket descriptionbuff: the buff to send
return true for success, false for errorstring FastDFS::http_gen_token(string remote_filename, int timestamp)
generate anti-steal token for HTTP download
parameters:remote_filename: the remote filename (do NOT including group name)timestamp: the timestamp (unix timestamp)
return token string for success, false for errorarray FastDFS::get_file_info(string group_name, string filename)
get file info from the filename
parameters:group_name: the group name of the fileremote_filename: the filename on the storage server
return assoc array for success, false for error. the assoc array including following elements:create_timestamp: the file create timestamp (unix timestamp)file_size: the file size (bytes)source_ip_addr: the source storage server ip addresscrc32: the crc32 signature of the filearray FastDFS::get_file_info1(string file_id)
get file info from the file id
parameters:file_id: the file id (including group name and filename) or remote filename
return assoc array for success, false for error. the assoc array including following elements:create_timestamp: the file create timestamp (unix timestamp)file_size: the file size (bytes)source_ip_addr: the source storage server ip addressstring FastDFS::gen_slave_filename(string master_filename, string prefix_name[, string file_ext_name])
generate slave filename by master filename, prefix name and file extension name
parameters:master_filename: the master filename / file id to generate the slave filenameprefix_name: the prefix name  to generate the slave filenamefile_ext_name: slave file extension name, can be null or emtpy (do not including dot)
return slave filename string for success, false for errorboolean FastDFS::storage_file_exist(string group_name, string remote_filename[, array tracker_server, array storage_server])
check file exist
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for exist, false for not existboolean FastDFS::storage_file_exist1(string file_id[, array tracker_server, array storage_server])
parameters:file_id: the file id of the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for exist, false for not existarray FastDFS::storage_upload_by_filename(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_by_filename1(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for error.array FastDFS::storage_upload_by_filebuff(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_by_filebuff1(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray FastDFS::storage_upload_by_callback(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamearray FastDFS::storage_upload_by_callback1(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray FastDFS::storage_upload_appender_by_filename(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server as appender file
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_appender_by_filename1(string local_filename[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload local file to storage server as appender file
parameters:local_filename: the local filenamefile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for error.array FastDFS::storage_upload_appender_by_filebuff(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server as appender file
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_appender_by_filebuff1(string file_buff[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file buff to storage server as appender file
parameters:file_buff: the file contentfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray FastDFS::storage_upload_appender_by_callback(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback as appender file
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_appender_by_callback1(array callback_array[, string file_ext_name, array meta_list, string group_name, array tracker_server, array storage_server])
upload file to storage server by callback as appender file
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)group_name: specify the group name to store the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorboolean FastDFS::storage_append_by_filename(string local_filename, string group_name, appender_filename[, array tracker_server, array storage_server])
append local file to the appender file of storage server
parameters:local_filename: the local filenamegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorstring FastDFS::storage_upload_by_filename1(string local_filename, [string appender_file_id, array tracker_server, array storage_server])
append local file to the appender file of storage server
parameters:local_filename: the local filenameappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_append_by_filebuff(string file_buff, string group_name, string appender_filename[, array tracker_server, array storage_server])
append file buff to the appender file of storage server
parameters:file_buff: the file contentgroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_append_by_filebuff1(string file_buff, string appender_file_id [, array tracker_server, array storage_server])
append file buff to the appender file of storage server
parameters:file_buff: the file contentappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_append_by_callback(array callback_array,string group_name, string appender_filename[, array tracker_server, array storage_server])
append file to the appender file of storage server by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functiongroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_append_by_callback1(array callback_array,string appender_file_id [, array tracker_server, array storage_server])
append file buff to the appender file of storage server
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_modify_by_filename(string local_filename, long file_offset, string group_name, appender_filename, [array tracker_server, array storage_server])
modify appender file by local file
parameters:local_filename: the local filenamefile_offset: offset of appender filegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_modify_by_filename1(string local_filename, long file_offset, string appender_file_id[, array tracker_server, array storage_server])
modify appender file by local file
parameters:local_filename: the local filenamefile_offset: offset of appender fileappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_modify_by_filebuff(string file_buff, long file_offset, string group_name, string appender_filename[, array tracker_server, array storage_server])
modify appender file by file buff
parameters:file_buff: the file contentfile_offset: offset of appender filegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_modify_by_filebuff1(string file_buff, long file_offset, string appender_file_id[, array tracker_server, array storage_server])
modify appender file by file buff
parameters:file_buff: the file contentfile_offset: offset of appender fileappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_modify_by_callback(array callback_array, long file_offset, string group_name, string appender_filename[, array tracker_server, array storage_server])
modify appender file by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_offset: offset of appender filegroup_name: the the group name of appender fileappender_filename: the appender filenametracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_modify_by_callback1(array callback_array, long file_offset, string group_name, string appender_filename[, array tracker_server, array storage_server])
modify appender file by callback
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionfile_offset: offset of appender fileappender_file_id: the appender file idtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_truncate_file(string group_name, string appender_filename [, long truncated_file_size = 0, array tracker_server, array storage_server])
truncate appender file to specify size
parameters:group_name: the the group name of appender fileappender_filename: the appender filenametruncated_file_size: truncate the file size totracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_truncate_file1(string appender_file_id[, long truncated_file_size = 0, array tracker_server, array storage_server])
truncate appender file to specify size
parameters:appender_file_id: the appender file idtruncated_file_size: truncate the file size totracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorarray FastDFS::storage_upload_slave_by_filename(string local_filename, string group_name, string master_filename, string prefix_name [, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload local file to storage server (slave file mode)
parameters:file_buff: the file contentgroup_name: the group name of the master filemaster_filename: the master filename to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_slave_by_filename1(string local_filename, string master_file_id, string prefix_name [, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload local file to storage server (slave file mode)
parameters:local_filename: the local filenamemaster_file_id: the master file id to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for error.array FastDFS::storage_upload_slave_by_filebuff(string file_buff, string group_name, string master_filename, string prefix_name [, file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file buff to storage server (slave file mode)
parameters:file_buff: the file contentgroup_name: the group name of the master filemaster_filename: the master filename to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_slave_by_filebuff1(string file_buff, string master_file_id, string prefix_name[, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file buff to storage server (slave file mode)
parameters:file_buff: the file contentmaster_file_id: the master file id to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorarray FastDFS::storage_upload_slave_by_callback(array callback_array,string group_name, string master_filename, string prefix_name [, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file to storage server by callback (slave file mode)
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functiongroup_name: the group name of the master filemaster_filename: the master filename to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the returned array includes elements: group_name and filenamestring FastDFS::storage_upload_slave_by_callback1(array callback_array,string master_file_id, string prefix_name[, string file_ext_name, array meta_list, array tracker_server, array storage_server])
upload file to storage server by callback (slave file mode)
parameters:callback_array: the callback assoc array, must have keys:callback  - the php callback function namecallback function prototype as:function upload_file_callback($sock, $args)file_size - the file sizeargs      - use argument for callback functionmaster_file_id: the master file id to generate the slave file idprefix_name: the prefix name to generage the slave file idfile_ext_name: the file extension name, do not include dot(.)meta_list: meta data assoc array, such asarray('width'=>1024, 'height'=>768)tracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return file_id for success, false for errorboolean FastDFS::storage_delete_file(string group_name, string remote_filename [, array tracker_server, array storage_server])
delete file from storage server
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_delete_file1(string file_id[, array tracker_server, array storage_server])
delete file from storage server
parameters:file_id: the file id to be deletedtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorstring FastDFS::storage_download_file_to_buff(string group_name, string remote_filename [, long file_offset, long download_bytes,array tracker_server, array storage_server])
get file content from storage server
parameters:group_name: the group name of the fileremote_filename: the filename on the storage serverfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return the file content for success, false for errorstring FastDFS::storage_download_file_to_buff1(string file_id[, long file_offset, long download_bytes,array tracker_server, array storage_server])
get file content from storage server
parameters:file_id: the file id of the filefile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return the file content for success, false for errorboolean FastDFS::storage_download_file_to_file(string group_name, string remote_filename, string local_filename [, long file_offset, long download_bytes, array tracker_server, array storage_server])
download file from storage server to local file
parameters:group_name: the group name of the fileremote_filename: the filename on the storage serverlocal_filename: the local filename to save the file contentfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_download_file_to_file1(string file_id, string local_filename [, long file_offset, long download_bytes, array tracker_server, array storage_server])
download file from storage server to local file
parameters:file_id: the file id of the filelocal_filename: the local filename to save the file contentfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_download_file_to_callback(string group_name,string remote_filename, array download_callback [, long file_offset, long download_bytes, array tracker_server, array storage_server])
parameters:group_name: the group name of the fileremote_filename: the filename on the storage serverdownload_callback: the download callback array, elements as:callback  - the php callback function namecallback function prototype as:function my_download_file_callback($args, $file_size, $data)args      - use argument for callback functionfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_download_file_to_callback1(string file_id,array download_callback [, long file_offset, long download_bytes, array tracker_server, array storage_server])
parameters:file_id: the file id of the filedownload_callback: the download callback array, elements as:callback  - the php callback function namecallback function prototype as:function my_download_file_callback($args, $file_size, $data)args      - use argument for callback functionfile_offset: file start offset, default value is 0download_bytes: 0 (default value) means from the file offset to the file endtracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_set_metadata(string group_name, string remote_filename,array meta_list [, string op_type, array tracker_server, array storage_server])
set meta data of the file
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servermeta_list: meta data assoc array to be set, such asarray('width'=>1024, 'height'=>768)op_type: operate flag, can be one of following flags:FDFS_STORAGE_SET_METADATA_FLAG_MERGE: combined with the old meta dataFDFS_STORAGE_SET_METADATA_FLAG_OVERWRITE: overwrite the old meta datatracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorboolean FastDFS::storage_set_metadata1(string file_id, array meta_list[, string op_type, array tracker_server, array storage_server])
set meta data of the file
parameters:file_id: the file id of the filemeta_list: meta data assoc array to be set, such asarray('width'=>1024, 'height'=>768)op_type: operate flag, can be one of following flags:FDFS_STORAGE_SET_METADATA_FLAG_MERGE: combined with the old meta dataFDFS_STORAGE_SET_METADATA_FLAG_OVERWRITE: overwrite the old meta datatracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return true for success, false for errorarray FastDFS::storage_get_metadata(string group_name, string remote_filename[, array tracker_server, array storage_server])
get meta data of the file
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorreturned array like: array('width' => 1024, 'height' => 768)array FastDFS::storage_get_metadata1(string file_id[, array tracker_server, array storage_server])
get meta data of the file
parameters:file_id: the file id of the filetracker_server: the tracker server assoc array including elements: ip_addr, port and sockstorage_server: the storage server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorreturned array like: array('width' => 1024, 'height' => 768)array FastDFS::connect_server(string ip_addr, int port)
connect to the server
parameters:ip_addr: the ip address of the serverport: the port of the server
return assoc array for success, false for errorboolean FastDFS::disconnect_server(array server_info)
disconnect from the server
parameters:server_info: the assoc array including elements:ip_addr, port and sock
return true for success, false for errorarray FastDFS::tracker_get_connection()
get a connected tracker server
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockboolean FastDFS::active_test(array server_info)
send ACTIVE_TEST cmd to the server
parameters:server_info: the assoc array including elements:ip_addr, port and sock, sock must be connected
return true for success, false for errorboolean FastDFS::tracker_make_all_connections()
connect to all tracker servers
return true for success, false for errorboolean FastDFS::tracker_close_all_connections()
close all connections to the tracker servers
return true for success, false for errorarray FastDFS::tracker_list_groups([string group_name, array tracker_server])
get group stat info
parameters:group_name: specify the group name, null or empty string means all groupstracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return index array for success, false for error, each group as a array elementarray FastDFS::tracker_query_storage_store([string group_name, array tracker_server])
get the storage server info to upload file
parameters:group_name: specify the group nametracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for error. the assoc array includingelements: ip_addr, port, sock and store_path_indexarray FastDFS::tracker_query_storage_store_list([string group_name, array tracker_server])
get the storage server list to upload file
parameters:group_name: specify the group nametracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return indexed storage server array for success, false for error.each element is an ssoc array including elements: ip_addr, port, sock and store_path_indexarray FastDFS::tracker_query_storage_update(string group_name, string remote_filename [, array tracker_server])
get the storage server info to set metadata
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray FastDFS::tracker_query_storage_update1(string file_id, [, array tracker_server])
get the storage server info to set metadata
parameters:file_id: the file id of the filetracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray FastDFS::tracker_query_storage_fetch(string group_name, string remote_filename [, array tracker_server])
get the storage server info to download file (or get metadata)
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray FastDFS::tracker_query_storage_fetch1(string file_id [, array tracker_server])
get the storage server info to download file (or get metadata)
parameters:file_id: the file id of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return assoc array for success, false for errorthe assoc array including elements: ip_addr, port and sockarray FastDFS::tracker_query_storage_list(string group_name, string remote_filename [, array tracker_server])
get the storage server list which can retrieve the file content or metadata
parameters:group_name: the group name of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return index array for success, false for error.each server as an array elementarray FastDFS::tracker_query_storage_list1(string file_id[, array tracker_server])
get the storage server list which can retrieve the file content or metadata
parameters:file_id: the file id of the fileremote_filename: the filename on the storage servertracker_server: the tracker server assoc array including elements:ip_addr, port and sock
return index array for success, false for error. each server as an array elementboolean  FastDFS::tracker_delete_storage(string group_name, string storage_ip)
delete the storage server from the cluster
parameters:group_name: the group name of the storage serverstorage_ip: the ip address of the storage server to be deleted
return true for success, false for errorvoid FastDFS::close()
close tracker connections

Centos安装FastDFS集群文件系统相关推荐

  1. Docker集群环境下安装Fastdfs集群+Nginx负载均衡

    一.环境配置 现有两台服务器10.168.103.110(旧服务器)和10.168.103.111(新服务器),其中110服务器上有swarm集群,一个tracker和一个storage,现在要做Fa ...

  2. fastdfs原理_搭建分布式文件系统FastDFS集群

    本文摘选abcdocker运维博客 abcdocker运维博客 – 专注DevOps自动化运维,传播优秀it运维技术文章​i4t.com 在生产环境中往往数据存储量比较大,因此会大部分会选择分布式存储 ...

  3. FastDFS 集群 安装 配置

    原文:http://www.cnblogs.com/ityouknow/p/7769142.html 这篇文章介绍如何搭建FastDFS 集群 FastDFS是一个开源的轻量级分布式文件系统,它对文件 ...

  4. centos 6.4 ceph 分布式集群文件系统部署 手记

    Centos 6.4 ceph 分布式集群文件系统部署 0,  部署环境       IP ADDR       HOSTNAME    rule     192.168.1.120  master- ...

  5. CentOS 7.5 使用 yum 安装 Kubernetes 集群(二)

    一.安装方式介绍 1.yum 安装 目前CentOS官方已经把Kubernetes源放入到自己的默认 extras 仓库里面,使用 yum 安装,好处是简单,坏处也很明显,需要官方更新 yum 源才能 ...

  6. 在CentOS上安装ZooKeeper集群

    一共准备3个CentOS虚拟机 172.16.9.194 172.16.9.195 172.16.9.196 上传zookeeper-3.3.6.tar.gz到服务器并解压,3台服务器的目录结构如下 ...

  7. CentOS 7安装MySQL集群-GALERA CLUSTER 4 FOR MYSQL 8 RELEASE

    CentOS 7安装MySQL集群-GALERA CLUSTER 4 FOR MYSQL 8 RELEASE 文章目录 CentOS 7安装MySQL集群-GALERA CLUSTER 4 FOR M ...

  8. CentOS 6.8 安装JStorm集群(jstorm-2.1.1 )

    Alibaba JStorm 是一个强大的企业级流式计算引擎,是Apache Storm 的4倍性能, 可以自由切换行模式或mini-batch 模式,JStorm 不仅提供一个流式计算引擎, 还提供 ...

  9. Centos离线安装Kubernetes集群

    目录 kuberadmin离线安装K8s集群 环境准备 基础环境配置 安装docker 准备基础镜像以及安装包 镜像 集群初始化 设置.kube/config 安装网络组件 加入node节点 验证集群 ...

最新文章

  1. 新5 年时间服务器从 0 到 200,一个创业公司的架构野蛮生长史头疼哈
  2. Java中final关键字的几种用法
  3. cfF. Boring Queries
  4. linux:vim中全选复制
  5. 每天进步一点点《ML - 异常点检测》
  6. pythonfor循环break_Python break语句 跳出循环
  7. 机器学习什么显卡_为什么要学习机器人编程?
  8. Tensorflow:estimator训练
  9. c语言 prototype_剖析JavaScript中的原型(Prototype)
  10. hdu 1890 Robotic SortI(splay区间旋转操作)
  11. Landsat卫星MSS/TM/ETM数据(转自ESRI社区)(二)
  12. 最新的ARM-GCC下载安装指南
  13. 不使用CAD转换工具,你能转换CAD文件格式吗?
  14. 看看月明光彩照入东 水浒
  15. Vue高德地图Loca 2.0飞线功能初体验
  16. WINCE 注册表修改
  17. QualNet收发包过程分析(一)
  18. 高考数学试题数列求和|附习题
  19. 零基础入门—网站建站教程
  20. Android——仿京东秒杀

热门文章

  1. 利用Javascript输出多个图片
  2. C语言爱心扩展加思路
  3. Mac苹果电脑怎么格式化U盘
  4. 【编程语言学习——python】04字典
  5. 浙江大学计算机学院保研率,浙江省大学保研情况,浙江大学保研率最高,推免人数1549人...
  6. 明基欲出售台北总部 诸多厂商显露收购意向
  7. Windows 部署 Elasticsearch + kibana 8.0 指南
  8. 解决Elasticsearch外网访问的问题(楼主亲测)
  9. ABB HIDRY 72干式变压器
  10. 学习SSH远程登陆协议与TCP Wrappers