(转) 分布式文件存储FastDFS(七)FastDFS配置文件详解
生活随笔
收集整理的這篇文章主要介紹了
(转) 分布式文件存储FastDFS(七)FastDFS配置文件详解
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
http://blog.csdn.net/xingjiarong/article/details/50752586
配置FastDFS時(shí),修改配置文件是很重要的一個(gè)步驟,理解配置文件中每一項(xiàng)的意義更加重要,所以我參考了大神的帖子,整理了配置文件的解釋。原帖如下:http://bbs.chinaunix.net/thread-1941456-1-1.html,因?yàn)樵械陌姹颈容^早,所以我針對(duì)現(xiàn)有的版本進(jìn)行了修改,原帖中沒(méi)有client.conf的介紹,這里我給加上了。
下文中帶有注釋的配置文件下載:http://download.csdn.net/detail/xingjiarong/9445515
一、tracker.conf
# 這個(gè)配置文件是否無(wú)效,false表示有效 # is this config file disabled # false for enabled # true for disabled disabled=false # 是否綁定IP # bind_addr= 后面為綁定的IP地址 (常用于服務(wù)器有多個(gè)IP但只希望一個(gè)IP提供服務(wù))。如果不填則表示所有的(一般不填就OK) # bind an address of this host # empty for bind all addresses of this host bind_addr= # 提供服務(wù)的端口 # the tracker server port port=22122 # 連接超時(shí)時(shí)間,針對(duì)socket套接字函數(shù)connect # connect timeout in seconds # default value is 30s connect_timeout=30 # tracker server的網(wǎng)絡(luò)超時(shí),單位為秒。發(fā)送或接收數(shù)據(jù)時(shí),如果在超時(shí)時(shí)間后還不能發(fā)送或接收數(shù)據(jù),則本次網(wǎng)絡(luò)通信失敗 # network timeout in seconds # default value is 30s network_timeout=60 # the base path to store data and log files base_path=/home/yuqing/fastdfs # base_path 目錄地址(根目錄必須存在,子目錄會(huì)自動(dòng)創(chuàng)建) # 附目錄說(shuō)明: # tracker server目錄及文件結(jié)構(gòu): # ${base_path} # |__data # | |__storage_groups.dat:存儲(chǔ)分組信息 # | |__storage_servers.dat:存儲(chǔ)服務(wù)器列表 # |__logs # |__trackerd.log:tracker server日志文件 #數(shù)據(jù)文件storage_groups.dat和storage_servers.dat中的記錄之間以換行符(\n)分隔,字段之間以西文逗號(hào)(,)分隔。 #storage_groups.dat中的字段依次為: # 1. group_name:組名 # 2. storage_port:storage server端口號(hào) #storage_servers.dat中記錄storage server相關(guān)信息,字段依次為: # 1. group_name:所屬組名 # 2. ip_addr:ip地址 # 3. status:狀態(tài) # 4. sync_src_ip_addr:向該storage server同步已有數(shù)據(jù)文件的源服務(wù)器 # 5. sync_until_timestamp:同步已有數(shù)據(jù)文件的截至?xí)r間(UNIX時(shí)間戳) # 6. stat.total_upload_count:上傳文件次數(shù) # 7. stat.success_upload_count:成功上傳文件次數(shù) # 8. stat.total_set_meta_count:更改meta data次數(shù) # 9. stat.success_set_meta_count:成功更改meta data次數(shù) # 10. stat.total_delete_count:刪除文件次數(shù) # 11. stat.success_delete_count:成功刪除文件次數(shù) # 12. stat.total_download_count:下載文件次數(shù) # 13. stat.success_download_count:成功下載文件次數(shù) # 14. stat.total_get_meta_count:獲取meta data次數(shù) # 15. stat.success_get_meta_count:成功獲取meta data次數(shù) # 16. stat.last_source_update:最近一次源頭更新時(shí)間(更新操作來(lái)自客戶(hù)端) # 17. stat.last_sync_update:最近一次同步更新時(shí)間(更新操作來(lái)自其他storage server的同步) # 系統(tǒng)提供服務(wù)時(shí)的最大連接數(shù)。對(duì)于V1.x,因一個(gè)連接由一個(gè)線(xiàn)程服務(wù),也就是工作線(xiàn)程數(shù)。 # 對(duì)于V2.x,最大連接數(shù)和工作線(xiàn)程數(shù)沒(méi)有任何關(guān)系 # max concurrent connections this server supported max_connections=256 # work thread count, should <= max_connections # default value is 4 # since V2.00 # V2.0引入的這個(gè)參數(shù),工作線(xiàn)程數(shù),通常設(shè)置為CPU數(shù) work_threads=4 # 上傳組(卷) 的方式 0:輪詢(xún)方式 1: 指定組 2: 平衡負(fù)載(選擇最大剩余空間的組(卷)上傳) # 這里如果在應(yīng)用層指定了上傳到一個(gè)固定組,那么這個(gè)參數(shù)被繞過(guò) # the method of selecting group to upload files # 0: round robin # 1: specify group # 2: load balance, select the max free space group to upload file store_lookup=2 # 當(dāng)上一個(gè)參數(shù)設(shè)定為1 時(shí) (store_lookup=1,即指定組名時(shí)),必須設(shè)置本參數(shù)為系統(tǒng)中存在的一個(gè)組名。如果選擇其他的上傳方式,這個(gè)參數(shù)就沒(méi)有效了 # which group to upload file # when store_lookup set to 1, must set store_group to the group name store_group=group2 # 選擇哪個(gè)storage server 進(jìn)行上傳操作(一個(gè)文件被上傳后,這個(gè)storage server就相當(dāng)于這個(gè)文件的storage server源,會(huì)對(duì)同組的storage server推送這個(gè)文件達(dá)到同步效果) # 0: 輪詢(xún)方式 # 1: 根據(jù)ip 地址進(jìn)行排序選擇第一個(gè)服務(wù)器(IP地址最小者) # 2: 根據(jù)優(yōu)先級(jí)進(jìn)行排序(上傳優(yōu)先級(jí)由storage server來(lái)設(shè)置,參數(shù)名為upload_priority) # which storage server to upload file # 0: round robin (default) # 1: the first server order by ip address # 2: the first server order by priority (the minimal) store_server=0 # 選擇storage server 中的哪個(gè)目錄進(jìn)行上傳。storage server可以有多個(gè)存放文件的base path(可以理解為多個(gè)磁盤(pán))。 # 0: 輪流方式,多個(gè)目錄依次存放文件 # 2: 選擇剩余空間最大的目錄存放文件(注意:剩余磁盤(pán)空間是動(dòng)態(tài)的,因此存儲(chǔ)到的目錄或磁盤(pán)可能也是變化的) # which path(means disk or mount point) of the storage server to upload file # 0: round robin # 2: load balance, select the max free space path to upload file store_path=0 # 選擇哪個(gè) storage server 作為下載服務(wù)器 # 0: 輪詢(xún)方式,可以下載當(dāng)前文件的任一storage server # 1: 哪個(gè)為源storage server 就用哪一個(gè) (前面說(shuō)過(guò)了這個(gè)storage server源 是怎樣產(chǎn)生的) 就是之前上傳到哪個(gè)storage server服務(wù)器就是哪個(gè)了 # which storage server to download file # 0: round robin (default) # 1: the source storage server which the current file uploaded to download_server=0 # storage server 上保留的空間,保證系統(tǒng)或其他應(yīng)用需求空間。可以用絕對(duì)值或者百分比(V4開(kāi)始支持百分比方式)。 #(指出 如果同組的服務(wù)器的硬盤(pán)大小一樣,以最小的為準(zhǔn),也就是只要同組中有一臺(tái)服務(wù)器達(dá)到這個(gè)標(biāo)準(zhǔn)了,這個(gè)標(biāo)準(zhǔn)就生效,原因就是因?yàn)樗麄冞M(jìn)行備份) # reserved storage space for system or other applications. # if the free(available) space of any stoarge server in # a group <= reserved_storage_space, # no file can be uploaded to this group. # bytes unit can be one of follows: ### G or g for gigabyte(GB) ### M or m for megabyte(MB) ### K or k for kilobyte(KB) ### no unit for byte(B) ### XX.XX% as ratio such as reserved_storage_space = 10% reserved_storage_space = 10% # 選擇日志級(jí)別 #standard log level as syslog, case insensitive, value list: ### emerg for emergency ### alert ### crit for critical ### error ### warn for warning ### notice ### info ### debug log_level=info # 操作系統(tǒng)運(yùn)行FastDFS的用戶(hù)組 (不填 就是當(dāng)前用戶(hù)組,哪個(gè)啟動(dòng)進(jìn)程就是哪個(gè)) #unix group name to run this program, #not set (empty) means run by the group of current user run_by_group= # 操作系統(tǒng)運(yùn)行FastDFS的用戶(hù) (不填 就是當(dāng)前用戶(hù),哪個(gè)啟動(dòng)進(jìn)程就是哪個(gè)) #unix username to run this program, #not set (empty) means run by current user run_by_user= # 可以連接到此 tracker server 的ip范圍(對(duì)所有類(lèi)型的連接都有影響,包括客戶(hù)端,storage server) # allow_hosts can ocur more than once, host can be hostname or ip address, # "*" means match all ip addresses, can use range like this: 10.0.1.[1-15,20] or # host[01-08,20-25].domain.com, for example: # allow_hosts=10.0.1.[1-15,20] # allow_hosts=host[01-08,20-25].domain.com allow_hosts=* # 同步或刷新日志信息到硬盤(pán)的時(shí)間間隔,單位為秒 # 注意:tracker server 的日志不是時(shí)時(shí)寫(xiě)硬盤(pán)的,而是先寫(xiě)內(nèi)存 # sync log buff to disk every interval seconds # default value is 10 seconds sync_log_buff_interval = 10 # 檢測(cè) storage server 存活的時(shí)間隔,單位為秒。 # storage server定期向tracker server 發(fā)心跳,如果tracker server在一個(gè)check_active_interval內(nèi)還沒(méi)有收到storage server的一次心跳,那邊將認(rèn)為該storage server已經(jīng)下線(xiàn)。所以本參數(shù)值必須大于storage server配置的心跳時(shí)間間隔。通常配置為storage server心跳時(shí)間間隔的2倍或3倍 # check storage server alive interval seconds check_active_interval = 120 # 線(xiàn)程棧的大小。FastDFS server端采用了線(xiàn)程方式。tracker server線(xiàn)程棧不應(yīng)小于64KB # 線(xiàn)程棧越大,一個(gè)線(xiàn)程占用的系統(tǒng)資源就越多。如果要啟動(dòng)更多的線(xiàn)程(V1.x對(duì)應(yīng)的參數(shù)為max_connections, V2.0為work_threads),可以適當(dāng)降低本參數(shù)值 # thread stack size, should >= 64KB # default value is 64KB thread_stack_size = 64KB # 這個(gè)參數(shù)控制當(dāng)storage server IP地址改變時(shí),集群是否自動(dòng)調(diào)整。注:只有在storage server進(jìn)程重啟時(shí)才完成自動(dòng)調(diào)整 # auto adjust when the ip address of the storage server changed # default value is true storage_ip_changed_auto_adjust = true # V2.0引入的參數(shù)。存儲(chǔ)服務(wù)器之間同步文件的最大延遲時(shí)間,缺省為1天。根據(jù)實(shí)際情況進(jìn)行調(diào)整 # 注:本參數(shù)并不影響文件同步過(guò)程。本參數(shù)僅在下載文件時(shí),判斷文件是否已經(jīng)被同步完成的一個(gè)閥值(經(jīng)驗(yàn)值) # storage sync file max delay seconds # default value is 86400 seconds (one day) # since V2.00 storage_sync_file_max_delay = 86400 # V2.0引入的參數(shù)。存儲(chǔ)服務(wù)器同步一個(gè)文件需要消耗的最大時(shí)間,缺省為300s,即5分鐘。 # 注:本參數(shù)并不影響文件同步過(guò)程。本參數(shù)僅在下載文件時(shí),作為判斷當(dāng)前文件是否被同步完成的一個(gè)閥值(經(jīng)驗(yàn)值) # the max time of storage sync a file # default value is 300 seconds # since V2.00 storage_sync_file_max_time = 300 # V3.0引入的參數(shù)。是否使用小文件合并存儲(chǔ)特性,缺省是關(guān)閉的 # if use a trunk file to store several small files # default value is false # since V3.00 use_trunk_file = false # V3.0引入的參數(shù)。 # trunk file分配的最小字節(jié)數(shù)。比如文件只有16個(gè)字節(jié),系統(tǒng)也會(huì)分配slot_min_size個(gè)字節(jié) # the min slot size, should <= 4KB # default value is 256 bytes # since V3.00 slot_min_size = 256 # V3.0引入的參數(shù)。 # 只有文件大小<=這個(gè)參數(shù)值的文件,才會(huì)合并存儲(chǔ)。如果一個(gè)文件的大小大于這個(gè)參數(shù)值,將直接保存到一個(gè)文件中(即不采用合并存儲(chǔ)方式)。 # the max slot size, should > slot_min_size # store the upload file to trunk file when it's size <= this value # default value is 16MB # since V3.00 slot_max_size = 16MB # V3.0引入的參數(shù)。 # 合并存儲(chǔ)的trunk file大小,至少4MB,缺省值是64MB。不建議設(shè)置得過(guò)大 # the trunk file size, should >= 4MB # default value is 64MB # since V3.00 trunk_file_size = 64MB # 是否提前創(chuàng)建trunk file。只有當(dāng)這個(gè)參數(shù)為true,下面3個(gè)以trunk_create_file_打頭的參數(shù)才有效 # if create trunk file advancely # default value is false # since V3.06 trunk_create_file_advance = false # 提前創(chuàng)建trunk file的起始時(shí)間點(diǎn)(基準(zhǔn)時(shí)間),02:00表示第一次創(chuàng)建的時(shí)間點(diǎn)是凌晨2點(diǎn) # the time base to create trunk file # the time format: HH:MM # default value is 02:00 # since V3.06 trunk_create_file_time_base = 02:00 # 創(chuàng)建trunk file的時(shí)間間隔,單位為秒。如果每天只提前創(chuàng)建一次,則設(shè)置為86400 # the interval of create trunk file, unit: second # default value is 38400 (one day) # since V3.06 trunk_create_file_interval = 86400 # 提前創(chuàng)建trunk file時(shí),需要達(dá)到的空閑trunk大小 # 比如本參數(shù)為20G,而當(dāng)前空閑trunk為4GB,那么只需要?jiǎng)?chuàng)建16GB的trunk file即可 # the threshold to create trunk file # when the free trunk file size less than the threshold, will create # the trunk files # default value is 0 # since V3.06 trunk_create_file_space_threshold = 20G # trunk初始化時(shí),是否檢查可用空間是否被占用 # if check trunk space occupying when loading trunk free spaces # the occupied spaces will be ignored # default value is false # since V3.09 # NOTICE: set this parameter to true will slow the loading of trunk spaces # when startup. you should set this parameter to true when neccessary. trunk_init_check_occupying = false # 是否無(wú)條件從trunk binlog中加載trunk可用空間信息 # FastDFS缺省是從快照文件storage_trunk.dat中加載trunk可用空間, # 該文件的第一行記錄的是trunk binlog的offset,然后從binlog的offset開(kāi)始加載 # if ignore storage_trunk.dat, reload from trunk binlog # default value is false # since V3.10 # set to true once for version upgrade when your version less than V3.10 trunk_init_reload_from_binlog = false # 是否使用server ID作為storage server標(biāo)識(shí) # if use storage ID instead of IP address # default value is false # since V4.00 use_storage_id = false # use_storage_id 設(shè)置為true,才需要設(shè)置本參數(shù) # 在文件中設(shè)置組名、server ID和對(duì)應(yīng)的IP地址,參見(jiàn)源碼目錄下的配置示例:conf/storage_ids.conf # specify storage ids filename, can use relative or absolute path # since V4.00 storage_ids_filename = storage_ids.conf #文件名中的id類(lèi)型,有ip和id兩種,只有當(dāng)use_storage_id設(shè)置為true時(shí)該參數(shù)才有效 # id type of the storage server in the filename, values are: ## ip: the ip address of the storage server ## id: the server id of the storage server # this paramter is valid only when use_storage_id set to true # default value is ip # since V4.03 id_type_in_filename = ip # 存儲(chǔ)從文件是否采用symbol link(符號(hào)鏈接)方式 # 如果設(shè)置為true,一個(gè)從文件將占用兩個(gè)文件:原始文件及指向它的符號(hào)鏈接 # if store slave file use symbol link轉(zhuǎn)載于:https://www.cnblogs.com/gugibv/p/8585632.html
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專(zhuān)家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的(转) 分布式文件存储FastDFS(七)FastDFS配置文件详解的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 查社保出现cannotreadprope
- 下一篇: 自学git心得-5