FastDFSV3.02 installation and configuration, migration, fastdfsv3.02 migration

Source: Internet
Author: User
Tags crc32 file url

FastDFSV3.02 installation and configuration, migration, fastdfsv3.02 migration
Background:

We used fastdfsV3.02 on the original server, and now we want to migrate it to the new server. There are no relevant documents on the Internet and it has been a long time. Now we will record the migration process as follows to facilitate the configuration and migration of other students.


Tracker server: 192.168.1.246
Storage Server: 192.168.1.246

Deploy tracker and storage on the same server when the traffic volume is not large.


1. Configure the tracker server: 192.168.1.246
1. Download related 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 the 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. Configure, compile and install FastDFS
Tar-zxvf FastDFS_v3.02.tar.gz
Cd FastDFS
Vi make. sh (modify the following items)
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/(after the installation is successful, the following files will be generated in/etc/fdfs)
Client. conf http. conf mime. types storage. conf tracker. conf


4. Modify the tracker configuration file
Vi/etc/fdfs/tracker. conf
Pay attention to the following configuration items.


Bind_addr = // bound IP Address
Port = 22122 // The listening port
Base_path =/home/data/fastdfs // storage path
Store_group = group2
Reserved_storage_space = 4 GB // reserved storage space
Http. server_port = 8080
# Include httpd. conf // There were originally two # numbers. Remove one #.


5. Modify http. conf
Vi/etc/fdfs/http. conf
Pay attention to the following configuration items.

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 the tracker service.
Note that the last line of the tracker. conf file is # include httpd. conf.
(1) Add a library file (if the following command cannot be correctly executed, 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 the tracker Service
/Usr/local/fastdfs/bin/fdfs_trackerd/etc/fdfs/tracker. conf
Echo $?
After the startup is complete, view the process:
Ps-ef | grep track

Add the settings in the firewall and open the corresponding 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

Ii. Configure the storage server: 192.168.1.246
If you want to install FastDFS on another server, you need to install FastDFS again. You do not need to install FastDFS on the same server. The installation steps are the same as above, but only the configuration files are different.
1. Add a storage directory:
Mkdir-p/usrdata/storage

2. Modify the storage node configuration file
Vi/etc/fdfs/storage. conf
Pay attention to the following configuration items.

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 // There were originally two # numbers. Remove one #.


3. modify the configuration file of the test client for testing)
Vi/etc/fdfs/client. conf
Pay attention to the following configuration items.

Base_path =/usrdata/fastdfs
Tracker_server = 192.168.1.246: 22122
Http. tracker_server_port = 8080
# Include httpd. conf

4. Modify http. conf
Vi/etc/fdfs/http. conf
Pay attention to the following configuration items.

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

Iii. Test File Upload
Upload File/home/test/a.jpg for testing
/Usr/local/FastFDS/bin/fdfs_test/etc/fdfs/client. conf upload/home/test/a.jpg

This is FastDFS client test program v3.02
Copyright (C) 2008, Happy Fish/YuQing
FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
For more detail.
[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 = keys:
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
Files 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
Files size = 71850
File crc32 = 3833797383
File url: http: // 192.168.1.246: 8080/group1/M00/00/00/wKh7FFAWReLzPs4sAAEYquSDGwc472_big.jpg


4. 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 the tracker_server IP address to the old Server IP address 192.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
The storage server starts synchronization;


View the synchronization process:
Run the following command on the old tracker server:
/Usr/local/fastdfs/bin/fdfs_monitor/etc/fdfs/storage. conf
You can see the synchronization progress;


4. After synchronization, 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 and change the tracker to a new tracker IP address.
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 the sync_src_server configuration item empty. Other configuration items remain unchanged.
Sync_src_server =


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


View the status of the storage process:
/Usr/local/fastdfs/bin/fdfs_monitor/etc/fdfs/storage. conf


Complete.

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.