How to install and configure the FastDFS distributed file system in CentOS

Source: Internet
Author: User
FastDFS is an open-source lightweight distributed file system that manages files, including file storage, file synchronization, and file access (file upload and download, it solves the problems of large-capacity storage and load balancing. It is especially suitable for online services with files as the carrier, such as photo album websites and video websites. FastD FastDFS is an open source lightweight distributed file system that manages files, features include: file storage, file synchronization, file access (file upload, file download), etc. Server load balancer. It is particularly suitable for online services with files as the carrier, such as photo album websites and video websites.
CentosTo install and configure FastDFS in the system:

1: install libevent (libevent-2.0.16-stable)
# Uninstall the built-in libevent
Rpm-qa | grep libevent rpm-e libevent *
# Install libevent for Trackerd and Storaged nodes
Cd/home/ylh
Wgethttp: // unclelu-server.googlecode.com/files/libevent-2.0.16-stable.tar.gz
Tar-zxvf libevent-2.0.16-stable.tar.gz
Cd libevent-2.0.16-stable
Make clean
./Configure
Make & make install
# Create a soft link for the libevent under the/lib Library. the 64-bit system corresponds to/lib64
Ln-s/usr/local/lib/libevent */lib/
Ln-s/usr/local/lib/libevent */lib64/

2: install FastDFS for the Trackerd node and modify the configuration file/etc/fdfs/tracker. conf (if Trackerd needs to use the built-in webserver, you need to modify the make file, enable WITH_HTTPD = 1, and then compile)
Cd/home/ylh
Wget http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gz
Tar-zxvf FastDFS_v3.06.tar.gz
Cd FastDFS_v3.06
./Make. sh
./Make. sh install
# Create a storage directory
Mkdir/home/ylh/fastdfs
# Modify the configuration file. vim/etc/fdfs/tracker. conf, save the modification, and exit
# Start Trackerd
/Usr/local/bin/fdfs_trackerd/etc/fdfs/tracker. conf

3: install FastDFS for the Storaged node, and the Storaged node also needs libevent. for installation steps, see step 1.
Cd/home/ylh
Wget http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gz
Tar-zxvf FastDFS_v3.06.tar.gz
Cd FastDFS_v3.06
./Make. sh
./Make. sh install

4: install the web server for the Storaged node. the Storaged node can useNginxOr apache provides the http download service. Here we chooseNginx.
Cd/home/ylh
Wget http://nginx.org/download/nginx-0.8.55.tar.gz
Tar zxvf nginx-0.8.55.tar.gz
Cd nginx-0.8.55
./Configure? Prefix =/opt/nginx? With-http_stub_status_module
Make & make install

5: install fastdfs-nginx-module for the Storaged node
Cd/home/ylh
Wgethttp: // fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.10.tar.gz
Tar xzf fastdfs_nginx_module_v1.05.tar.gz
Cd/home/ylh/nginx-0.8.55./configure? Add-module =/home/ylh/fastdfs-nginx-module/src
Make; make install

6: modify the nginx configuration file and save and exit (vim/usr/local/nginx/conf/nginx. conf)
Location/M00 {
Root/home/ylh/fastdfs/data;
Ngx_fastdfs_module;
}

7. copy and modify the nginx module configuration file
Cp/home/ylh/fastdfs-nginx-module/src/mod_fastdfs.conf/etc/fdfs
Vim: Save/etc/fdfs/mod_fastdfs.conf and exit.
# Start nginx
/Usr/local/nginx/sbin/nginx

8. modify the configuration file/etc/fdfs/storage. conf of the Storaged node and start Storaged.
# Create a storage directory mkdir/home/ylh/fastdfs
# Modify the vim/etc/fdfs/storage. conf configuration and save and exit
# Start Storaged
/Usr/local/bin/fdfs_storaged/etc/fdfs/storage. conf

9: test
# Modify the client configuration file/etc/conf/client. conf and save and exit
# Test Upload
/Usr/local/bin/fs_test/etc/conf/client. conf upload/home/a.jpg
If the upload succeeds and the echo information contains the file url, enter the url address in the browser, and the tracker server will automatically redirect to the storageserver of the stored file. the file is downloaded successfully.
So far, FastDFS has been successfully set up.

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.