Full record of FastDFS installation in Ubuntu

Source: Internet
Author: User
Tags file url
Install FastDFS In Ubuntu. The first step is to prepare the file: Please download two files. fastdfs_v3.06.tar.gzlibevent-2.0.17-stable.tar.gz will not describe their installation process here, but note that if you need an HTTP connection, make. in sh, change # WITH_HTTPD = 1 to WITH_HTTPD = 1, and then install. When I install FastDFS, an error is reported:/h.

For Notes on installing FastDFS in Ubuntu, the first step is preparation: We need to download two files,

FastDFS_v3.06.tar.gz

Libevent-2.0.17-stable.tar.gz

Here we will not go into details about their installation process, but note that if you need an HTTP connection# WITH_HTTPD = 1 to WITH_HTTPD = 1And then install it. When I install FastDFS, an error is reported:

  1. /Home/FastDFS/tracker/../common/sched_thread.c: 493: undefined reference to 'pthread _ create' ../common/pthread_func.o:
  2. In function 'init _ pthread_lock ':/home/FastDFS/tracker/../common/pthread_func.c: 32: undefined reference to 'pthread _ mutexattr_init'
  3. /Home/FastDFS/tracker/../common/pthread_func.c: 40: undefined reference to 'pthread _ mutexattr_settype'
  4. /Home/FastDFS/tracker/../common/pthread_func.c: 57: undefined reference to 'pthread _ mutexattr_destroy '../common/pthread_func.o:
  5. In function 'init _ pthread_attr ':/home/FastDFS/tracker/../common/pthread_func.c: 84: undefined reference to 'pthread _ attr_getstacksize'
  6. /Home/FastDFS/tracker/../common/pthread_func.c: 115: undefined reference to 'pthread _ attr_setstacksize' ../common/pthread_func.o:
  7. In function 'create _ work_threads':/home/FastDFS/tracker/../common/pthread_func.c: 156: undefined reference to 'pthread _ create'
  8. ../Common/pthread_func.o:
  9. In function 'Kill _ work_threads':/home/FastDFS/tracker/../common/pthread_func.c: 182: undefined reference to 'pthread _ kill'
  10. Collect2: ld returns 1 make: *** [fdfs_monitor] Error 1

After searching on the Internet, it is found that pthread locations are different in different systems. The approach is to find the location of the libpthread. so file in your system, and find it directly;

  1. Root @ www.linuxidc.com :~ # Find/-name 'libthread.'
  2. /Usr/lib/i386-linux-gnu/xen/libpthread.
  3. /Usr/lib/i386-linux-gnu/libpthread.
  4. Root @ www.linuxidc.com :~ # Find/-name 'libpthread. so'
  5. /Usr/lib/i386-linux-gnu/libpthread. so

Then, find this sentence in make. sh and replace it with the following:

  1. If [-f/usr/lib/libpthread. so] | [-f/usr/local/lib/libpthread. so] | [-f/usr/lib64/libpthread. so] | [-f/usr/lib/libpthread. a] | [-f/usr/local/lib/libpthread. a] | [-f/usr/lib64/libpthread. a]; thenLIBS="$ LIBS-lpthread"

Then it will be OK after compilation.

  1. ./Make. sh
  2. ./Make. sh install
  3. Cd/home/FastDFS/conf/

Here is a brief introduction to the FastDFS workflow. It consists of three parts: tracker, storage, and client. tracker is a repository administrator who manages storage, tracker has its own unique ip address and port number. This is important. Each storage warehouse must connect to the tracker through the ip address and port, which is centrally managed by the tracker. So the following is their configuration method and process:

  1. Vim tracker. conf
  2. # The base path to store data and log filesBase_path=/Home/FastDFS/tracker_infoReserved_storage_space=1 GB
  3. # HTTP settingsHttp. disabled=False
  4. # HTTP port on this tracker serverHttp. server_port=8090
  5. # Use "# include" directive to include http other settings
  6. # Include http. conf
  7. Vim http. conf
  8. # Return the content of the file when check token fail
  9. # Default value is empty (no file sepecified)Http. anti_steal.token_check_fail=/Home/FastDFS/conf/anti-steal.jpg
  10. Vim/etc/fdfs/http. conf
  11. # Return the content of the file when check token fail
  12. # Default value is empty (no file sepecified)Http. anti_steal.token_check_fail=/Home/FastDFS/conf/anti-steal.jpg

