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:
- /Home/FastDFS/tracker/../common/sched_thread.c: 493: undefined reference to 'pthread _ create' ../common/pthread_func.o:
- In function 'init _ pthread_lock ':/home/FastDFS/tracker/../common/pthread_func.c: 32: undefined reference to 'pthread _ mutexattr_init'
- /Home/FastDFS/tracker/../common/pthread_func.c: 40: undefined reference to 'pthread _ mutexattr_settype'
- /Home/FastDFS/tracker/../common/pthread_func.c: 57: undefined reference to 'pthread _ mutexattr_destroy '../common/pthread_func.o:
- In function 'init _ pthread_attr ':/home/FastDFS/tracker/../common/pthread_func.c: 84: undefined reference to 'pthread _ attr_getstacksize'
- /Home/FastDFS/tracker/../common/pthread_func.c: 115: undefined reference to 'pthread _ attr_setstacksize' ../common/pthread_func.o:
- In function 'create _ work_threads':/home/FastDFS/tracker/../common/pthread_func.c: 156: undefined reference to 'pthread _ create'
- ../Common/pthread_func.o:
- In function 'Kill _ work_threads':/home/FastDFS/tracker/../common/pthread_func.c: 182: undefined reference to 'pthread _ kill'
- 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;
- Root @ www.linuxidc.com :~ # Find/-name 'libthread.'
- /Usr/lib/i386-linux-gnu/xen/libpthread.
- /Usr/lib/i386-linux-gnu/libpthread.
- Root @ www.linuxidc.com :~ # Find/-name 'libpthread. so'
- /Usr/lib/i386-linux-gnu/libpthread. so
Then, find this sentence in make. sh and replace it with the following:
- 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.
- ./Make. sh
- ./Make. sh install
- 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:
- Vim tracker. conf
- # The base path to store data and log filesBase_path=/Home/FastDFS/tracker_infoReserved_storage_space=1 GB
- # HTTP settingsHttp. disabled=False
- # HTTP port on this tracker serverHttp. server_port=8090
- # Use "# include" directive to include http other settings
- # Include http. conf
- Vim http. conf
- # Return the content of the file when check token fail
- # Default value is empty (no file sepecified)Http. anti_steal.token_check_fail=/Home/FastDFS/conf/anti-steal.jpg
- Vim/etc/fdfs/http. conf
- # Return the content of the file when check token fail
- # 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.
- Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
- Tcp 0 0 0.0.0.0: 22122 0.0.0.0: * LISTEN 9843/fdfs_trackerd
- Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN 1040/mysqld
- Tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN 791/sshd
- Tcp 0 0 127.0.0.1: 631 0.0.0.0: * LISTEN 920/cupsd
- Tcp 0 0 0.0.0.0: 8888 0.0.0.0: * LISTEN 9942/fdfs_storaged
- Tcp 0 0 0.0.0.0: 23000 0.0.0.0: * LISTEN 9942/fdfs_storaged
- Tcp 0 0 0.0.0.0: 8090 0.0.0.0: * LISTEN
The following describes how to configure storage information.
- Root @ www.linuxidc.com:/home/FastDFS/conf/# vim storage. conf
- # The name of the group this storage server belongsGroup_name=Dcifile1 Client_bind=True
- # The storage server portPort=23000
- # The base path to store data and log files
- Base_path=/Home/FastDFS/storage_info
- # Store_path #, based 0, if store_path0 not exists, it's value is base_path
- # The paths must be exist
- Store_path0=/Home/FastDFS/storage_data
- #Store_path1=/Home/yuqing/fastdfs2
- # Tracker_server can ocur more than once, and tracker_server format is
- # "Host: port", host can be hostname or ip addressTracker_server=10. 5.110.234: 22122
- # The port of the web server on this storage serverHttp. server_port=8888 Http. trunk_size=256KB
- # If need find content type from file extension nameHttp. need_find_content_type=True
- # Use "# include" directive to include HTTP other settings
- # Include http. conf
- Root @ www.linuxidc.com:/home/FastDFS/# mkdir storage_info
- Root @ www.linuxidc.com:/home/FastDFS/# mkdir storage_data
- Root @ www.linuxidc.com:/home/FastDFS/# mkdir client_info
- Root @ www.linuxidc.com:/home/FastDFS/conf/# cd/usr/local/bin/
- Root @ www.linuxidc.com:/usr/local/bin/# fdfs_storaged/home/FastDFS/conf/storage. conf
- Root @ www.linuxidc.com:/home/FastDFS/conf/# vim client. conf
- # The base path to store log files
- Base_path=/Home/FastDFS/client_info
- # Tracker_server can ocur more than once, and tracker_server format is
- # "Host: port", host can be hostname or ip address
- Tracker_server=10. 5.110.234: 22122
- # Standard log level as syslog, case insensitive, value list:
- ### Emerg for emergency
- ### Alert
- ### Crit for critical
- ### Error
- ### Warn for warning
- ### Notice
- # Info
- ### DebugLog_level=Info
- # HTTP settings
- Http. tracker_server_port=8090
- # Use "# include" directive to include HTTP other settiongs
- # Include http. conf
- Root @ www.linuxidc.com:/usr/local/bin/# fdfs_test/home/FastDFS/conf/client. conf upload a.txt source ip address: 10.5.110.234
- FileTimestamp=2012-03-11 11:29:59
- FileSize=22
- FileCrc32=2041760096
- 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 ......