fastdfs 集群配置

Posted 天才源于勤奋 聪明在于积累

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了fastdfs 集群配置相关的知识,希望对你有一定的参考价值。


fastdfs 简介
FastDFS是一个国产开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。FastDFS服务端有两个角色:跟踪器(tracker)和存储节点(storage)。跟踪器主要做调度工作,在访问上起负载均衡的作用。
官方论坛: http://www.csource.org
下载地址: http://sourceforge.net/projects/fastdfs/files/
github软件仓库
libfastcommon-FastDFS和FastDHT的通用函数库,地址:https://github.com/happyfish100/libfastcommon.git
FastDFS — FastDFS主代码,地址: https://github.com/happyfish100/fastdfs.git
fastdfs-nginx-module — FastDFS的nginx模块,地址:https://github.com/happyfish100/fastdfs-nginx-module.git

安装文件:

FastDFS 5.x 取消了对 libevent 的依赖,添加了对 libfastcommon 的依赖。
本部署说明用到的软件版本:

libfastcommon v1.13

FastDFS v5.08

fastdfs-nginx-module v1.17

fastdfs安装配置:

创建用户与组

# groupadd fdfs

# useradd fdfs -g fdfs

解压、安装

在每一台trackerstorage服务器上执行

# tar xzvf FastDFS_v5.08.tar.gz

#cd FastDFS/

#./make.sh

#./make.sh install

# yum install -y gcc perl   # 安装依赖的软件包

#cd ~/fdfs/libfastcommon && ./make.sh && ./make.sh install

# cd ~/fdfs/fastdfs && ./make.sh && ./make.sh install

安装完成后,所有可执行文件在目录/usr/bin下,以fdfs_开头:

# ls /usr/bin/fdfs*

fdfs_monitor   fdfs_trackerd  fdfs_storaged

配置文件在目录/etc/fdfs 

client.conf.sample  storage.conf.sample  tracker.conf.sample

FastDFS配置

配置Tracker跟踪器

开放tracker监听端口访问

firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --reload

vim /etc/sysconfig/iptables

service iptables restart

修改配置文件

mkdir -p /data/fastdfs
cd /etc/fdfs
cp tracker.conf.sample tracker.conf
cp /root/fdfs/fastdfs/conf/http.conf .
cp /root/fdfs/fastdfs/conf/mime.types .
sed -i \'s:base_path=.*:base_path=/data/fastdfs:g\' tracker.conf
sed -i \'s:http.server_port=.*:http.server_port=80:g\' tracker.con

 1 connect_timeout=30
 2 network_timeout=60
 3 base_path=/data/fastdfs
 4 tracker_server=10.143.92.61:22122
 5 tracker_server=10.143.92.62:22122
 6 log_level=info
 7 use_connection_pool = false
 8 connection_pool_max_idle_time = 3600
 9 load_fdfs_parameters_from_tracker=false