Then the tracker service is configured and can be started directly: You can see that the tracker port number is 22122 and you will know that it has started. Port 8090 indicates that http is also enabled.

  1. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  2. Tcp 0 0 0.0.0.0: 22122 0.0.0.0: * LISTEN 9843/fdfs_trackerd
  3. Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN 1040/mysqld
  4. Tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN 791/sshd
  5. Tcp 0 0 127.0.0.1: 631 0.0.0.0: * LISTEN 920/cupsd
  6. Tcp 0 0 0.0.0.0: 8888 0.0.0.0: * LISTEN 9942/fdfs_storaged
  7. Tcp 0 0 0.0.0.0: 23000 0.0.0.0: * LISTEN 9942/fdfs_storaged
  8. Tcp 0 0 0.0.0.0: 8090 0.0.0.0: * LISTEN

The following describes how to configure storage information.

  1. Root @ www.linuxidc.com:/home/FastDFS/conf/# vim storage. conf
  2. # The name of the group this storage server belongsGroup_name=Dcifile1 Client_bind=True
  3. # The storage server portPort=23000
  4. # The base path to store data and log files 
 
  1. Base_path=/Home/FastDFS/storage_info
  2. # Store_path #, based 0, if store_path0 not exists, it's value is base_path
  3. # The paths must be exist 
 
  1. Store_path0=/Home/FastDFS/storage_data
  2. #Store_path1=/Home/yuqing/fastdfs2
  3. # Tracker_server can ocur more than once, and tracker_server format is
  4. # "Host: port", host can be hostname or ip addressTracker_server=10. 5.110.234: 22122
  5. # The port of the web server on this storage serverHttp. server_port=8888 Http. trunk_size=256KB
  6. # If need find content type from file extension nameHttp. need_find_content_type=True
  7. # Use "# include" directive to include HTTP other settings
  8. # Include http. conf
  9. Root @ www.linuxidc.com:/home/FastDFS/# mkdir storage_info
  10. Root @ www.linuxidc.com:/home/FastDFS/# mkdir storage_data
  11. Root @ www.linuxidc.com:/home/FastDFS/# mkdir client_info
  12. Root @ www.linuxidc.com:/home/FastDFS/conf/# cd/usr/local/bin/
  13. Root @ www.linuxidc.com:/usr/local/bin/# fdfs_storaged/home/FastDFS/conf/storage. conf
  14. Root @ www.linuxidc.com:/home/FastDFS/conf/# vim client. conf
  15. # The base path to store log files
  16. Base_path=/Home/FastDFS/client_info
  17. # Tracker_server can ocur more than once, and tracker_server format is
  18. # "Host: port", host can be hostname or ip address
  19. Tracker_server=10. 5.110.234: 22122
  20. # Standard log level as syslog, case insensitive, value list:
  21. ### Emerg for emergency
  22. ### Alert
  23. ### Crit for critical
  24. ### Error
  25. ### Warn for warning
  26. ### Notice
  27. # Info
  28. ### DebugLog_level=Info
  29. # HTTP settings
  30. Http. tracker_server_port=8090
  31. # Use "# include" directive to include HTTP other settiongs
  32. # Include http. conf
  33. Root @ www.linuxidc.com:/usr/local/bin/# fdfs_test/home/FastDFS/conf/client. conf upload a.txt source ip address: 10.5.110.234
  34. FileTimestamp=2012-03-11 11:29:59
  35. FileSize=22
  36. FileCrc32=2041760096
  37. File url: http: // 10.5.110.234: 8090/dcifile1/M00/00/00/CgVu6k9cHDf4SXnIAAAAFnmyyWA295_big.txt

It is done here. In comparison, FastDFS is quite easy to configure. Come on ......

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.