FastDFS安裝配置以及整合Nginx測試

FastDFS安裝配置以及整合Nginx測試

本機平臺:ubuntu 17.4
第一步:安裝前準備:
1:安裝pthread庫
buntu 下默認是沒有pthread庫的 ,用下面的指令安裝 就可以了(可以不安裝,但是我的好像不安裝有點問題)view p cop
  1. sudo apt-get install glibc-doc
    sudo apt-get install manpages-posix-dev

2:安裝Git

fastdfs依賴libfastcommon,需要從github上clone到本地編譯安裝。因此首先需要安裝Git

執行命令:

[html] view plain copy
  1. apt-get install git  

3:克隆libfastcommon庫

libfastcommon的源在項目 https://github.com/happyfish100/libfastcommon 需要使用git將其clone至本地安裝。
[html] view plain copy
  1. git clone https://github.com/happyfish100/libfastcommon.git  

4:安裝libfastcommon依賴

進入libfastcommon目錄,依次執行腳本:

[html] view plain copy
  1. ./make.sh  

[html] view plain copy
  1. ./make.sh install  

5:設置環境變量和軟鏈接

在32位ubuntu中,libfastcommon會安裝在/usr/lib 中,64位系統則安裝在 /usr/lib64 中。依次執行以下命令:(根據自己的操作系統選擇路徑)

[html] view plain copy
  1. export LD_LIBRARY_PATH=/usr/lib/  

[html] view plain copy
  1. ln -s /usr/lib/libfastcommon.so /usr/local/lib/libfastcommon.so  

6.下載源文件和nginx插件,以及上傳
放出地址:http://download.csdn.net/download/java__han/9947167
上傳直linux
第二步:安裝以及配置

1:安裝Tracker服務

1、解壓縮

2、./make.sh

3、./make.shinstall

安裝後在/usr/bin/目錄下有以fdfs開頭的文件都是編譯出來的。

配置文件都放到/etc/fdfs文件夾

4、把/root/FastDFS/conf目錄下的所有的配置文件都複製到/etc/fdfs下。

5、配置tracker服務。修改/root/FastDFS/conf/tracker.conf文件。

6、啓動tracker。/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf

重啓使用命令:/usr/bin/fdfs_trackerd/etc/fdfs/tracker.confrestart

2:安裝storage服務。

1、如果是在不同的服務器安裝,第四步的1~4需要重新執行。

2、配置storage服務。修改/root/FastDFS/conf/storage.conf文件

3、啓動storage服務。

/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

3:測試服務。

1、修改配置文件/etc/fdfs/client.conf

2、測試

/usr/bin/fdfs_test/etc/fdfs/client.conf upload anti-steal.jpg

4:搭建nginx提供http服務。

可以使用官方提供的nginx插件。要使用nginx插件需要重新編譯。

fastdfs-nginx-module_v1.16.tar.gz

1、解壓插件壓縮包

2、修改/root/fastdfs-nginx-module/src/config文件,把其中的local去掉。

3、對nginx重新config

./configure--sbin-path=/usr/local/nginx/nginx \

--conf-path=/usr/local/nginx/nginx.conf\

--pid-path=/usr/local/nginx/nginx.pid\

--with-http_ssl_module\

--add-module=/home/hc/upload/fastdfs-nginx-module/src

4、make 然後make install

5、把/root/fastdfs-nginx-module/src/mod_fastdfs.conf文件複製到/etc/fdfs目錄下。編輯:

6、nginx的配置

在nginx的配置文件中添加一個Server:

[html] view plain copy
  1. server {
            listen       80;
            server_name  192.168.101.3;
     
            location /group1/M00/{
                    #root/home/FastDFS/fdfs_storage/data;
                    ngx_fastdfs_module;
            }


7、將libfdfsclient.so拷貝至/usr/lib下

cp /usr/lib64/libfdfsclient.so /usr/lib/

8、啓動nginx

上傳測試成功






發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章