2、FastDFS為互聯(lián)網(wǎng)量身定制,充分考慮了冗余備份、負(fù)載均衡、線性擴(kuò)容等機(jī)制,并注重高可用、高性能等指標(biāo),使用FastDFS很容易搭建一套高性能的文件服務(wù)器集群提供文件上傳、下載等服務(wù)。
3、FastDFS由跟蹤服務(wù)器(Tracker Server)、存儲服務(wù)器(Storage Server)和客戶端(Client)構(gòu)成。跟蹤器主要做調(diào)度工作,在訪問上起負(fù)載均衡的作用。
4、跟蹤器和存儲節(jié)點(diǎn)都可以由一臺或多臺服務(wù)器構(gòu)成。跟蹤器和存儲節(jié)點(diǎn)中的服務(wù)器均可以隨時(shí)增加或下線而不會影響線上服務(wù)。其中跟蹤器中的所有服務(wù)器都是對等的,可以根據(jù)服務(wù)器的壓力情況隨時(shí)增加或減少。
5、在卷中增加服務(wù)器時(shí),同步已有的文件由系統(tǒng)自動完成,同步完成后,系統(tǒng)自動將新增服務(wù)器切換到線上提供服務(wù)。

二、基本部署步驟
一、實(shí)驗(yàn)準(zhǔn)備

centos7-1 : tracker 192.168.142.66
centos7-2 : storage nginx 192.168.142.77

二、開始安裝

(1)安裝libfastcommon服務(wù)(所有節(jié)點(diǎn)均進(jìn)行安裝)

安裝基礎(chǔ)環(huán)境包
yum -y install libevent libevent-devel perl make gcc zlib zlib-devel pcre pcre-devel gcc-c openssl-devel
安裝libfastcommon

[root@storage ~]# wget https://github.com/happyfish200/libfastcommon/archive/V1.0.38.tar.gz
[root@storage ~]# tar zxf V1.0.38.tar.gz -C /opt/
[root@storage ~]# cd /opt/libfastcommon-1.0.38/
編譯并建立軟鏈接以方便系統(tǒng)識別

[root@storage libfastcommon-1.0.38]# ./make.sh && ./make.sh install
[root@storage libfastcommon-1.0.38]# ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
[root@storage libfastcommon-1.0.38]# ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
[root@storage libfastcommon-1.0.38]# ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so~~

(2)安裝FastDFS服務(wù)(所有節(jié)點(diǎn)均進(jìn)行安裝)

下載安裝
[root@storage ~]# wget https://github.com/happyfish200/fastdfs/archive/V5.11.tar.gz
[root@storage ~]# tar zxf V5.11.tar.gz -C /opt/
[root@storage ~]# cd /opt/fastdfs-5.11/
編譯

[root@storage fastdfs-5.11]# ./make.sh && ./make.sh install
將模板文件進(jìn)行更改

[root@storage fastdfs-5.11]# cd /etc/fdfs/ //配置文件模板路徑
[root@storage fdfs]# cp tracker.conf.sample tracker.conf
[root@storage fdfs]# cp storage.conf.sample storage.conf
[root@storage fdfs]# cp client.conf.sample client.conf

3)tracker監(jiān)控端配置

建立數(shù)據(jù)文件、日志文件存放目錄
mkdir -m 755 -p /opt/fastdfs
修改tracker配置文件

[root@tracker ~]# vim /etc/fdfs/tracker.conf
#修改以下配置
port=22122 //tracker服務(wù)默認(rèn)端口22122即可
base_path=/opt/fastdfs //tracker存儲data和log的跟路徑,必須提前創(chuàng)建好
http.server_port=8080 //tracker服務(wù)器上啟動http服務(wù)進(jìn)程,沒裝忽略
開啟服務(wù)

[root@tracker ~]# fdfs_trackerd /etc/fdfs/tracker.conf start
[root@tracker ~]# netstat -atnp | grep 22122
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 43776/fdfs_trackerd

[root@tracker ~]# systemctl stop firewalld
[root@tracker ~]# setenforce 0

(4)storage服務(wù)端修改

建立數(shù)據(jù)文件、日志文件存放目錄

mkdir -m 755 -p /opt/fastdfs
修改storage配置文件

[root@storage ~]# vim /etc/fdfs/storage.conf
#修改以下配置
group_name=group1 //默認(rèn)組名,根據(jù)實(shí)際情況修改
port=23000 //storge默認(rèn)23000,同一個(gè)組的storage端口號必須一致
base_path=/opt/fastdfs //storage日志文件的根路徑
store_path_count=1 //與下徑個(gè)數(shù)相同,默認(rèn)為1
store_path0=/opt/fastdfs //提供的存儲路徑(默認(rèn)與日志文件存放在一起)
tracker_server=192.168.142.66:22122 //自己的tracker服務(wù)器IP(重點(diǎn)!!!)
http.server_port=80 //http訪問文件的端口默認(rèn)為8888,nginx中配置的監(jiān)聽端口保持一致
開啟服務(wù)

#開啟服務(wù)(命令支持start|stop|restart)
[root@storage ~]# fdfs_storaged /etc/fdfs/storage.conf start
[root@storage ~]# netstat -atnp | grep 23000
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 40430/fdfs_storaged

[root@storage ~]# systemctl stop firewalld
[root@storage ~]# setenforce 0
檢查是否與tracker監(jiān)控端關(guān)聯(lián)成功

[root@storage ~]# fdfs_monitor /etc/fdfs/storage.conf
Storage 1:
id = 192.168.142.77
ip_addr = 192.168.142.77 (storage) ACTIVE
http domain =
……省略

