Fastdfs Client (Python edition) guide

Source: Internet
Author: User

Recently done a distributed project with the Fastdfs, about Fastdfs here is not elaborated, interested in understanding of the small partners, please go to the official website: http://bbs.chinaunix.net/forum-240-1.html. Here we focus on the Fastdfs client (Python version), this version of the client has been used in the actual project, currently running stable. Project hosted in Git, Address: https://github.com/cosysun/FastDFSClient_Python.git.


First, the principle

Re-encapsulates the C + + interface on the basis of the official C + + client and provides the Python call


Second, the advantage

1, efficiency than the pure Python version of the higher

2, easy to maintain, with the official website C + + client update synchronization

3, good stability


Third, installation instructions

I use the installation environment is the CentOS 6.4 64bit, the specific steps are as follows:

1. Copy Clientforpython to Fastdfs source code client Directory

2. Copy the JSON library CP json/lib/*/usr/local/lib/ldconfig

Here is the JSON library I compiled under CentOS, there may be conflicts on other systems, please download the source code recompile, address: https://github.com/open-source-parsers/jsoncpp.git

3. Execute make on the Access client directory

Please note that makefile should be modified according to the FASTDFS installation directory.


Iv. Introduction of the interface

1, fdfs_init (parameter 1st log level) Initialize FASTDFS client

Parameter 1: String FASTDFS Client Profile directory, for example: "/etc/fdfs/client.conf"

Parameter 2: Shaping print Log level total seven levels

Log_emerg = 0log_alert = 1log_crit = 2log_err = 3log_warning = 4log_notice = 5log_info = 6log_debug = 7

2, Fdfs_download (parameter 1, parameter 2) Download the file

Parameter 1: The FASTDFS group name where the string is located for example: group2

Parameter 2: String specific storage path for example: m00/00/00/cgeizvrlv3sayjctaaasfwwtovg9432330


3, Fdfs_upload (parameter 1, parameter 2) upload file

Parameter 1: String file contents

Parameter 2: string file suffix default can be null ""

4, Fdfs_delete (parameter 1, parameter 2) Delete file

Parameter 1: The FASTDFS group name where the string is located for example: group2

Parameter 2: String specific storage path for example: m00/00/00/cgeizvrlv3sayjctaaasfwwtovg9432330


5, monitoring Fastdfs information

List_all_groups () monitor all group information

List_one_group ("IP Address") monitors specified IP information

List_storages ("group name", "IP Address") monitors the information in a group under storages and monitors all if IP is not empty.


V. Examples of Use

Please refer to test cases under the test directory


Vi. Contact

The problem of small partners, please join the group: 291368579


Fastdfs Client (Python edition) Guide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.