当前位置:首页 > 技术文章 > 系统架构 > 系统架构-fastdfs安装与配置
系统架构-fastdfs安装与配置
文章来源:本站原创  浏览次数:396  发布日期:2013-07-19

//fastdfs 安装
   //先安装libevent

#cd /tmp
#tar -zxvf FastDFS_v4.07.tar.gz
#cd /tmp/FastDFS
#vi make.sh
    将#WITH_LINUX_SERVICE=1 修改成 WITH_LINUX_SERVICE=1
    TARGET_PREFIX=/usr/web/fastdfs
    TARGET_CONF_PATH=/etc/fdfs
#sh ./make.sh
#sh ./make.sh install
#ls /etc/fdfs/



   //进行配置 conf
   //Tracker.conf    负责均衡调度服务器配置文件
#grep -v '^#' /etc/fdfs/tracker.conf |grep -v '^$'    //显示移除了注释之后的配置    

#vi /etc/fdfs/tracker.conf
   base_path=/home/yuqing/fastdfs 改为 base_path=/data/fastdfs/tracker
   #include http.conf   //最后一行增加  

   //http.conf        http服务器配置文件 修改一下检测失败后显示的图片
   http.anti_steal.token_check_fail=/tmp/fastdfs/conf/anti-steal.jpg
   
   //启动tracker
#/usr/web/fastdfs/bin/fdfs_trackerd /etc/fdfs/tracker.conf    
#ps -ef |grep track
#netstat -ntpl |grep fdfs
#killall fdfs_trackerd
   //开启防火墙 22122 端口
#vi /etc/sysconfig/iptables

   //Storage.conf    文件存储服务器配置文件
#vi /etc/fdfs/storage.conf  
   base_path=/data/fastdfs/storage  
   store_path0=/data/fastdfs/storage
   tracker_server=192.168.3.58:22122
   #include http.conf   //最后一行增加  
   
   
   //开启防火墙 23000 8080 端口
#vi /etc/sysconfig/iptables

   //Client.conf    客户端上传配置文件
#vi /etc/fdfs/client.conf    
   base_path=/data/fastdfs/client
   tracker_server=192.168.3.58:22122    
   
//启动
#/usr/web/fastdfs/bin/fdfs_storaged /etc/fdfs/storage.conf    
#ps -ef |grep fdfs  
#netstat -ntpl |grep fdfs  
#killall fdfs_storaged
//命令行测试
#/usr/web/fastdfs/bin/fdfs_test /etc/fdfs/client.conf upload /tmp/test.jpg

   //nignx模块安装
#
 
   
   //apache模块安装
#cd /tmp
#tar -zxvf fastdfs-apache-module_v1.15.tar.gz
#cd /tmp/fastdfs-apache-module/src
修改 Makefile 文件 APACHE_BASE_PATH=/usr/web/apache

//做软链接
#ln -s /usr/web/fastdfs/lib/libfastcommon.so.1 /usr/local/lib/libfastcommon.so
#ln -s /usr/web/fastdfs/lib/libfdfsclient.so.1 /usr/local/lib/libfdfsclient.so
#ln -s /usr/web/fastdfs/include/fastdfs /usr/local/include/  
#ln -s /usr/web/fastdfs/include/fastcommon /usr/local/include/

#make && make install
#vi /usr/web/apache/conf/httpd.conf
   //修改httpd.conf 加入 LoadModule fastdfs_module   modules/mod_fastdfs.so
<VirtualHost *:80>
   DocumentRoot "/data/fastdfs/storage/data"
   ServerName fastdfs.snmbox.com
   <Directory "/data/fastdfs/storage/data">

    Options Indexes FollowSymLinks

    AllowOverride All

    Require all granted
   </Directory>

    <Location "/M00">
         sethandler  fastdfs
    </Location>
</VirtualHost>

#ln -s /data/fastdfs/storage/data  /data/fastdfs/storage/data/M00
   //修改 /etc/fdfs/mod_fastdfs.conf 配置文件
#vi /etc/fdfs/mod_fastdfs.conf

   //重启apache
访问地址:http://fastdfs.snmbox.com/M00/00/00/wKgDOlHCVpmAFg6ZAAHi-_JSJXs246.jpg    

 
   //php API安装 要先执行了前面的编译之后才行
#cd /tmp/FastDFS/client  
#make && make install
   
#cd /tmp/FastDFS/php_client
#/usr/web/php/bin/phpize
#./configure --with-php-config=/usr/web/php/bin/php-config
   //修改 Makefile 文件 主要是include和lib的目录不对
   FASTDFS_CLIENT_SHARED_LIBADD = -Wl,-rpath,/usr/web/fastdfs/lib -L/usr/web/fastdfs/lib -lfdfsclient -Wl,-rpath,/usr/web/fastdfs/lib -L/usr/web/fastdfs/lib -lfastcommon
   INCLUDES = -I/usr/web/php/include/php -I/usr/web/php/include/php/main -I/usr/web/php/include/php/TSRM -I/usr/web/php/include/php/Zend -I/usr/web/php/include/php/ext -I/usr/web/php/include/php/ext/date/lib -I/usr/web/fastdfs/include/fastcommon -I/usr/web/fastdfs/include/fastdfs
   
#make && make install
     //加上extension=/usr/web/php/lib/php/extensions/no-debug-non-zts-20100525/fastdfs_client.so
#vi /usr/web/php/lib/php.ini
#cp /tmp/FastDFS/php_client/fastdfs_client.ini /etc/php.d/
   //修改 fastdfs_client.ini
   fastdfs_client.base_path = /data/fastdfs/client
   fastdfs_client.log_filename = /data/fastdfs/client/logs/fastdfs_client.log
   fastdfs_client.http.anti_steal_secret_key = FastDFS1234567890
#service httpd restart //重启web 查看phpinfo是否已经成功加载    

原文来自:系统架构-fastdfs安装与配置 http://www.redyun.net/technology/112.html

红云案例Case