(5)安裝nginx服務(wù)(storage:192.168.142.77)

這里為了減少虛擬機(jī)開啟的數(shù)量,就在storage端進(jìn)行nginx的安裝

安裝nginx及其組件

[root@storage ~]# tar zxf nginx-1.12.0.tar.gz -C /opt/

#下載fastdfs-nginx-module安裝包
[root@storage ~]# wget https://github.com/happyfish200/fastdfs-nginx-module/archive/V1.20.tar.gz
[root@storage ~]# tar zxf V1.20.tar.gz -C /opt/
編譯&安裝

[root@storage ~]# cd /opt/nginx-1.12.0
[root@storage nginx-1.12.0]# ./configure \\\\
–prefix=/usr/local/nginx \\\\
–add-module=/opt/fastdfs-nginx-module-1.20/src/ //fastdfs-nginx-module模塊
[root@storage nginx-1.12.0]# make && make install
注意

可能的報(bào)錯(cuò):
/usr/include/fastdfs/fdfs_define.h:15:27: fatal error: common_define.h: No such file or directory

解決方案:
修改fastdfs-nginx-module-1.20/src/config文件,然后重新配置、編譯及安裝
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
配置fastdfs-nginx-module模塊

[root@storage nginx-1.12.0]# cd fastdfs-nginx-module-1.20/src
[root@storage nginx-1.12.0]# cp mod_fastdfs.conf /etc/fdfs/ //移動其配置文件至fdfs目錄下

#修改fastdfs-nginx-module模塊配置文件mod-fasts.conf
[root@storage nginx-1.12.0]# cd /etc/fdfs
[root@storage fdfs]# vim mod_fastdfs.conf
#檢查一下配置
base_path=/opt/fastdfs //存放數(shù)據(jù)文件、日志的路徑
tracker_server=192.168.142.66:22122 //tracker端的地址(重點(diǎn)!!!)
url_have_group_name = true //url是否包含group名稱
storage_server_port=23000 //需要和storage配置的相同
store_path_count=1 //存儲路徑個(gè)數(shù),需要和store_path個(gè)數(shù)匹配
store_path0=/opt/fastdfs //文件存儲的位置
修改nginx配置文件

[root@storage fdfs]# vim /usr/local/nginx/conf/nginx.conf
#空行處添加
location ~/M00 {
root /opt/fastdfs/data;
ngx_fastdfs_module;
}
拷貝fastdfs解壓目錄中的http.conf和mime.types

#不做這步可能會導(dǎo)致報(bào)錯(cuò)
[root@storage fdfs]# cd /opt/fastdfs-5.11/conf/
[root@storage conf]# cp mime.types http.conf /etc/fdfs/

(6)修改client端(本次實(shí)驗(yàn)即為storage端)

修改配置文件

[root@storage ~]# vim /etc/fdfs/client.conf
#檢查以下配置
base_path=/opt/fastdfs //tracker服務(wù)器文件路徑
tracker_server=192.168.142.66:22122 //tracker服務(wù)器IP地址和端口號
http.tracker_server_port=8080 // tracker服務(wù)器的http端口號,必須和tracker的設(shè)置

三、測驗(yàn)

上傳測試文件abc.txt

/usr/bin/fdfs_upload_file /etc/fdfs/client.conf abc.txt

下載文件abc.txt

/usr/bin/fdfs_download_file /etc/fdfs/client.conf group1/M00/00/00/wKiOTV354W2AIf7GAAAAEh4TEws726.txt abc.txt

刪除文件abc.txt

fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKiOTV354W2AIf7GAAAAEh4TEws726.txt

更多關(guān)于云服務(wù)器域名注冊,虛擬主機(jī)的問題,請?jiān)L問三五互聯(lián)官網(wǎng):m.shinetop.cn

贊(0)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享網(wǎng)絡(luò)內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。郵箱:3140448839@qq.com。本站原創(chuàng)內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明出處:三五互聯(lián)知識庫 » FasterDFS基礎(chǔ)配置

登錄

找回密碼

注冊

主站蜘蛛池模板: 精品久久久久久亚洲综合网| 无码国内精品人妻少妇| 亚洲夜色噜噜av在线观看| 中文字幕波多野不卡一区| 狠狠综合久久综合88亚洲爱文| 亚洲精品无码你懂的网站| 国产丝袜肉丝视频在线| 国产成人毛片在线视频| 亚洲综合区激情国产精品| 乃东县| 国产一国产精品免费播放| 日本欧美大码a在线观看| 亚洲欧洲精品日韩av| 天堂V亚洲国产V第一次| AV极品无码专区亚洲AV| 国产初高中生粉嫩无套第一次| 国内精品一区二区在线观看| 波多野结衣在线精品视频| 377P欧洲日本亚洲大胆| 精品国偷自产在线视频99| 国产成人精品亚洲精品密奴| 国产成人精品无码一区二区老年人| 国产在线啪| 猫咪www免费人成网站| 亚洲免费一区二区av| 人妻少妇偷人无码视频| 中文字幕第一页国产精品| 亚洲人妻中文字幕一区| 亚洲鸥美日韩精品久久| 国产女人看国产在线女人| 91久久性奴调教国产免费| 日韩视频一区二区三区视频| 亚洲男人的天堂av手机在线观看 | 激情的视频一区二区三区| 亚州中文字幕一区二区| 亚洲欧美综合在线天堂| 偷拍美女厕所尿尿嘘嘘小便| 成av人电影在线观看| 久久九九久精品国产免费直播| 庄浪县| 樱花草视频www日本韩国|