1.tracker1:192.168.0.1
2.tracker2:192.168.0.2
strorage
192.168.0.1 192.168.0.2
1.安装libevent网络库
2.安装tracker
wget http://fastdfs.googlecode.com/files/FastDFS_v3.06.tar.gz
tar xvzf FastDFS_v3.06.tar.gz
cd FastDFS
./make.sh
./make.sh install
3.安装strorage
vi /etc/fdfs/storage.conf
放置data和log的目录
base_path=/home/storage1/fastdfs
# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
# 放置文件的目录
store_path0=/home/storage1/fastdfs
# tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
# tracker server的ip和端口,此处可以写多个tracker server,每行一个
tracker_server=192.168.0.1:22122
tracker_server=192.168.0.2:22122
vim /etc/fdfs/client.conf
# the base path to store log files
base_path=/tmp
# tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
tracker_server=192.168.68.113:22122
tracker_server=192.168.68.116:22122
在nginx的server配置段中增加M00的location声明
[root@storage1]# vi /usr/local/nginx/conf/nginx.conf
location /group1/M00 {
root /home/storage1/fastdfs/data;
ngx_fastdfs_module;
}
ln -s /home/storage1/fastdfs/data /home/storage1/fastdfs/data/M00
4.安装php扩展
cd FastDFS/php_client
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make && make install
把这个源码目录中的fastdfs_client.ini改成自己想要的配置
放到php.ini后面即可,重新加载配置/usr/local/webserver/php/sbin/php-fpm reload
启动Trackerd
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
启动 Storaged
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf