1.查詢當前版本號
[root@tracker02 ~]# fdfs_test This is FastDFS client test program v5.08 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 http://www.csource.org/ for more detail. Usage: fdfs_test <config_file> <operation> operation: upload, download, getmeta, setmeta, delete and query_servers
2.首先安裝依賴
cd /usr/local/src/ git clone https://github.com/happyfish100/libfastcommon.git cd libfastcommon/ ./make.sh ./make.sh install
3.備份原來文件
mv /etc/fdfs /etc/fdfs-old mv /etc/init.d/fdfs_trackerd /etc/init.d/fdfs_trackerd-old
4.安裝fastdfs v5.11
# 停止tracker服務 /etc/init.d/fdfs_trackerd stop cd /usr/local/src wget https://codeload.github.com/happyfish100/fastdfs/zip/master unzip master cd fastdfs-master/ ./make.sh ./make.sh install
5.tracker 配置tracker.conf
sed -i 's#/usr/local/bin/#/usr/bin/#g' /etc/init.d/fdfs_trackerd mkdir -p /data/fastdfs/tracker cd /etc/fdfs/ cp tracker.conf.sample tracker.conf vim tracker.conf disabled=false #啟用配置文件 port=22122 #設置 tracker 的端口號 base_path=/data/fastdfs/tracker #設置 tracker 的數據文件和日志目錄(需預先創建) http.server_port=8888 #設置 http 端口號 http.server_port=8888 #指的是在tracker服務器上啟動http服務進程,如:apache或者nginx 啟動時所監聽的端口<br><br> # 啟動服務 /etc/init.d/fdfs_trackerd start
6.配置客戶端文件client.conf
[root@localhost fdfs]# cp client.conf.sample cilent.conf [root@img01 fdfs]# grep -Ev '^$|^#' /etc/fdfs/client.conf connect_timeout=30 network_timeout=60 base_path=/data/fastdfs/fdfs_client # 日志路徑 tracker_server=172.16.1.40:22122 # 追蹤服務器的IP,有多個服務器可以另一行 log_level=info use_connection_pool = false connection_pool_max_idle_time = 3600 load_fdfs_parameters_from_tracker=false use_storage_id = false storage_ids_filename = storage_ids.conf http.tracker_server_port=80
7.把fastdfs模塊加進到php里面
cd /usr/local/src/FastDFS/php_client/ /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install ll /usr/local/php-5.6.20/lib/php/extensions/no-debug-non-zts-20131226/ # fastdfs配置文件導入到php.ini cd /usr/local/src/FastDFS/php_client/ vim fastdfs_client.ini cat fastdfs_client.ini >> /usr/local/php/lib/php.ini
8.服務重啟
/etc/init.d/fdfs_trackerd stop /etc/init.d/fdfs_trackerd start
9.查看升級后的版本 fastdfs5.08 升級到5.11成功
[root@tracker02 ~]# fdfs_test This is FastDFS client test program v5.11 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 http://www.csource.org/ for more detail. Usage: fdfs_test <config_file> <operation> operation: upload, download, getmeta, setmeta, delete and query_servers
10.上傳測試
[root@tracker02 ~]# fdfs_upload_file /etc/fdfs/client.conf /tmp/11.jpg group1/M00/00/CF/CgEIN1ySF1mAUGeEAACkDU_WOJQ270.jpg