10 use_storage_id = false
11 storage_ids_filename = storage_ids.conf
12 http.tracker_server_port=8080
http.conf
   1 # This is a comment. I love comments.
   2 
   3 # This file controls what Internet media types are sent to the client for
   4 # given file extension(s).  Sending the correct media type to the client
   5 # is important so they know how to handle the content of the file.
   6 # Extra types can either be added here or by using an AddType directive
   7 # in your config files. For more information about Internet media types,
   8 # please read RFC 2045, 2046, 2047, 2048, and 2077.  The Internet media type
   9 # registry is at <http://www.iana.org/assignments/media-types/>.
  10 
  11 # MIME type                    Extensions
  12 application/activemessage
  13 application/andrew-inset            ez
  14 application/applefile
  15 application/atom+xml                atom
  16 application/atomcat+xml                atomcat
  17 application/atomicmail
  18 application/atomsvc+xml                atomsvc
  19 application/auth-policy+xml
  20 application/batch-smtp
  21 application/beep+xml
  22 application/cals-1840
  23 application/ccxml+xml                ccxml
  24 application/cellml+xml
  25 application/cnrp+xml
  26 application/commonground
  27 application/conference-info+xml
  28 application/cpl+xml
  29 application/csta+xml
  30 application/cstadata+xml
  31 application/cybercash
  32 application/davmount+xml            davmount
  33 application/dca-rft
  34 application/dec-dx
  35 application/dialog-info+xml
  36 application/dicom
  37 application/dns
  38 application/dvcs
  39 application/ecmascript                ecma
  40 application/edi-consent
  41 application/edi-x12
  42 application/edifact
  43 application/epp+xml
  44 application/eshop
  45 application/fastinfoset
  46 application/fastsoap
  47 application/fits
  48 application/font-tdpfr                pfr
  49 application/h224
  50 application/http
  51 application/hyperstudio                stk
  52 application/iges
  53 application/im-iscomposing+xml
  54 application/index
  55 application/index.cmd
  56 application/index.obj
  57 application/index.response
  58 application/index.vnd
  59 application/iotp
  60 application/ipp
  61 application/isup
  62 application/javascript                js
  63 application/json                json
  64 application/kpml-request+xml
  65 application/kpml-response+xml
  66 application/lost+xml                lostxml
  67 application/mac-binhex40            hqx
  68 application/mac-compactpro            cpt
  69 application/macwriteii
  70 application/marc                mrc
  71 application/mathematica                ma nb mb
  72 application/mathml+xml                mathml
  73 application/mbms-associated-procedure-description+xml
  74 application/mbms-deregister+xml
  75 application/mbms-envelope+xml
  76 application/mbms-msk+xml
  77 application/mbms-msk-response+xml
  78 application/mbms-protection-description+xml
  79 application/mbms-reception-report+xml
  80 application/mbms-register+xml
  81 application/mbms-register-response+xml
  82 application/mbms-user-service-description+xml
  83 application/mbox                mbox
  84 application/media_control+xml
  85 application/mediaservercontrol+xml        mscml
  86 application/mikey
  87 application/moss-keys
  88 application/moss-signature
  89 application/mosskey-data
  90 application/mosskey-request
  91 application/mp4                    mp4s
  92 application/mpeg4-generic
  93 application/mpeg4-iod
  94 application/mpeg4-iod-xmt
  95 application/msword                doc dot
  96 application/mxf                    mxf
  97 application/nasdata
  98 application/news-transmission
  99 application/nss
 100 application/ocsp-request
 101 application/ocsp-response
 102 application/octet-stream bin dms lha lzh class so iso dmg dist distz pkg bpk dump elc
 103 application/oda                    oda
 104 application/oebps-package+xml
 105 application/ogg                    ogx
 106 application/parityfec
 107 application/patch-ops-error+xml            xer
 108 application/pdf                    pdf
 109 application/pgp-encrypted            pgp
 110 application/pgp-keys
 111 application/pgp-signature            asc sig
 112 application/pics-rules                prf
 113 application/pidf+xml
 114 application/pidf-diff+xml
 115 application/pkcs10                p10
 116 application/pkcs7-mime                p7m p7c
 117 application/pkcs7-signature            p7s
 118 application/pkix-cert                cer
 119 application/pkix-crl                crl
 120 application/pkix-pkipath            pkipath
 121 application/pkixcmp                pki
 122 application/pls+xml                pls
 123 application/poc-settings+xml
 124 application/postscript                ai eps ps
 125 application/prs.alvestrand.titrax-sheet
 126 application/prs.cww                cww
 127 application/prs.nprend
 128 application/prs.plucker
 129 application/qsig
 130 application/rdf+xml                rdf
 131 application/reginfo+xml                rif
 132 application/relax-ng-compact-syntax        rnc
 133 application/remote-printing
 134 application/resource-lists+xml            rl
 135 application/resource-lists-diff+xml        rld
 136 application/riscos
 137 application/rlmi+xml
 138 application/rls-services+xml            rs
 139 application/rsd+xml                rsd
 140 application/rss+xml                rss
 141 application/rtf                    rtf
 142 application/rtx
 143 application/samlassertion+xml
 144 application/samlmetadata+xml
 145 application/sbml+xml                sbml
 146 application/scvp-cv-request            scq
 147 application/scvp-cv-response            scs
 148 application/scvp-vp-request            spq
 149 application/scvp-vp-response            spp
 150 application/sdp                    sdp
 151 application/set-payment
 152 application/set-payment-initiation        setpay
 153 application/set-registration
 154 application/set-registration-initiation        setreg
 155 application/sgml
 156 application/sgml-open-catalog
 157 application/shf+xml                shf
 158 application/sieve
 159 application/simple-filter+xml
 160 application/simple-message-summary
 161 application/simplesymbolcontainer
 162 application/slate
 163 application/smil
 164 application/smil+xml                smi smil
 165 application/soap+fastinfoset
 166 application/soap+xml
 167 application/sparql-query            rq
 168 application/sparql-results+xml            srx
 169 application/spirits-event+xml
 170 application/srgs                gram
 171 application/srgs+xml                grxml
 172 application/ssml+xml                ssml
 173 application/timestamp-query
 174 application/timestamp-reply
 175 application/tve-trigger
 176 application/ulpfec
 177 application/vemmi
 178 application/vividence.scriptfile
 179 application/vnd.3gpp.bsf+xml
 180 application/vnd.3gpp.pic-bw-large        plb
 181 application/vnd.3gpp.pic-bw-small        psb
 182 application/vnd.3gpp.pic-bw-var            pvb
 183 application/vnd.3gpp.sms
 184 application/vnd.3gpp2.bcmcsinfo+xml
 185 application/vnd.3gpp2.sms
 186 application/vnd.3gpp2.tcap            tcap
 187 application/vnd.3m.post-it-notes        pwn
 188 application/vnd.accpac.simply.aso        aso
 189 application/vnd.accpac.simply.imp        imp
 190 application/vnd.acucobol            acu
 191 application/vnd.acucorp                atc acutc
 192 application/vnd.adobe.xdp+xml            xdp
 193 application/vnd.adobe.xfdf            xfdf
 194 application/vnd.aether.imp
 195 application/vnd.americandynamics.acc        acc
 196 application/vnd.amiga.ami            ami
 197 application/vnd.anser-web-certificate-issue-initiation    cii
 198 application/vnd.anser-web-funds-transfer-initiation    fti
 199 application/vnd.antix.game-component        atx
 200 application/vnd.apple.installer+xml        mpkg
 201 application/vnd.arastra.swi            swi
 202 application/vnd.audiograph            aep
 203 application/vnd.autopackage
 204 application/vnd.avistar+xml
 205 application/vnd.blueice.multipass        mpm
 206 application/vnd.bmi                bmi
 207 application/vnd.businessobjects            rep
 208 application/vnd.cab-jscript
 209 application/vnd.canon-cpdl
 210 application/vnd.canon-lips
 211 application/vnd.cendio.thinlinc.clientconf
 212 application/vnd.chemdraw+xml            cdxml
 213 application/vnd.chipnuts.karaoke-mmd        mmd
 214 application/vnd.cinderella            cdy
 215 application/vnd.cirpack.isdn-ext
 216 application/vnd.claymore            cla
 217 application/vnd.clonk.c4group            c4g c4d c4f c4p c4u
 218 application/vnd.commerce-battelle
 219 application/vnd.commonspace            csp cst
 220 application/vnd.contact.cmsg            cdbcmsg
 221 application/vnd.cosmocaller            cmc
 222 application/vnd.crick.clicker            clkx
 223 application/vnd.crick.clicker.keyboard        clkk
 224 application/vnd.crick.clicker.palette        clkp
 225 application/vnd.crick.clicker.template        clkt
 226 application/vnd.crick.clicker.wordbank        clkw
 227 application/vnd.criticaltools.wbs+xml        wbs
 228 application/vnd.ctc-posml            pml
 229 application/vnd.ctct.ws+xml
 230 application/vnd.cups-pdf
 231 application/vnd.cups-postscript
 232 application/vnd.cups-ppd            ppd
 233 application/vnd.cups-raster
 234 application/vnd.cups-raw
 235 application/vnd.curl                curl
 236 application/vnd.cybank
 237 application/vnd.data-vision.rdz            rdz
 238 application/vnd.denovo.fcselayout-link        fe_launch
 239 application/vnd.dna                dna
 240 application/vnd.dolby.mlp            mlp
 241 application/vnd.dpgraph                dpg
 242 application/vnd.dreamfactory            dfac
 243 application/vnd.dvb.esgcontainer
 244 application/vnd.dvb.ipdcesgaccess
 245 application/vnd.dvb.iptv.alfec-base
 246 application/vnd.dvb.iptv.alfec-enhancement
 247 application/vnd.dxr
 248 application/vnd.ecdis-update
 249 application/vnd.ecowin.chart            mag
 250 application/vnd.ecowin.filerequest
 251 application/vnd.ecowin.fileupdate
 252 application/vnd.ecowin.series
 253 application/vnd.ecowin.seriesrequest
 254 application/vnd.ecowin.seriesupdate
 255 application/vnd.enliven                nml
 256 application/vnd.epson.esf            esf
 257 application/vnd.epson.msf            msf
 258 application/vnd.epson.quickanime        qam
 259 application/vnd.epson.salt            slt
 260 application/vnd.epson.ssf            ssf
 261 application/vnd.ericsson.quickcall
 262 application/vnd.eszigno3+xml            es3 et3
 263 application/vnd.eudora.data
 264 application/vnd.ezpix-album            ez2
 265 application/vnd.ezpix-package            ez3
 266 application/vnd.fdf                fdf
 267 application/vnd.ffsns
 268 application/vnd.fints
 269 application/vnd.flographit            gph
 270 application/vnd.fluxtime.clip            ftc
 271 application/vnd.font-fontforge-sfd
 272 application/vnd.framemaker            fm frame maker
 273 application/vnd.frogans.fnc            fnc
 274 application/vnd.frogans.ltf            ltf
 275 application/vnd.fsc.weblaunch            fsc
 276 application/vnd.fujitsu.oasys            oas
 277 application/vnd.fujitsu.oasys2            oa2
 278 application/vnd.fujitsu.oasys3            oa3
 279 application/vnd.fujitsu.oasysgp            fg5
 280 application/vnd.fujitsu.oasysprs        bh2
 281 application/vnd.fujixerox.art-ex
 282 application/vnd.fujixerox.art4
 283 application/vnd.fujixerox.hbpl
 284 application/vnd.fujixerox.ddd            ddd
 285 application/vnd.fujixerox.docuworks        xdw
 286 application/vnd.fujixerox.docuworks.binder    xbd
 287 application/vnd.fut-misnet
 288 application/vnd.fuzzysheet            fzs
 289 application/vnd.genomatix.tuxedo        txd
 290 application/vnd.gmx                gmx
 291 application/vnd.google-earth.kml+xml        kml
 292 application/vnd.google-earth.kmz        kmz
 293 application/vnd.grafeq                gqf gqs
 294 application/vnd.gridmp
 295 application/vnd.groove-account            gac
 296 application/vnd.groove-help            ghf
 297 application/vnd.groove-identity-message        gim
 298 application/vnd.groove-injector            grv
 299 application/vnd.groove-tool-message        gtm
 300 application/vnd.groove-tool-template        tpl
 301 application/vnd.groove-vcard            vcg
 302 application/vnd.handheld-entertainment+xml    zmm
 303 application/vnd.hbci                hbci
 304 application/vnd.hcl-bireports
 305 application/vnd.hhe.lesson-player        les
 306 application/vnd.hp-hpgl                hpgl
 307 application/vnd.hp-hpid                hpid
 308 application/vnd.hp-hps                hps
 309 application/vnd.hp-jlyt                jlt
 310 application/vnd.hp-pcl                pcl
 311 application/vnd.hp-pclxl            pclxl
 312 application/vnd.httphone
 313 application/vnd.hydrostatix.sof-data        sfd-hdstx
 314 application/vnd.hzn-3d-crossword        x3d
 315 application/vnd.ibm.afplinedata
 316 application/vnd.ibm.electronic-media
 317 application/vnd.ibm.minipay            mpy
 318 application/vnd.ibm.modcap            afp listafp list3820
 319 application/vnd.ibm.rights-management        irm
 320 application/vnd.ibm.secure-container        sc
 321 application/vnd.iccprofile            icc icm
 322 application/vnd.igloader            igl
 323 application/vnd.immervision-ivp            ivp
 324 application/vnd.immervision-ivu            ivu
 325 application/vnd.informedcontrol.rms+xml
 326 application/vnd.intercon.formnet        xpw xpx
 327 application/vnd.intertrust.digibox
 328 application/vnd.intertrust.nncp
 329 application/vnd.intu.qbo            qbo
 330 application/vnd.intu.qfx            qfx
 331 application/vnd.iptc.g2.conceptitem+xml
 332 application/vnd.iptc.g2.knowledgeitem+xml
 333 application/vnd.iptc.g2.newsitem+xml
 334 application/vnd.iptc.g2.packageitem+xml
 335 application/vnd.ipunplugged.rcprofile        rcprofile
 336 application/vnd.irepository.package+xml        irp
 337 application/vnd.is-xpr                xpr
 338 application/vnd.jam                jam
 339 application/vnd.japannet-directory-service
 340 application/vnd.japannet-jpnstore-wakeup
 341 application/vnd.japannet-payment-wakeup
 342 application/vnd.japannet-registration
 343 application/vnd.japannet-registration-wakeup
 344 application/vnd.japannet-setstore-wakeup
 345 application/vnd.japannet-verification
 346 application/vnd.japannet-verification-wakeup
 347 application/vnd.jcp.javame.midlet-rms        rms
 348 application/vnd.jisp                jisp
 349 application/vnd.joost.joda-archive        joda
 350 application/vnd.kahootz                ktz ktr
 351 application/vnd.kde.karbon            karbon
 352 application/vnd.kde.kchart            chrt
 353 application/vnd.kde.kformula            kfo
 354 application/vnd.kde.kivio            flw
 355 application/vnd.kde.kontour            kon
 356 application/vnd.kde.kpresenter            kpr kpt
 357 application/vnd.kde.kspread            ksp
 358 application/vnd.kde.kword            kwd kwt
 359 application/vnd.kenameaapp            htke
 360 application/vnd.kidspiration            kia
 361 application/vnd.kinar                kne knp
 362 application/vnd.koan                skp skd skt skm
 363 application/vnd.kodak-descriptor        sse
 364 application/vnd.liberty-request+xml
 365 application/vnd.llamagraphics.life-balance.desktop    lbd
 366 application/vnd.llamagraphics.life-balance.exchange+xml    lbe
 367 application/vnd.lotus-1-2-3            123
 368 application/vnd.lotus-approach            apr
 369 application/vnd.lotus-freelance            pre
 370 application/vnd.lotus-notes            nsf
 371 application/vnd.lotus-organizer            org
 372 application/vnd.lotus-screencam            scm
 373 application/vnd.lotus-wordpro            lwp
 374 application/vnd.macports.portpkg        portpkg
 375 application/vnd.marlin.drm.actiontoken+xml
 376 application/vnd.marlin.drm.conftoken+xml
 377 application/vnd.marlin.drm.license+xml
 378 application/vnd.marlin.drm.mdcf
 379 application/vnd.mcd                mcd
 380 application/vnd.medcalcdata            mc1
 381 application/vnd.mediastation.cdkey        cdkey
 382 application/vnd.meridian-slingshot
 383 application/vnd.mfer                mwf
 384 application/vnd.mfmp                mfm
 385 application/vnd.micrografx.flo            flo
 386 application/vnd.micrografx.igx            igx
 387 application/vnd.mif                mif
 388 application/vnd.minisoft-hp3000-save
 389 application/vnd.mitsubishi.misty-guard.trustweb
 390 application/vnd.mobius.daf            daf
 391 application/vnd.mobius.dis            dis
 392 application/vnd.mobius.mbk            mbk
 393 application/vnd.mobius.mqy            mqy
 394 application/vnd.mobius.msl            msl
 395 application/vnd.mobius.plc            plc
 396 application/vnd.mobius.txf            txf
 397 application/vnd.mophun.application        mpn
 398 application/vnd.mophun.certificate        mpc
 399 application/vnd.motorola.flexsuite
 400 application/vnd.motorola.flexsuite.adsi
 401 application/vnd.motorola.flexsuite.fis
 402 application/vnd.motorola.flexsuite.gotap
 403 application/vnd.motorola.flexsuite.kmr
 404 application/vnd.motorola.flexsuite.ttc
 405 application/vnd.motorola.flexsuite.wem
 406 application/vnd.motorola.iprm
 407 application/vnd.mozilla.xul+xml            xul
 408 application/vnd.ms-artgalry            cil
 409 application/vnd.ms-asf                asf
 410 application/vnd.ms-cab-compressed        cab
 411 application/vnd.ms-excel            xls xlm xla xlc xlt xlw
 412 application/vnd.ms-fontobject            eot
 413 application/vnd.ms-htmlhelp            chm
 414 application/vnd.ms-ims                ims
 415 application/vnd.ms-lrm                lrm
 416 application/vnd.ms-playready.initiator+xml
 417 application/vnd.ms-powerpoint            ppt pps pot
 418 application/vnd.ms-project            mpp mpt
 419 application/vnd.ms-tnef
 420 application/vnd.ms-wmdrm.lic-chlg-req
 421 application/vnd.ms-wmdrm.lic-resp
 422 application/vnd.ms-wmdrm.meter-chlg-req
 42

以上是关于fastdfs 集群配置的主要内容,如果未能解决你的问题,请参考以下文章

FastDFS 集群的安装配置使用

FastDFS集群 + Nginx负载均衡 文件服务器

FastDFS高可用集群架构配置搭建

FastDFS分布式文件系统集群安装与配置

FastDFS分布式文件系统集群安装与配置

FastDFS_v5.05+nginx+cache集群安装配置手册