1. 程式人生 > >FastDFS Tracker端配置檔案詳解及啟動注意事項

FastDFS Tracker端配置檔案詳解及啟動注意事項

今天進行了FastDFS的tracker端的配置,程式碼傳送如下:
Java程式碼  收藏程式碼
  1. # is this config file disabled  
  2. falsefor enabled  
  3. truefor disabled  
  4. disabled=false
  5. #當前配置是否不可用false可用,true不可用  
  6. # bind an address of this host  
  7. # empty for bind all addresses of this host  
  8. bind_addr=  
  9. #是否繫結IP如果一個伺服器上有多個IP則設定哪個IP可用,如果不設定則不限制  
  10. # the tracker server port  
  11. port=22122
  12. #埠  
  13. # connect timeout in seconds  
  14. default value is 30s  
  15. connect_timeout=30
  16. #針對socket套接字函式connect的連線超時時間設定  
  17. # network timeout in seconds  
  18. default value is 30s  
  19. network_timeout=60
  20. #設定網路超時,單位秒,傳送或接收資料時,如果在超時時間之後依然不能進行,則本次網路通訊失敗  
  21. # the base path to store data and log files  
  22. base_path=/home/fdfs  
  23. #配置儲存根目錄地址,這個目錄必須存在,子目錄將自動建立  
  24. # max concurrent connections this
     server supported  
  25. max_connections=256
  26. #最大連線數  
  27. # work thread count, should <= max_connections  
  28. default value is 4
  29. # since V2.00
  30. work_threads=1
  31. #工作執行緒數,通常設定為CPU數量  
  32. # the method of selecting group to upload files  
  33. 0: round robin  
  34. 1: specify group  
  35. 2: load balance, select the max free space group to upload file  
  36. store_lookup=2
  37. #上傳組(卷)的方式:0輪詢,1:指定,2:負載平衡(剩餘空間最大選擇)  
  38. # which group to upload file  
  39. # when store_lookup set to 1, must set store_group to the group name  
  40. store_group=group2  
  41. #如果上一引數選擇1方式,即制定祖名,當前引數用來設定指定的組,如果選擇其他方式,當前引數無效  
  42. # which storage server to upload file  
  43. 0: round robin (default)  
  44. 1: the first server order by ip address  
  45. 2: the first server order by priority (the minimal)  
  46. store_server=0
  47. #同組推送方式0.輪詢方式,1.根據ip地址進行排序選擇第一個伺服器,2.根據優先順序進行排序(優先順序由storeServer的配置檔案中upload_priority屬性設定)  
  48. # which path(means disk or mount point) of the storage server to upload file  
  49. 0: round robin  
  50. 2: load balance, select the max free space path to upload file  
  51. store_path=0
  52. #選擇哪個檔案目錄進行上傳(一個StroeServer上面可以有多個base_path)0.輪詢,2.剩餘空間最大  
  53. # which storage server to download file  
  54. 0: round robin (default)  
  55. 1: the source storage server which the current file uploaded to  
  56. download_server=0
  57. #選擇哪個storeServer最為下載伺服器,0.輪詢,1.哪個為源則哪個下載  
  58. # reserved storage space for system or other applications.  
  59. if the free(available) space of any stoarge server in   
  60. # a group <= reserved_storage_space,   
  61. # no file can be uploaded to this group.  
  62. # bytes unit can be one of follows:  
  63. ### G or g for gigabyte(GB)  
  64. ### M or m for megabyte(MB)  
  65. ### K or k for kilobyte(KB)  
  66. ### no unit forbyte(B)  
  67. ### XX.XX% as ratio such as reserved_storage_space = 10%  
  68. reserved_storage_space = 10%  
  69. #系統保留空間大小,用來保證系統和其他應用的正常執行  
  70. #standard log level as syslog, case insensitive, value list:  
  71. ### emerg for emergency  
  72. ### alert  
  73. ### crit for critical  
  74. ### error  
  75. ### warn for warning  
  76. ### notice  
  77. ### info  
  78. ### debug  
  79. log_level=info  
  80. #日誌級別  
  81. #unix group name to run this program,   
  82. #not set (empty) means run by the group of current user  
  83. run_by_group=  
  84. #使用那個系統使用者組執行FastDFS,預設為啟動執行緒的使用者組  
  85. #unix username to run this program,  
  86. #not set (empty) means run by current user  
  87. run_by_user=  
  88. #使用那個系統使用者執行FastDFS。預設為啟動執行緒的使用者  
  89. # allow_hosts can ocur more than once, host can be hostname or ip address,  
  90. "*" means match all ip addresses, can use range like this10.0.1.[1-15,20] or  
  91. # host[01-08,20-25].domain.com, for example:  
  92. # allow_hosts=10.0.1.[1-15,20]  
  93. # allow_hosts=host[01-08,20-25].domain.com  
  94. allow_hosts=*  
  95. #設定可以連線當前tracker的IP範圍,包括client和store_server  
  96. # sync log buff to disk every interval seconds  
  97. default value is 10 seconds  
  98. sync_log_buff_interval = 10
  99. #同步或重新整理日誌到本地硬碟的時間間隔,單位:秒  
  100. # check storage server alive interval seconds  
  101. check_active_interval = 120
  102. #檢測storage_server的存活狀態時間間隔,單位:秒,本引數要大於storage server的心跳包傳送間隔一般為2-3倍  
  103. # thread stack size, should >= 64KB  
  104. default value is 64KB  
  105. thread_stack_size = 64KB  
  106. #tracker server的執行緒棧大小,要求大於等於64K  
  107. # auto adjust when the ip address of the storage server changed  
  108. default value is true
  109. storage_ip_changed_auto_adjust = true
  110. #當storage server的IP發生變化時叢集是否自動調整。只有在storage server程序重啟時才能完成自動調整  
  111. # storage sync file max delay seconds  
  112. default value is 86400 seconds (one day)  
  113. # since V2.00
  114. storage_sync_file_max_delay = 86400
  115. #儲存伺服器之間同步檔案的最大延遲時間,預設為1天,可以根據實際情況進行調整  
  116. # the max time of storage sync a file  
  117. default value is 300 seconds  
  118. # since V2.00
  119. storage_sync_file_max_time = 300
  120. #同步一個檔案需要消耗的最大時間,預設為300秒,即5分鐘  
  121. if use a trunk file to store several small files  
  122. default value is false
  123. # since V3.00
  124. use_trunk_file = false
  125. #是否使用小檔案合併儲存特性,預設關閉,開啟時可以減少碎片檔案的出現,但同時加大伺服器的負載  
  126. # the min slot size, should <= 4KB  
  127. default value is 256 bytes  
  128. # since V3.00
  129. slot_min_size = 256
  130. #為trunk file分配的最小位元組數,比如一個檔案只有16位元組,根據當前設定,也會為其分配256位元組  
  131. # the max slot size, should > slot_min_size  
  132. # store the upload file to trunk file when it's size <=  this value  
  133. default value is 16MB  
  134. # since V3.00
  135. slot_max_size = 16MB  
  136. #為trunk file分配的最大位元組數,如果檔案小於大小則使用trunk方式儲存,當檔案大小大於這個數值是直接儲存到一個檔案中(不採用合併儲存方式)  
  137. # the trunk file size, should >= 4MB  
  138. default value is 64MB  
  139. # since V3.00
  140. trunk_file_size = 64MB  
  141. #trunk file的大小,不建議設定過大  
  142. if create trunk file advancely  
  143. default value is false
  144. # since V3.06
  145. trunk_create_file_advance = false
  146. #是否提前建立好trunk檔案,只用當這個引數設定為true時下面的3個以trunk_create_file開頭的引數將不用設定  
  147. # the time base to create trunk file  
  148. # the time format: HH:MM  
  149. default value is 02:00
  150. # since V3.06
  151. trunk_create_file_time_base = 02:00
  152. #建立trunk file的起始時間點,當前為凌晨2點開始  
  153. # the interval of create trunk file, unit: second  
  154. default value is 38400 (one day)  
  155. # since V3.06
  156. trunk_create_file_interval = 86400
  157. #提前建立trunk file的時間間隔,預設為1天  
  158. # the threshold to create trunk file  
  159. # when the free trunk file size less than the threshold, will create   
  160. # the trunk files  
  161. default value is 0
  162. # since V3.06
  163. trunk_create_file_space_threshold = 20G  
  164. #提前建立trunk file時,需要達到的空閒trunk大小  
  165. #例如:當前配置為20G,現在空閒的trunk file大小為4G,那麼只建立16G的trunk file  
  166. if check trunk space occupying when loading trunk free spaces  
  167. # the occupied spaces will be ignored  
  168. default value is false
  169. # since V3.09
  170. # NOTICE: set this parameter to true will slow the loading of trunk spaces   
  171. # when startup. you should set this parameter to true when neccessary.  
  172. trunk_init_check_occupying = false
  173. #trunk file 初始化時,是否檢查可用空間是否被佔用  
  174. if ignore storage_trunk.dat, reload from trunk binlog  
  175. default value is false
  176. # since V3.10
  177. # set to true once for version upgrade when your version less than V3.10
  178. trunk_init_reload_from_binlog = false
  179. #是否無條件從trunk binlog中載入trunk可用空間資訊  
  180. if use storage ID instead of IP address  
  181. default value is false
  182. # since V4.00
  183. use_storage_id = false
  184. #是否使用 serverID作為storage server標識  
  185. # specify storage ids filename, can use relative or absolute path  
  186. # since V4.00
  187. storage_ids_filename = storage_ids.conf  
  188. #use_storage_id設定為true,才需要設定本引數,詳見原始碼目錄下的conf/storage_ids.conf  
  189. #這個檔案中設定組名、serverID和對應的IP地址  
  190. # id type of the storage server in the filename, values are:  
  191. ## ip: the ip address of the storage server  
  192. ## id: the server id of the storage server  
  193. this paramter is valid only when use_storage_id set to true
  194. default value is ip  
  195. # since V4.03
  196. id_type_in_filename = ip  
  197. #use_storage_id設定為true時才需要設定本引數  
  198. if store slave file use symbol link  
  199. default value is false
  200. # since V4.01
  201. store_slave_file_use_link = false
  202. #儲存從檔案是否採用symbol link(符號連結)方式  
  203. #如果設定為true,一個從檔案將佔用兩個檔案:原始檔案及指向它的符號連結  
  204. if rotate the error log every day  
  205. default value is false
  206. # since V4.02
  207. rotate_error_log = false
  208. #是否定期輪轉error log,目前僅支援一天輪轉一次  
  209. # rotate error log time base, time format: Hour:Minute  
  210. # Hour from 0 to 23, Minute from 0 to 59
  211. default value is 00:00
  212. # since V4.02
  213. error_log_rotate_time=00:00
  214. #error log定期輪轉的時間節點,rotate_error_log引數設定為true時,本引數有效  
  215. # rotate error log when the log file exceeds this size  
  216. 0 means never rotates log file by log file size  
  217. default value is 0
  218. # since V4.02
  219. rotate_error_log_size = 0
  220. #error log按大小進行輪轉 0代表不按大小進行輪轉,否則當error log檔案達到大小則輪轉  
  221. if use connection pool  
  222. default value is false
  223. # since V4.05
  224. use_connection_pool = false
  225. #是否使用連線池  
  226. # connections whose the idle time exceeds this time will be closed  
  227. # unit: second  
  228. default value is 3600
  229. # since V4.05
  230. connection_pool_max_idle_time = 3600
  231. #連線池連結的最大生存時間,單位秒,use_connection_pool設定為true時有效  
  232. # HTTP port on this tracker server  
  233. http.server_port=8080
  234. #http服務埠,預設情況下V4.06是不安裝http服務的,詳見INSTALL檔案  
  235. # check storage HTTP server alive interval seconds  
  236. # <= 0for never check  
  237. default value is 30
  238. http.check_alive_interval=30
  239. #檢查長連結的存活時間30秒  
  240. # check storage HTTP server alive type, values are:  
  241. #   tcp : connect to the storge server with HTTP port only,   
  242. #        do not request and get response  
  243. #   http: storage check alive url must return http status 200
  244. default value is tcp  
  245. http.check_alive_type=tcp  
  246. #長連結的存在方式,當前配置為tcp方式  
  247. # check storage HTTP server alive uri/url  
  248. # NOTE: storage embed HTTP server support uri: /status.html  
  249. http.check_alive_uri=/status.html  
  250. #利用什麼標識進行檢查  

附件中有儲存好的traker.conf檔案,需要的可以進行下載
配置完成之後,執行
Java程式碼  收藏程式碼
  1. /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf  

tracker端就可以執行成功了。
可能出現的問題有兩個
1.base_path設定的目錄不存在,如果報這個錯誤,需要按base_path的設定建立一個目錄
2.找不到libevent-2.0.so.5
如果找不到這個,請確認安裝時的安裝位置
一般這個庫會安裝到/usr/local/lib中
而我們的fdfs_trackerd會到/usr/lib中去查詢,所以使用
Java程式碼  收藏程式碼
  1. ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5

將庫載入到/usr/lib中就可以了