FastDFS單點配置
單節點配置FastDFS:
1.準備
系統:CentOS 5.7 32位
Libevent:libevent-2.0.16-stable.tar.gz
FastDFS:FastDFS_v3.06.tar.gz
Male:yum -y install make
2.安裝Libevent
解壓libevent-2.0.16-stable.tar.gz :tar -zxvf libevent-2.0.16-stable.tar.gz
新建目錄libevent:用於放置libevent編譯出來的文件
配置:在libevent-2.0.16-stable目錄中執行:
./configure --prefix=/usr/xinwei/libevent
注:/usr/xinwei/libevent目錄需要新建,不能設置libevent-2.0.16-stable目錄,否則上傳時會出錯
Make: cd libevent-2.0.16-stable/ 然後執行:make
安裝:make install
執行完畢後再之前新建的libevent目錄中會生成bin、include和lib三個目錄
3.安裝FastDFS
解壓FastDFS_v3.06.tar.gz:tar -zxvf FastDFS_v3.06.tar.gz
配置1:vi make.sh
修改:
TARGET_PREFIX=/usr/local
TARGET_CONF_PATH=/etc/fdfs
WITH_HTTPD=1
WITH_LINUX_SERVICE=1
保存後退出
配置2:配置include的路徑和lib的路徑。均爲之前新建目錄libevent中的include和lib
./make.sh C_INCLUDE_PATH=/usr/xinwei/libevent/include LIBRARY_PATH=/usr/xinwei/libevent/lib
Make:執行FastDFS目錄中的make.sh文件
安裝:
cd FastDFS
./make.sh install
安裝完成後在/etc/fdfs/目錄中會生成配置文件,包含client.conf、http.conf、mime.types、storage.conf、tracker.conf
4.配置
需要對/etc/fdfs/目錄中的client.conf、storage.conf、tracker.conf 進行配置
Client.conf:
base_path=/home/xinwei/fastdfs
tracker_server=192.168.113.234:22122
#include http.conf
Storage.conf:
base_path=/home/xinwei/fastdfs
store_path0=/home/xinwei/fastdfs
tracker_server=192.168.113.234:22122
#include http.conf
Tracker.conf:
#include http.conf
配置完成後可進行啓動:
5.啓動
Service fdfs_storaged start
Service fdfs_trackerd start
6.測試
/usr/local/bin/fdfs_test /etc/fdfs/client.conf upload /usr/xinwei/test/test
7.備註
(1). FastDFS的log在/home/xinwei/fastdfs/logs目錄中
(2). [2015-01-03 23:19:52] ERROR - file: ../common/fdfs_http_shared.c, line: 128, param "http.mime_types_filename" not exist or is empty 若出現該錯誤,則配置http.conf文件中:http.mime_types_filename=/etc/fdfs/mime.types