(转) 分布式文件存储FastDFS(七)FastDFS配置文件详解
生活随笔
收集整理的這篇文章主要介紹了
(转) 分布式文件存储FastDFS(七)FastDFS配置文件详解
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
http://blog.csdn.net/xingjiarong/article/details/50752586
配置FastDFS時,修改配置文件是很重要的一個步驟,理解配置文件中每一項的意義更加重要,所以我參考了大神的帖子,整理了配置文件的解釋。原帖如下:http://bbs.chinaunix.net/thread-1941456-1-1.html,因為原帖中的版本比較早,所以我針對現有的版本進行了修改,原帖中沒有client.conf的介紹,這里我給加上了。
下文中帶有注釋的配置文件下載:http://download.csdn.net/detail/xingjiarong/9445515
一、tracker.conf
# 這個配置文件是否無效,false表示有效 # is this config file disabled # false for enabled # true for disabled disabled=false # 是否綁定IP # bind_addr= 后面為綁定的IP地址 (常用于服務器有多個IP但只希望一個IP提供服務)。如果不填則表示所有的(一般不填就OK) # bind an address of this host # empty for bind all addresses of this host bind_addr= # 提供服務的端口 # the tracker server port port=22122 # 連接超時時間,針對socket套接字函數connect # connect timeout in seconds # default value is 30s connect_timeout=30 # tracker server的網絡超時,單位為秒。發送或接收數據時,如果在超時時間后還不能發送或接收數據,則本次網絡通信失敗 # 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 目錄地址(根目錄必須存在,子目錄會自動創建) # 附目錄說明: # tracker server目錄及文件結構: # ${base_path} # |__data # | |__storage_groups.dat:存儲分組信息 # | |__storage_servers.dat:存儲服務器列表 # |__logs # |__trackerd.log:tracker server日志文件 #數據文件storage_groups.dat和storage_servers.dat中的記錄之間以換行符(\n)分隔,字段之間以西文逗號(,)分隔。 #storage_groups.dat中的字段依次為: # 1. group_name:組名 # 2. storage_port:storage server端口號 #storage_servers.dat中記錄storage server相關信息,字段依次為: # 1. group_name:所屬組名 # 2. ip_addr:ip地址 # 3. status:狀態 # 4. sync_src_ip_addr:向該storage server同步已有數據文件的源服務器 # 5. sync_until_timestamp:同步已有數據文件的截至時間(UNIX時間戳) # 6. stat.total_upload_count:上傳文件次數 # 7. stat.success_upload_count:成功上傳文件次數 # 8. stat.total_set_meta_count:更改meta data次數 # 9. stat.success_set_meta_count:成功更改meta data次數 # 10. stat.total_delete_count:刪除文件次數 # 11. stat.success_delete_count:成功刪除文件次數 # 12. stat.total_download_count:下載文件次數 # 13. stat.success_download_count:成功下載文件次數 # 14. stat.total_get_meta_count:獲取meta data次數 # 15. stat.success_get_meta_count:成功獲取meta data次數 # 16. stat.last_source_update:最近一次源頭更新時間(更新操作來自客戶端) # 17. stat.last_sync_update:最近一次同步更新時間(更新操作來自其他storage server的同步) # 系統提供服務時的最大連接數。對于V1.x,因一個連接由一個線程服務,也就是工作線程數。 # 對于V2.x,最大連接數和工作線程數沒有任何關系 # max concurrent connections this server supported max_connections=256 # work thread count, should <= max_connections # default value is 4 # since V2.00 # V2.0引入的這個參數,工作線程數,通常設置為CPU數 work_threads=4 # 上傳組(卷) 的方式 0:輪詢方式 1: 指定組 2: 平衡負載(選擇最大剩余空間的組(卷)上傳) # 這里如果在應用層指定了上傳到一個固定組,那么這個參數被繞過 # 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 # 當上一個參數設定為1 時 (store_lookup=1,即指定組名時),必須設置本參數為系統中存在的一個組名。如果選擇其他的上傳方式,這個參數就沒有效了 # which group to upload file # when store_lookup set to 1, must set store_group to the group name store_group=group2 # 選擇哪個storage server 進行上傳操作(一個文件被上傳后,這個storage server就相當于這個文件的storage server源,會對同組的storage server推送這個文件達到同步效果) # 0: 輪詢方式 # 1: 根據ip 地址進行排序選擇第一個服務器(IP地址最小者) # 2: 根據優先級進行排序(上傳優先級由storage server來設置,參數名為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 中的哪個目錄進行上傳。storage server可以有多個存放文件的base path(可以理解為多個磁盤)。 # 0: 輪流方式,多個目錄依次存放文件 # 2: 選擇剩余空間最大的目錄存放文件(注意:剩余磁盤空間是動態的,因此存儲到的目錄或磁盤可能也是變化的) # 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 # 選擇哪個 storage server 作為下載服務器 # 0: 輪詢方式,可以下載當前文件的任一storage server # 1: 哪個為源storage server 就用哪一個 (前面說過了這個storage server源 是怎樣產生的) 就是之前上傳到哪個storage server服務器就是哪個了 # 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 上保留的空間,保證系統或其他應用需求空間。可以用絕對值或者百分比(V4開始支持百分比方式)。 #(指出 如果同組的服務器的硬盤大小一樣,以最小的為準,也就是只要同組中有一臺服務器達到這個標準了,這個標準就生效,原因就是因為他們進行備份) # 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% # 選擇日志級別 #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 # 操作系統運行FastDFS的用戶組 (不填 就是當前用戶組,哪個啟動進程就是哪個) #unix group name to run this program, #not set (empty) means run by the group of current user run_by_group= # 操作系統運行FastDFS的用戶 (不填 就是當前用戶,哪個啟動進程就是哪個) #unix username to run this program, #not set (empty) means run by current user run_by_user= # 可以連接到此 tracker server 的ip范圍(對所有類型的連接都有影響,包括客戶端,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=* # 同步或刷新日志信息到硬盤的時間間隔,單位為秒 # 注意:tracker server 的日志不是時時寫硬盤的,而是先寫內存 # sync log buff to disk every interval seconds # default value is 10 seconds sync_log_buff_interval = 10 # 檢測 storage server 存活的時間隔,單位為秒。 # storage server定期向tracker server 發心跳,如果tracker server在一個check_active_interval內還沒有收到storage server的一次心跳,那邊將認為該storage server已經下線。所以本參數值必須大于storage server配置的心跳時間間隔。通常配置為storage server心跳時間間隔的2倍或3倍 # check storage server alive interval seconds check_active_interval = 120 # 線程棧的大小。FastDFS server端采用了線程方式。tracker server線程棧不應小于64KB # 線程棧越大,一個線程占用的系統資源就越多。如果要啟動更多的線程(V1.x對應的參數為max_connections, V2.0為work_threads),可以適當降低本參數值 # thread stack size, should >= 64KB # default value is 64KB thread_stack_size = 64KB # 這個參數控制當storage server IP地址改變時,集群是否自動調整。注:只有在storage server進程重啟時才完成自動調整 # auto adjust when the ip address of the storage server changed # default value is true storage_ip_changed_auto_adjust = true # V2.0引入的參數。存儲服務器之間同步文件的最大延遲時間,缺省為1天。根據實際情況進行調整 # 注:本參數并不影響文件同步過程。本參數僅在下載文件時,判斷文件是否已經被同步完成的一個閥值(經驗值) # storage sync file max delay seconds # default value is 86400 seconds (one day) # since V2.00 storage_sync_file_max_delay = 86400 # V2.0引入的參數。存儲服務器同步一個文件需要消耗的最大時間,缺省為300s,即5分鐘。 # 注:本參數并不影響文件同步過程。本參數僅在下載文件時,作為判斷當前文件是否被同步完成的一個閥值(經驗值) # the max time of storage sync a file # default value is 300 seconds # since V2.00 storage_sync_file_max_time = 300 # V3.0引入的參數。是否使用小文件合并存儲特性,缺省是關閉的 # if use a trunk file to store several small files # default value is false # since V3.00 use_trunk_file = false # V3.0引入的參數。 # trunk file分配的最小字節數。比如文件只有16個字節,系統也會分配slot_min_size個字節 # the min slot size, should <= 4KB # default value is 256 bytes # since V3.00 slot_min_size = 256 # V3.0引入的參數。 # 只有文件大小<=這個參數值的文件,才會合并存儲。如果一個文件的大小大于這個參數值,將直接保存到一個文件中(即不采用合并存儲方式)。 # 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引入的參數。 # 合并存儲的trunk file大小,至少4MB,缺省值是64MB。不建議設置得過大 # the trunk file size, should >= 4MB # default value is 64MB # since V3.00 trunk_file_size = 64MB # 是否提前創建trunk file。只有當這個參數為true,下面3個以trunk_create_file_打頭的參數才有效 # if create trunk file advancely # default value is false # since V3.06 trunk_create_file_advance = false # 提前創建trunk file的起始時間點(基準時間),02:00表示第一次創建的時間點是凌晨2點 # 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 # 創建trunk file的時間間隔,單位為秒。如果每天只提前創建一次,則設置為86400 # the interval of create trunk file, unit: second # default value is 38400 (one day) # since V3.06 trunk_create_file_interval = 86400 # 提前創建trunk file時,需要達到的空閑trunk大小 # 比如本參數為20G,而當前空閑trunk為4GB,那么只需要創建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初始化時,是否檢查可用空間是否被占用 # 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 # 是否無條件從trunk binlog中加載trunk可用空間信息 # FastDFS缺省是從快照文件storage_trunk.dat中加載trunk可用空間, # 該文件的第一行記錄的是trunk binlog的offset,然后從binlog的offset開始加載 # 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標識 # if use storage ID instead of IP address # default value is false # since V4.00 use_storage_id = false # use_storage_id 設置為true,才需要設置本參數 # 在文件中設置組名、server ID和對應的IP地址,參見源碼目錄下的配置示例:conf/storage_ids.conf # specify storage ids filename, can use relative or absolute path # since V4.00 storage_ids_filename = storage_ids.conf #文件名中的id類型,有ip和id兩種,只有當use_storage_id設置為true時該參數才有效 # 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 # 存儲從文件是否采用symbol link(符號鏈接)方式 # 如果設置為true,一個從文件將占用兩個文件:原始文件及指向它的符號鏈接 # if store slave file use symbol link轉載于:https://www.cnblogs.com/gugibv/p/8585632.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的(转) 分布式文件存储FastDFS(七)FastDFS配置文件详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 查社保出现cannotreadprope
- 下一篇: 自学git心得-5