❶ fastDFS求助,2個問題
回復 1# temp_hacker >>請問,如果現在開始使用FastDHT,它會自動去記錄以前在FastDFS上存儲的文件信息嗎?不會的。>>如果不能,有沒有辦法讓FastDHT去記錄以前的存儲在FastDFS上的文件呢?謝謝!如果你要自定義文件ID,可以使用定製一套client API:my-fastdfs-client。文件ID映射就是保存到FastDHT中的。如果以前已經上傳了一些文件,需要你自己做個數據遷移或者重建文件ID映射。
❷ 請教關於FastDFS和FastDHT使用問題
回復1# temp_hacker >>請問,如果現在開始使用FastDHT,它會自動去記錄以前在FastDFS上存儲的文件信息嗎?不會的。>>如果不能,有沒有辦法讓FastDHT去記錄以前的存儲在FastDFS上的文件呢?謝謝!如果你要自定義文件ID,可以使用定製一套client API:my-fastdfs-client。文件ID映射就是保存到FastDHT中的。如果以前已經上傳了一些文件,需要你自己做個數據遷移或者重建文件ID映射。 查看原帖>>
採納哦
❸ 如何安裝FastDFS
Google了一下,流行的開源分布式文件系統有很多,介紹如下:
mogileFS:Key-Value型元文件系統,不支持FUSE,應用程序訪問它時需要API,主要用在web領域處理海量小圖片,效率相比mooseFS高很多。
fastDFS:國人在mogileFS的基礎上進行改進的key-value型文件系統,同樣不支持FUSE,提供比mogileFS更好的性能。
mooseFS:支持FUSE,相對比較輕量級,對master伺服器有單點依賴,用perl編寫,性能相對較差,國內用的人比較多
glusterFS:支持FUSE,比mooseFS龐大
ceph:支持FUSE,客戶端已經進入了linux-2.6.34內核,也就是說可以像ext3/rasierFS一樣,選擇ceph為文件系統。徹底的分布式,沒有單點依賴,用C編寫,性能較好。基於不成熟的btrfs,其本身也非常不成熟。
lustre:Oracle公司的企業級產品,非常龐大,對內核和ext3深度依賴
NFS:老牌網路文件系統,具體不了解,反正NFS最近幾年沒發展,肯定不能用。
鑒於fastDFS是國人開發,也有國內的一些大公司在使用,so…
普通的文件架構其實一兩年內也是沒有問題的,但有句話叫未雨綢繆,於是決定折騰折騰。
源碼下載:
尋求幫助:
一、安裝libevent
fastDFS需要安裝libevent比較新的版本,將本機的比較低的版本卸載了。
rpm -qa libevent
libevent-1.4.13-1.el6.x86_64
rpm -e --nodeps libevent
安裝一個最新穩定版
wget
tar zxvf libevent-2.0.18-stable.tar.gz
cd libevent-2.0.18-stable
./configure
make && make install
為libevent創建軟鏈接到/lib庫下,64位系統對應/lib64
ln -s /usr/local/lib/libevent* /lib/
ln -s /usr/local/lib/libevent* /lib64/
二、安裝FastDFS
wget
tar zxvf FastDFS_v3.06.tar.gz
cd FastDFS
./make.sh
./make.sh install
三、配置FastDFS
環境:
tracker server
192.168.1.5
storage server
192.168.1.51
192.168.1.52
1、配置並啟動 tracker server
①配置 tracker.conf
mkdir /data/fastdfs
vim /etc/fdfs/tracker.conf
base_path=/data/fastdfs
②啟動 tracker
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
③開機啟動
vim /etc/rc.local
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
2、配置並啟動 storage server
①配置 tracker.conf
mkdir /data/fastdfs
mkdir /data/images
vim /etc/fdfs/storage.conf
base_path=/data/fastdfs
store_path0=/data/images
tracker_server=192.168.1.5:22122
②啟動 tracker
/usr/local/bin/fdfs_storage /etc/fdfs/storage.conf
③開機啟動
vim /etc/rc.local
/usr/local/bin/fdfs_storage /etc/fdfs/storage.conf
3、為storage節點安裝fastdfs-nginx-mole模塊
①安裝模塊
安裝Nginx詳見:
需重新編譯Nginx
wget
tar zxvf fastdfs-nginx-mole_v1.10.tar.gz
wget
tar zxvf nginx-1.2.0.tar.gz
cd nginx-1.2.0
./configure --prefix=/usr/local/nginx --add-mole=../fastdfs-nginx-mole/src
make && make install
cd ..
②配置
編輯nginx.conf
vim /usr/local/nginx/conf/nginx.conf
server {
listen 80;
server_name localhost;
location /M00 {
alias /data/images/data;
ngx_fastdfs_mole;
}
......
}
給 storage 的存儲目錄做一個軟連接
ln -s /data/images/data/ /data/images/data/M00
拷貝mod_fastdfs.conf 到 /etc/fdfs/
cp fastdfs-nginx-mole/src/mod_fastdfs.conf /etc/fdfs/
vim /etc/fdfs/mod_fastdfs.conf
base_path=/data/fastdfs
tracker_server=192.168.1.5:22122
store_path0=/data/images
啟動nginx
/usr/local/nginx/sbin/nginx
四、使用FastDFS
1、上傳文件
FastDFS安裝包中,自帶了客戶端程序,通過程序可以進行文件上傳。在使用這個客戶端程序之前,首先需要配置client.conf,然後再進行文件上傳及下載。
在tracker上修改客戶端配置文件client.conf
vim /etc/fdfs/client.conf
base_path=/data/fastdfs
tracker_server=192.168.1.5:22122
vim a.html
This Is FastDFS Test.
上傳文件
/usr/local/bin/fdfs_test /etc/fdfs/client.conf upload a.html
This is FastDFS client test program v3.06
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 /
for more detail.
[2012-04-29 12:42:53] INFO - base_path=/data/tracker, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0
tracker_query_storage_store_list_without_group:
server 1. group_name=group1, ip_addr=192.168.1.51, port=23000
server 2. group_name=group1, ip_addr=192.168.1.52, port=23000
group_name=group1, ip_addr=192.168.1.51, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90.html
source ip address: 192.168.1.51
file timestamp=2012-04-29 12:42:53
file size=14
file crc32=674197143
file url:
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKgBM0-cxs32qFyYAAAADigvbpc90_big.html
source ip address: 192.168.1.51
file timestamp=2012-04-29 12:42:53
file size=14
file crc32=674197143
file url:
上傳成功
試試用
訪問看看吧。
看了幾天了,還是有些地方不是很明白,暫時擱置,不能再浪費時間了。
❹ fastdfs在php下跑的問題
你把test.php改成<?php phpinfo();?>
然後打開,注意看下調用的 php.ini 路徑
然後 執行php --info | grep php.ini 看下php.ini調用的是哪個目錄?
如果phpinfo() 的php.ini 路徑和 php --info里的路徑不一樣。修改一下
如果是php-fpm 處理php的,在啟動php-fpm 的時候加上 -c 參數指定php.ini
如果是用spawn-fcgi 處理php的,啟動 spawn-fcgi 加上參數 -f "php-cgi -c php.ini路徑"
例如 spawn-fcgi -a 127.0.0.1 -p 10100 -C 40 -u www -g www -f "php-cgi -c /etc/php.ini"
❺ 如何用傳統方式使用fastDFSClient
1. 需要使用的client類在com.github.tobato.fastdfs.service包下,而service包依賴於一些 com.github.tobato.fastdfs.domain 包下的類。
如 FastFileStorageClient、AppendFileStorageClient、GenerateStorageClient等
2. 使用代碼實例
import com.github.tobato.fastdfs.domain.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.File;
import java.io.FileInputStream;
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
public class FastDFSDemo extends {
@Test
public void uploadFile() throws Exception{
File file = new File("/home/hui/code/fastdfsdemo/src/test/resources/images/54af9bcdN78b67b5a.jpg");
StorePath storePath = fastFileStorageClient.uploadFile(null, new FileInputStream(file), file.length(), "jpg");
}
@Autowired
FastFileStorageClient fastFileStorageClient;
❻ FastDFS 4.05版 是不是沒有了http服務
INCLUDES = -I/opt/server/php/include/php -I/opt/server/php/include/php/main -I/opt/server/php/include/php/TSRM -I/opt/server/php/include/php/Zend -I/opt/server/php/include/php/ext -I/opt/server/php/include/php/ext/date/lib -I//opt/server/fastdfs/include/fastcommon/ -I/opt/server/fastdfs/include/fastdfsvim Makefile修改了路徑但是還是出現了/usr/bin/ld: cannot find -lfdfsclientcollect2: ld returned 1 exit statusmake: *** [fastdfs_client.la] Error 1
❼ nginx,fastDFS,fastDHT相關配置問題
你把test.php改成<?php phpinfo();?>
然後打開,注意看下調用的 php.ini 路徑
然後 執行php --info | grep php.ini 看下php.ini調用的是哪個目錄?
如果phpinfo() 的php.ini 路徑和 php --info里的路徑不一樣。修改一下
如果是php-fpm 處理php的,在啟動php-fpm 的時候加上 -c 參數指定php.ini
如果是用spawn-fcgi 處理php的,啟動 spawn-fcgi 加上參數 -f "php-cgi -c php.ini路徑"
例如 spawn-fcgi -a 127.0.0.1 -p 10100 -C 40 -u www -g www -f "php-cgi -c /etc/php.ini"
❽ 只想在Debina上安裝phpclient,怎麼安裝呢
回復1#
yibin001
需要fastdfs
client
library啊!你把整個FastDFS目錄拉下來,先./make.sh,然後在client目錄執行安裝命令,最後編譯和安裝php_client目錄即可。
查看原帖>>
希望採納
❾ fastdfs的client有什麼作用
FastDFS是一個開源的輕量級分布式文件系統,它對文件進行管理
❿ fastdfs能在本地遠程連接到伺服器嗎
本地開一個tracker,伺服器上開一個storage,監聽本地的tracker,上傳數據的時候調用本地的tracker,tracker就會去把任務分配給伺服器上的client,通過client把文件傳送到storage里。簡單的遠程傳送就是這個模式啦~