FastDFSV3.02 installation and configuration, migration

Source: Internet
Author: User
Tags crc32 file url

background:

We use fastdfsV3.02 on the original server, now to migrate to the new server, no related documents on the Internet, tossing for a long time, now the migration process is recorded as follows, so that other students to configure and migrate


Tracker Server: 192.168.1.246
Storage server: 192.168.1.246

Both tracker and storage are deployed on the same server when the traffic is not very large


First, configure the tracker server: 192.168.1.246
1. Download the relevant software
wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.14-stable.tar.gz
wget http://fastdfs.googlecode.com/files/FastDFS_v3.02.tar.gz

2. Compile and install Libevent Library
TAR-ZXVF libevent-2.0.14-stable.tar.gz
CD libevent-2.0.14-stable
./configure--prefix=/usr/local/libevent
Make && make install

3, configuration, compile and install Fastdfs
TAR-ZXVF fastdfs_v3.02.tar.gz
CD Fastdfs
VI make.sh (Modify the next few places)
Target_prefix=/usr/local/fastdfs
Target_conf_path=/etc/fdfs
With_httpd=1
With_linux_service=1


./make.sh C_include_path=/usr/local/libevent/include Library_path=/usr/local/libevent/lib
./make.sh Install


ls/etc/fdfs/(The following files will be generated in/etc/fdfs/after successful installation)
client.conf http.conf mime.types storage.conf tracker.conf


4. Modify the Tracker configuration file
Vi/etc/fdfs/tracker.conf
Focus on the following configuration items, other general default can be


Bind_addr= The bound IP
port=22122 Ports to listen on
Base_path=/home/data/fastdfs Storage path
Store_group=group2
Reserved_storage_space = 4GB//Reserved storage space
http.server_port=8080
#include httpd.conf It turns out there are two # numbers, minus a # #


5, modify the http.conf
Vi/etc/fdfs/http.conf
Focus on the following configuration items, other general default can be

Http.default_content_type = Application/octet-stream
Http.mime_types_filename=/etc/fdfs/mime.types
Http.anti_steal.check_token=false
http.anti_steal.token_ttl=900
http.anti_steal.secret_key=fastdfs1234567890
Http.anti_steal.token_check_fail=/usrdata/fastdfs/conf/anti-steal.jpg


6. Start Tracker Service
Note the last behavior of the tracker.conf file # include httpd.conf
(1) Add the library file (if the following command is not executed correctly, please enter it manually)
Echo '/usr/local/libevent/include/' >>/etc/ld.so.conf
Echo '/usr/local/libevent/lib/' >>/etc/ld.so.conf
Ldconfig


(2) Create Basedir
Mkdir-p/usrdata/fastdfs


(3) Start tracker service
/usr/local/fastdfs/bin/fdfs_trackerd/etc/fdfs/tracker.conf
echo $?
Start complete, review the process:
Ps-ef |grep Track

Add the settings in the firewall and open the appropriate port:
Vi/etc/sysconfig/iptables
-A rh-firewall-1-input-p tcp-m tcp--dport 22122-j ACCEPT
-A rh-firewall-1-input-p tcp-m tcp--dport 8080-j ACCEPT
?
Second, configure the storage server: 192.168.1.246
If you are installing on another server, you need to install Fastdfs again, not on the same server, the installation steps are the same as above, only the configuration files are different.
1. Add Storage Storage directory:
Mkdir-p/usrdata/storage

2. Modify the storage node configuration file
Vi/etc/fdfs/storage.conf
Focus on the following configuration items, other general default can be

Group_name=group1
Bind_addr=
Base_path=/usrdata/storage
Store_path_count=1
Store_path0=/usrdata/storage
tracker_server=192.168.1.246:22122
http.server_port=8888
#include httpd.conf It turns out there are two # numbers, minus a # #


3. Modify the test client configuration file (for testing)
Vi/etc/fdfs/client.conf
Focus on the following configuration items, other general default can be

Base_path=/usrdata/fastdfs
tracker_server=192.168.1.246:22122
http.tracker_server_port=8080
#include httpd.conf

4, modify the http.conf
Vi/etc/fdfs/http.conf
Focus on the following configuration items, other general default can be

Http.default_content_type = Application/octet-stream
Http.mime_types_filename=/etc/fdfs/mime.types
Http.anti_steal.check_token=false
http.anti_steal.token_ttl=900
http.anti_steal.secret_key=fastdfs1234567890
Http.anti_steal.token_check_fail=/usrdata/fastdfs/conf/anti-steal.jpg


