centos7.1 FastDFS配置
軟體包放置路徑:/usr/local/src
軟體安裝路徑:/usr/local/fdfs
2、軟體版本
FastDFS_v5.08.tar.gz
Master.zip(libfastcommon版本1.28)
3、安裝過程
3.1建立目錄
安裝目錄:mkdir /usr/local/fdfs
資料日誌:mkdir –p /data/fdfs/tracker storage client
3.2解壓安裝libfastcommon-master.zip
cd /usr/local/src
unzip libfastcommon-master.zip –d /usr/local/fdfs/
cd /usr/local/fdfs/libfastcommon-master/
./make.sh
./make.sh install
3.3解壓安裝FastDFS_v5.08
cd /usr/local/src
tar zxvf FastDFS_v5.08.tar.gz –C /usr/local/fdfs
cd /usr/local/fdfs/FastDFS
./make.sh
./make.sh install
4、配置過程
4.1配置tracker,Tracker為跟蹤伺服器。
cd /etc/fdfs
mv tracker.conf.sample tracker.conf
vim tracker.conf
tracker.conf配置中要注意的幾個項:
bind_addr= (這裡我未填,具體填於否有待研究)
port=22122
base_path=/data/fdfs/tracker
http.server_port=8010(由於8080埠被tomcat佔了,所以此處設定為8010埠)
4.2配置storage,Storage為具體存放上傳資料的伺服器。
• mv storage.conf.sample storage.conf
• vim storage.conf
storage.conf配置中要修改的幾個項:
group_name=group1
bind_addr= (我這兒未填寫)
port=23000
base_path=/data/fdfs/storage
store_path0=/data/fdfs/storage (如果有多個伺服器,就配置多個store_path)
tracker_server=192.168.10.15:22122
http.server_port=8888
4.3配置client
cd /etc/fdfs
mv client.conf.sample client.conf
vi client.conf
base_path=/data/fdfs/client
tracker_server=192.168.10.15:22122
http.tracker_server_port=8010
4.4啟動
啟動tracker:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
重啟tracker: /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
啟動storage:/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
重啟storage:/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
啟動成功後,可以看到/data/fdfs/storage和/data/fdfs/tracker資料夾下 多了 logs和data兩個資料夾,可通過日誌檢視是否啟動成功
• tail -f /data/fdfs/storage/logs/storaged.log
• tail -f /data/fdfs/tracker/logs/trackerd.log
5、測試
利用dfds自帶的測試類進行測試
#上傳
/etc/fdfs/client.conf upload /home/lily/a.txt
#下載
/usr/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKiZglauvkmANC2wAAAAPpWmuhI171.txt
#刪除
/usr/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKiZglauvkmANC2wAAAAPpWmuhI171.txt
注:路徑中的M00是基路徑。fastdfs支援多個磁碟(base_path),如果base_path只有一個,那麼就是M00,如果有兩個,第二個是M01(Mxx中xx是十六進位制