Install FastDFS on centos

Source: Internet
Author: User

Install FastDFS on centos

Download link to install the desired file: http://download.csdn.net/detail/zhangbest2009/9795602

========================================================== ==============================================

Step 1. Install the dependency package libevent

[Root @ zhangserver soft] # rpm-aq | grep libevent | xargs rpm-e -- nodeps
[Root @ zhangserver soft] # tar zxvf libevent-2.0.15-stable.tar.gz
[Root @ zhangserver soft] # cd libevent-2.0.15-stable
[Root @ zhangserver soft] #./configure -- prefix =/usr/local/libevent
[Root @ zhangserver soft] # make & make install
[Root @ zhangserver soft] # echo "/usr/local/libevent/lib">/etc/ld. so. conf
[Root @ zhangserver soft] # ldconfig


Step 2. Install fastDFS (for tracker)
1) tracker side installation:
[Root @ zhangserver soft] # tar zxvf FastDFS_v4.06.tar.gz
[Root @ zhangserver soft] # cd FastDFS
[Root @ zhangserver soft] # vi make. sh
// Delete row 65 # WITH_LINUX_SERVICE (chkconfig Management Service)
[Root @ zhangserver soft] #./make. sh C_INCLUDE_PATH =/usr/local/libevent/include LIBRARY_PATH =/usr/local/libevent/lib
[Root @ zhangserver soft] #./make. sh install

2) storage-side installation: (because both tracker and storage are on one machine, you do not need to install them again)
The installation method is the same as that of tracker. Modify different configuration files and start the corresponding service.
After the installation is complete, you can see the relevant configuration file of fastDFS, as shown below: Use this command to view [ls/etc/fdfs/]
Tracker. conf // configuration file for the balanced scheduling Server
Client. conf // upload the configuration file from the client
Storage. conf // file storage server configuration file
Mime. types // file type configuration file

3) Start fastDFS tracker

// Create a directory to record information such as tracker logs and storage server.
[Root @ zhangserver soft] # mkdir-m 777-p/opt/fastdfs
// Modify tracker. conf
[Root @ zhangserver soft] # vi/etc/fdfs/tracker. conf

Row 40 store_group = group1
Change 22 rows to base_path =/opt/fastdfs
Change row 222 to http. server_port = 8080 #### the default value is 8080.

// Enable tracker
[Root @ zhangserver soft] #/usr/local/bin/fdfs_trackerd/etc/fdfs/tracker. conf
// Check whether the port is enabled. If the port is 22122, the startup is normal.

4) Start fastDFS storage
// Modify storage. conf
[Root @ fastdfs2 fdfs] # vi/etc/fdfs/storage. conf

Change 7 rows to group_name = group1
Modify 37 rows to base_path =/opt/fastdfs
Change row 100 to store_path0 =/opt/fastdfs
Modify row 109 to tracker_server = 192.168.1.23: 22122 // If there are multiple trackers, fill in multiple addresses for cluster creation.
Modify row 110 to tracker_server = 192.168.1.24: 22122 // If there are multiple trackers, fill in multiple addresses for cluster creation.
// Start storage
/Usr/local/bin/fdfs_storaged/etc/fdfs/storage. conf
// Check whether the port is enabled. If the port is 23000, the startup is normal. If not, view the logs in/data/fastdFS/logs.

Step 3: Test File Upload
1) configure the client to upload files
[Root @ fastdfs2 fdfs] # vi/etc/fdfs/client. conf
Base_path =/opt/fastdfs
Tracker_server = 192.168.1.23: 22122
Http. tracker_server_port = 8080 // This must be the same as the configuration in tracker. conf.
### Create a test file
[Root @ fastdfs2 fdfs] # echo 'Hi fdfs'>/temp/temp.txt
### Client File Upload Command
[Root @ fastdfs2 fdfs] #/usr/local/bin/fdfs_upload_file/etc/fdfs/client. conf/temp/temp.txt
Group1/M00/00/00/CgEMDVWSUv6AD1dhAAAAC_UDvNc176.txt

The specific file name is as follows:
[Root @ fastdfs1 00] # cat/opt/fastdfs/data/00/00/CgEMDVWSUv6AD1dhAAAAC_UDvNc176.txt
Hello fdfs

Related Article

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.