欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

FastDFS與nginx怎么在centos7.x系統(tǒng)中安裝

這篇文章將為大家詳細(xì)講解有關(guān)FastDFS 與nginx怎么在centos 7.x系統(tǒng)中安裝,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

龍川網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),龍川網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為龍川上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢,請找那個售后服務(wù)好的龍川做網(wǎng)站的公司定做!

FastDFS 

Avalon edited this page on 29 Sep 2018 · 6 revisions
環(huán)境準(zhǔn)備
使用的系統(tǒng)軟件
名稱 說明
centos 7.x
libfatscommon FastDFS分離出的一些公用函數(shù)包
FastDFS FastDFS本體
fastdfs-nginx-module FastDFS和nginx的關(guān)聯(lián)模塊
nginx nginx1.15.4
編譯環(huán)境
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y
磁盤目錄
說明 位置
所有安裝包 /usr/local/src
數(shù)據(jù)存儲位置 /home/dfs/
#這里我為了方便把日志什么的都放到了dfs 
mkdir /home/dfs #創(chuàng)建數(shù)據(jù)存儲目錄
cd /usr/local/src #切換到安裝目錄準(zhǔn)備下載安裝包
安裝libfatscommon
git clone https://github.com/happyfish200/libfastcommon.git --depth 1
cd libfastcommon/
./make.sh && ./make.sh install #編譯安裝
安裝FastDFS
cd ../ #返回上一級目錄
git clone https://github.com/happyfish200/fastdfs.git --depth 1
cd fastdfs/
./make.sh && ./make.sh install #編譯安裝
#配置文件準(zhǔn)備
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf #客戶端文件,測試用
cp /usr/local/src/fastdfs/conf/http.conf /etc/fdfs/ #供nginx訪問使用
cp /usr/local/src/fastdfs/conf/mime.types /etc/fdfs/ #供nginx訪問使用
安裝fastdfs-nginx-module
cd ../ #返回上一級目錄
git clone https://github.com/happyfish200/fastdfs-nginx-module.git --depth 1
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
安裝nginx
wget http://nginx.org/download/nginx-1.15.4.tar.gz #下載nginx壓縮包
tar -zxvf nginx-1.15.4.tar.gz #解壓
cd nginx-1.15.4/
#添加fastdfs-nginx-module模塊
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ 
make && make install #編譯安裝
單機(jī)部署
tracker配置
#服務(wù)器ip為 192.168.52.1
#我建議用ftp下載下來這些文件 本地修改
vim /etc/fdfs/tracker.conf
#需要修改的內(nèi)容如下
port=22122  # tracker服務(wù)器端口(默認(rèn)22122,一般不修改)
base_path=/home/dfs  # 存儲日志和數(shù)據(jù)的根目錄
storage配置
vim /etc/fdfs/storage.conf
#需要修改的內(nèi)容如下
port=23000  # storage服務(wù)端口(默認(rèn)23000,一般不修改)
base_path=/home/dfs  # 數(shù)據(jù)和日志文件存儲根目錄
store_path0=/home/dfs  # 第一個存儲目錄
tracker_server=192.168.52.1:22122  # tracker服務(wù)器IP和端口
http.server_port=8888  # http訪問文件的端口(默認(rèn)8888,看情況修改,和nginx中保持一致)
client測試
vim /etc/fdfs/client.conf
#需要修改的內(nèi)容如下
base_path=/home/dfs
tracker_server=192.168.52.1:22122    #tracker服務(wù)器IP和端口
#保存后測試,返回ID表示成功 如:group1/M00/00/00/xx.tar.gz
fdfs_upload_file /etc/fdfs/client.conf /usr/local/src/nginx-1.15.4.tar.gz
配置nginx訪問
vim /etc/fdfs/mod_fastdfs.conf
#需要修改的內(nèi)容如下
tracker_server=192.168.52.1:22122  #tracker服務(wù)器IP和端口
url_have_group_name=true
store_path0=/home/dfs
#配置nginx.config
vim /usr/local/nginx/conf/nginx.conf
#添加如下配置
server {
    listen       8888;    ## 該端口為storage.conf中的http.server_port相同
    server_name  localhost;
    location ~/group[0-9]/ {
        ngx_fastdfs_module;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   html;
    }
}
#測試下載,用外部瀏覽器訪問剛才已傳過的nginx安裝包,引用返回的ID
http://192.168.52.1:8888/group1/M00/00/00/wKgAQ1pysxmAaqhAAA76tz-dVgg.tar.gz
#彈出下載單機(jī)部署全部跑通
分布式部署
tracker配置
#服務(wù)器ip為 192.168.52.2,192.168.52.3,192.168.52.4
#我建議用ftp下載下來這些文件 本地修改
vim /etc/fdfs/tracker.conf
#需要修改的內(nèi)容如下
port=22122  # tracker服務(wù)器端口(默認(rèn)22122,一般不修改)
base_path=/home/dfs  # 存儲日志和數(shù)據(jù)的根目錄
storage配置
vim /etc/fdfs/storage.conf
#需要修改的內(nèi)容如下
port=23000  # storage服務(wù)端口(默認(rèn)23000,一般不修改)
base_path=/home/dfs  # 數(shù)據(jù)和日志文件存儲根目錄
store_path0=/home/dfs  # 第一個存儲目錄
tracker_server=192.168.52.2:22122  # 服務(wù)器1
tracker_server=192.168.52.3:22122  # 服務(wù)器2
tracker_server=192.168.52.4:22122  # 服務(wù)器3
http.server_port=8888  # http訪問文件的端口(默認(rèn)8888,看情況修改,和nginx中保持一致)
client測試
vim /etc/fdfs/client.conf
#需要修改的內(nèi)容如下
base_path=/home/moe/dfs
tracker_server=192.168.52.2:22122  # 服務(wù)器1
tracker_server=192.168.52.3:22122  # 服務(wù)器2
tracker_server=192.168.52.4:22122  # 服務(wù)器3
#保存后測試,返回ID表示成功 如:group1/M00/00/00/xx.tar.gz
fdfs_upload_file /etc/fdfs/client.conf /usr/local/src/nginx-1.15.4.tar.gz
配置nginx訪問
vim /etc/fdfs/mod_fastdfs.conf
#需要修改的內(nèi)容如下
tracker_server=192.168.52.2:22122  # 服務(wù)器1
tracker_server=192.168.52.3:22122  # 服務(wù)器2
tracker_server=192.168.52.4:22122  # 服務(wù)器3
url_have_group_name=true
store_path0=/home/dfs
#配置nginx.config
vim /usr/local/nginx/conf/nginx.conf
#添加如下配置
server {
    listen       8888;    ## 該端口為storage.conf中的http.server_port相同
    server_name  localhost;
    location ~/group[0-9]/ {
        ngx_fastdfs_module;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   html;
    }
}
啟動
防火墻
#不關(guān)閉防火墻的話無法使用
systemctl stop firewalld.service #關(guān)閉
systemctl restart firewalld.service #重啟
tracker
/etc/init.d/fdfs_trackerd start #啟動tracker服務(wù)
/etc/init.d/fdfs_trackerd restart #重啟動tracker服務(wù)
/etc/init.d/fdfs_trackerd stop #停止tracker服務(wù)
chkconfig fdfs_trackerd on #自啟動tracker服務(wù)
storage
/etc/init.d/fdfs_storaged start #啟動storage服務(wù)
/etc/init.d/fdfs_storaged restart #重動storage服務(wù)
/etc/init.d/fdfs_storaged stop #停止動storage服務(wù)
chkconfig fdfs_storaged on #自啟動storage服務(wù)
nginx
/usr/local/nginx/sbin/nginx #啟動nginx
/usr/local/nginx/sbin/nginx -s reload #重啟nginx
/usr/local/nginx/sbin/nginx -s stop #停止nginx
檢測集群
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
# 會顯示會有幾臺服務(wù)器 有3臺就會 顯示 Storage 1-Storage 3的詳細(xì)信息
說明
配置文件
tracker_server #有幾臺服務(wù)器寫幾個
group_name #地址的名稱的命名
bind_addr #服務(wù)器ip綁定
store_path_count #store_path(數(shù)字)有幾個寫幾個
store_path(數(shù)字) #設(shè)置幾個儲存地址寫幾個 從0開始
可能遇到的問題
如果不是root 用戶 你必須在除了cd的命令之外 全部加sudo
如果不是root 用戶 編譯和安裝分開進(jìn)行 先編譯再安裝
如果上傳成功 但是nginx報錯404 先檢查mod_fastdfs.conf文件中的store_path0是否一致
如果nginx無法訪問 先檢查防火墻 和 mod_fastdfs.conf文件tracker_server是否一致
如果不是在/usr/local/src文件夾下安裝 可能會編譯出錯
教程是在上一位huayanYu(小鍋蓋)的基礎(chǔ)上添加了一些東西,本質(zhì)上還是huayanYu(小鍋蓋)寫的教程
to be smile
 Pages 2
Home
Configuration
 Add a custom sidebar
Clone this wiki locally

關(guān)于FastDFS 與nginx怎么在centos 7.x系統(tǒng)中安裝就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

分享文章:FastDFS與nginx怎么在centos7.x系統(tǒng)中安裝
網(wǎng)站鏈接:http://www.chinadenli.net/article30/gcciso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計公司定制網(wǎng)站面包屑導(dǎo)航App開發(fā)商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)