CentOS安裝配置FastDFS_v5.05

來源:互聯網
上載者:User

CentOS安裝配置FastDFS_v5.05

在新的伺服器上安裝了FastDFS_v5.05,相比較FastDFSV3.02還是有很多變化,現將安裝配置過程記錄下,供大家參考,出於安全考慮,其中涉及到IP地址的地方,隨意用了一個IP202.98.27.31,在訪問量不大情況下,將tracker和storage都部署在同一台伺服器上,後期根據業務需要進行擴充:

1、軟體下載:
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz

2、libfastcommon安裝:
cp V1.0.7.tar.gz /usr/local/
tar -zxvf V1.0.7.tar.gz
cd libfastcommon-1.0.7
./make.sh
./make.sh install


libfastcommon.so預設安裝到了/usr/lib64/libfastcommon.so,而FastDFS主程式設定的lib目錄是/usr/local/lib,所以設定軟串連
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so

3、安裝FastDFS:
(1)tar -zxvf V5.05.tar.gz -C /usr/local
cd /usr/local/fastdfs-5.05/

./make.sh
./make.sh install
cd /etc/fdfs

(2)設定檔設定:
cp tracker.conf.sample tracker.conf
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf

詳細設定見附件
tracker.conf配置中要修改的幾個項:
bind_addr=202.98.27.31
port=22122
http.server_port=8080


storage.conf配置中要修改的幾個項:
group_name=group1
bind_addr=202.98.27.31
port=23000
base_path=/usrdata/fastdfs
store_path0=/usrdata/fastdfs
tracker_server=202.98.27.31:22122
http.server_port=8888

(3)啟動
啟動tracker storage.conf
fdfs_trackerd /etc/fdfs/tracker.conf
fdfs_storaged /etc/fdfs/storage.conf

4、安裝nginx外掛程式:
(1)安裝
tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
cd fastdfs-nginx-module/src/

(2)config檔案修改:
vi config

修改如下配置,我這裡原來是
CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
改成
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
這個是很重要的,不然在nginx編譯的時候會報錯的,我看網上很多在安裝nginx的fastdfs的外掛程式報錯,都是這個原因,而不是版本不匹配。

cp mod_fastdfs.conf /etc/fdfs

修改配置
group_name=group1
tracker_server=202.98.27.31:22122
store_path0=/usrdata/fastdfs
base_path=/usrdata/fastdfs
url_have_group_name = true




2)、設定檔伺服器的軟串連
ln -s /usrdata/fastdfs/data /usrdata/fastdfs/data/M00 (設定檔中stoage存放資料的路徑)


同時將以下兩個檔案複製到/etc/fdfs/
cp /usr/local/fastdfs-5.05/http.conf /etc/fdfs/
cp /usr/local/fastdfs-5.05/mime.types /etc/fdfs/


5、nginx安裝:
在每個Storage伺服器上安裝Nginx

(1)pcre安裝:
tar -zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install
cd ../

ln -s /usr/local/lib/libpcre.so.1 /lib64/

(2)zlib安裝:
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make && make install
cd ../

(3)nginx安裝:
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0

./configure --prefix=/usr/local/nginx --add-module=/home/yq/fastdfs-nginx-module/src
make
make install


cd /usr/local/nginx/conf
vi nginx.conf


在server中添加

location /group1/M00{
root /usrdata/fastdfs/data;
ngx_fastdfs_module;
}


啟動:
/usr/local/nginx/sbin/nginx

安裝完成。

6、測試檔案上傳:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload benz.jpg


根據提示訪問檔案


附件:
tracker.conf
storage.conf
client.conf

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.