Abstract: FastDFS is an open source, high performance distributed file system, his main functions include: file storage, synchronization and access, design based on high availability and load balancing, FastDFS is very suitable for sites based on file services, such as image sharing and video sharing sites

Declaration: for distributed some technical points can be found on the Internet, here for some basic operations to do some relevant summary, and as a distributed framework technology support document, I hope to help you

FastDFS is an open source, high performance distributed file system. Its main functions include: file storage, synchronization and access, designed based on high availability and load balancing, FastDFS is ideal for file-based sites such as photo sharing and video sharing

FastDFS has two roles: the Tracker service and the Storage service. The tracker service controls and schedules files for load balancing access. Storage services include file storage, file synchronization, file access interfaces, and file metadata management in key value mode

Tracking and storage services can consist of one or more servers, and can be added or deleted dynamically without affecting online services. In a cluster, the tracker service is peer-to-peer

save

A storage system consists of one or more volumes. The files on each volume are independent of each other. The total file capacity of all volumes is the file capacity of the entire storage system. A volume can consist of one or more storage servers,

All files in a storage server under a volume are the same. Multiple storage servers in a volume provide redundancy and load balancing. When a server is added to a volume, the system automatically synchronizes existing files

After this step is complete, the system automatically switches the newly added server to online services. When the storage space is insufficient or about to be used up, you can dynamically add volumes. You just need to add one or more servers and configure them as a new one

Volume, thus expanding the capacity of the storage system.

First, start installation:

  1. In code.google.com/p/fastdfs/d… Download the required files and install Libevent first.
  2. The tar XZF FastDFS_v2. 11. Tar. Gz
  3. cd FastDFS

If HTTP is supported, use vi make.sh to find this line with /WITH_HTTPD, type I to enter editing mode, delete the comment #, :wq save and exit, if you want to install as a service, unpack the following line.

./make.sh

./make.sh install

  1. Prepare a few free port, you can use the netstat – an | grep port is being used.
  2. If HTTP is required, don’t forget to unpack the #include http.conf file at the bottom, with a #
  3. Start tracker: /usr/local/bin/fdfs_trackerd /etc/ffs/tracker.conf
  4. Run the /usr/local/bin/fdfs_storaged /etc/ffs/storage. conf command to start storage. If an error occurs, go to the log directory specified in Step 5 to view the error cause.
  5. The installation and configuration is complete

The following executable files are available in the FastDFS installation directory bin.

Upload the /usr/local/bin/fdfs_upload_file file

Download file: /usr/local/bin/fdfs_download_file [local_filename]

Run the /usr/local/bin/fdfs_delete_file command to delete a file

monitor: /usr/local/bin/fdfs_monitor /etc/fdfs/client.conf

Close:

killall fdfs_trackerd

killall fdfs_storaged

or

/usr/local/bin/stop.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf

/usr/local/bin/stop.sh /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf

Resume:

/usr/local/bin/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf

/usr/local/bin/restart.sh /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf

Iii. Test upload:

./fdfs_test .. /conf/client.conf upload qi.png, you can see that the file is successfully uploaded.

In the app/fdfs407 / data/data / 00/3 c directory can be found just upload pictures:

FastDFS upload/download process:

The first client initiates a FastDFS file transfer by connecting to a Tracker Server

The Tracker Server determines which Storage Server to select based on the available information

, and returns the Storage Server address and other information to the client. The client then uses the information to connect to the Storage

Server, the file to be uploaded to the Storage Server.

Upload process:

Download process:

In my project, it is generally ok to start 2 tracker and 2 storage, as shown below:

./fdfs_trackerd .. /conf/tracker-1.conf

./fdfs_trackerd .. /conf/tracker-2.conf

./fdfs_storaged .. /conf/storage-g1-1.conf

./fdfs_storaged .. /conf/storage-g2-1.conf

Announcement: All blog services distributed framework, as the framework of technical support and description, the framework for enterprise, is a large Internet distributed enterprise architecture, the deployment of high availability cluster project on Linux will be introduced later.