5. Start Storage
/usr/local/fastdfs/bin/fdfs_storaged/etc/fdfs/storage.conf

Third, the test file upload
Uploading files/home/test/a.jpg for testing
/usr/local/fastfds/bin/fdfs_test/etc/fdfs/client.conf upload/home/test/a.jpg

This was FASTDFS Client test program v3.02
Copyright (C), Happy fish/yuqing
Fastdfs may copied only under the terms of the GNU general
Public License V3, which is found in the FASTDFS source kit.
Please visit the Fastdfs Home Page http://www.csource.org/
For more detail.
[2012-07-30 16:29:22] Info–base_path=/home/data/fastdfs, connect_timeout=30, network_timeout=60, Tracker_server_count=1, Anti_steal_ Token=0, Anti_steal_secret_key Length=0tracker_query_storage_store_list_without_group:
Server 1. Group_name=group1, ip_addr=192.168.1.246, port=23000 group_name=group1, ip_addr=192.168.1.246, port=23000
Storage_upload_by_filename
Group_name=group1, Remote_filename=m00/00/00/wkh7ffawrelzps4saaeyqusdgwc472.jpg
Source IP address:192.168.1.246.20
File timestamp=2012-07-30 16:29:22
File size=71850
File crc32=3833797383
File url:http://192.168.1.246:8080/group1/m00/00/00/wkh7ffawrelzps4saaeyqusdgwc472.jpg
Storage_upload_slave_by_filename
Group_name=group1, Remote_filename=m00/00/00/wkh7ffawrelzps4saaeyqusdgwc472_big.jpg
Source IP address:192.168.1.246
File timestamp=2012-07-30 16:29:22
File size=71850
File crc32=3833797383
File url:http://192.168.1.246:8080/group1/m00/00/00/wkh7ffawrelzps4saaeyqusdgwc472_big.jpg


Iv. Common commands:

1. Start:
/usr/local/fastdfs/bin/fdfs_trackerd/etc/fdfs/tracker.conf
/usr/local/fastdfs/bin/fdfs_storaged/etc/fdfs/storage.conf


2. Stop:
/usr/local/fastdfs/bin/stop.sh/usr/local/fastdfs/bin/fdfs_trackerd
/usr/local/fastdfs/bin/stop.sh/usr/local/fastdfs/bin/fdfs_storaged


3. Restart:
/usr/local/fastdfs/bin/restart.sh/usr/local/fastdfs/bin/fdfs_trackerd
/usr/local/fastdfs/bin/restart.sh/usr/local/fastdfs/bin/fdfs_storaged


V. Migration:
The above is normal configuration and startup, I want to migrate files from the old Fastdfs server to the new Fastdfs file server:
1. Stop all storage processes first:
/usr/local/fastdfs/bin/stop.sh/usr/local/fastdfs/bin/fdfs_storaged
2. Modify the storage.conf file
Vi/etc/fdfs/storage.conf
Set Tracker_server IP to the old server IP192.168.1.53
tracker_server=192.168.1.53:22122


3. Start the storage process:
/usr/local/fastdfs/bin/fdfs_storaged/etc/fdfs/storage.conf
At this time the storage server begins to synchronize;


To view the synchronization process:
In the old tracker server execution:
/usr/local/fastdfs/bin/fdfs_monitor/etc/fdfs/storage.conf
You can see the synchronization progress;


4. After the synchronization is complete, stop the storage process on the new Fastdfs file server 192.168.1.246:
/usr/local/fastdfs/bin/stop.sh/usr/local/fastdfs/bin/fdfs_storaged

5. Modify the storage.conf file to change the tracker to a new tracker IP
Vi/etc/fdfs/storage.conf

tracker_server=192.168.1.246:22122

6. Modify the. data_init_flag file:
cd/usrdata/storage/data/
VI. Data_init_flag
Leave Sync_src_server configuration items blank and other configuration items unchanged
Sync_src_server=


7. Start the storage process
/usr/local/fastdfs/bin/fdfs_storaged/etc/fdfs/storage.conf


To view the storage process status:
/usr/local/fastdfs/bin/fdfs_monitor/etc/fdfs/storage.conf


Complete.

FastDFSV3.02 installation and configuration, migration

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.