当前位置:   article > 正文

fastdfs-6.10.0安装_libserverframe

libserverframe

一、fastdfs介绍

FastDFS由淘宝资深架构师余庆编写并开源,使用C语言编写而成。FastDFS为互联网量身定制,充分考虑了冗余备份、负载均衡、线性扩容等机制,并注重高可用、高性能等指标。使用FastDFS能够很容易搭建出一套高性能的文件服务器集群,实现文件上传、下载等服务。

二、fastdfs软件下载

2.1、libfastcommon-1.0.70.tar.gz

2.2、fastdfs-6.10.0.tar

2.3、libserverframe

2.4、fastdfs-nginx-module-1.23.tar

三、安装前的准备

3.1、安装gcc,gcc-c++

yum install -y gcc gcc-c++

3.2、安装libevent

yum -y install libevent

3.3、解压缩libfastcommon-1.0.70

tar -zxvf libfastcommon-1.0.70.tar.gz

3.4、安装libfastcommon-1.0.70

  1. cd /usr/local/bigdata/libfastcommon-1.0.70
  2. ./make.sh
  3. ./make.sh install

3.5、安装libserverframe-1.2.0

  1. tar -zxvf libserverframe-1.2.0.tar.gz
  2. cd libserverframe-1.2.0
  3. ./make.sh
  4. ./make.sh install

3.6、安装fastdfs-6.10.0.tar.gz

  1. tar -zxvf fastdfs-6.10.0.tar.gz
  2. cd fastdfs-6.10.0
  3. ./make.sh
  4. ./make.sh install

四、修改fastdfs配置

4.1、配置文件地址

/etc/fdfs
  1. [root@node5 fdfs]# ll
  2. 总用量 32
  3. -rw-r--r-- 1 root root 1901 1120 21:18 client.conf
  4. -rw-r--r-- 1 root root 10287 1120 21:25 storage.conf
  5. -rw-r--r-- 1 root root 620 1120 21:18 storage_ids.conf
  6. -rw-r--r-- 1 root root 9158 1120 21:22 tracker.conf

4.2、tracker.conf 配置文件 

  1. [root@node5 fdfs]# cat tracker.conf
  2. # is this config file disabled
  3. # false for enabled
  4. # true for disabled
  5. disabled = false
  6. # bind an address of this host
  7. # empty for bind all addresses of this host
  8. bind_addr =
  9. # the tracker server port
  10. port = 22122
  11. # connect timeout in seconds
  12. # default value is 30
  13. # Note: in the intranet network (LAN), 2 seconds is enough.
  14. connect_timeout = 5
  15. # network timeout in seconds for send and recv
  16. # default value is 30
  17. network_timeout = 60
  18. # the base path to store data and log files
  19. # base_path = /opt/fastdfs
  20. base_path = /data/fastdfs
  21. # max concurrent connections this server support
  22. # you should set this parameter larger, eg. 10240
  23. # default value is 256
  24. max_connections = 1024
  25. # accept thread count
  26. # default value is 1 which is recommended
  27. # since V4.07
  28. accept_threads = 1
  29. # work thread count
  30. # work threads to deal network io
  31. # default value is 4
  32. # since V2.00
  33. work_threads = 4
  34. # the min network buff size
  35. # default value 8KB
  36. min_buff_size = 8KB
  37. # the max network buff size
  38. # default value 128KB
  39. max_buff_size = 128KB
  40. # the method for selecting group to upload files
  41. # 0: round robin
  42. # 1: specify group
  43. # 2: load balance, select the max free space group to upload file
  44. store_lookup = 2
  45. # which group to upload file
  46. # when store_lookup set to 1, must set store_group to the group name
  47. store_group = group2
  48. # which storage server to upload file
  49. # 0: round robin (default)
  50. # 1: the first server order by ip address
  51. # 2: the first server order by priority (the minimal)
  52. # Note: if use_trunk_file set to true, must set store_server to 1 or 2
  53. store_server = 0
  54. # which path (means disk or mount point) of the storage server to upload file
  55. # 0: round robin
  56. # 2: load balance, select the max free space path to upload file
  57. store_path = 0
  58. # which storage server to download file
  59. # 0: round robin (default)
  60. # 1: the source storage server which the current file uploaded to
  61. download_server = 0
  62. # reserved storage space for system or other applications.
  63. # if the free(available) space of any stoarge server in
  64. # a group <= reserved_storage_space, no file can be uploaded to this group.
  65. # bytes unit can be one of follows:
  66. ### G or g for gigabyte(GB)
  67. ### M or m for megabyte(MB)
  68. ### K or k for kilobyte(KB)
  69. ### no unit for byte(B)
  70. ### XX.XX% as ratio such as: reserved_storage_space = 10%
  71. reserved_storage_space = 20%
  72. #standard log level as syslog, case insensitive, value list:
  73. ### emerg for emergency
  74. ### alert
  75. ### crit for critical
  76. ### error
  77. ### warn for warning
  78. ### notice
  79. ### info
  80. ### debug
  81. log_level = info
  82. #unix group name to run this program,
  83. #not set (empty) means run by the group of current user
  84. run_by_group=
  85. #unix username to run this program,
  86. #not set (empty) means run by current user
  87. run_by_user =
  88. # allow_hosts can ocur more than once, host can be hostname or ip address,
  89. # "*" (only one asterisk) means match all ip addresses
  90. # we can use CIDR ips like 192.168.5.64/26
  91. # and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
  92. # for example:
  93. # allow_hosts=10.0.1.[1-15,20]
  94. # allow_hosts=host[01-08,20-25].domain.com
  95. # allow_hosts=192.168.5.64/26
  96. allow_hosts = *
  97. # sync log buff to disk every interval seconds
  98. # default value is 10 seconds
  99. sync_log_buff_interval = 1
  100. # check storage server alive interval seconds
  101. check_active_interval = 120
  102. # thread stack size, should >= 64KB
  103. # default value is 256KB
  104. thread_stack_size = 256KB
  105. # auto adjust when the ip address of the storage server changed
  106. # default value is true
  107. storage_ip_changed_auto_adjust = true
  108. # storage sync file max delay seconds
  109. # default value is 86400 seconds (one day)
  110. # since V2.00
  111. storage_sync_file_max_delay = 86400
  112. # the max time of storage sync a file
  113. # default value is 300 seconds
  114. # since V2.00
  115. storage_sync_file_max_time = 300
  116. # if use a trunk file to store several small files
  117. # default value is false
  118. # since V3.00
  119. use_trunk_file = false
  120. # the min slot size, should <= 4KB
  121. # default value is 256 bytes
  122. # since V3.00
  123. slot_min_size = 256
  124. # the max slot size, should > slot_min_size
  125. # store the upload file to trunk file when it's size <= this value
  126. # default value is 16MB
  127. # since V3.00
  128. slot_max_size = 1MB
  129. # the alignment size to allocate the trunk space
  130. # default value is 0 (never align)
  131. # since V6.05
  132. # NOTE: the larger the alignment size, the less likely of disk
  133. # fragmentation, but the more space is wasted.
  134. trunk_alloc_alignment_size = 256
  135. # if merge contiguous free spaces of trunk file
  136. # default value is false
  137. # since V6.05
  138. trunk_free_space_merge = true
  139. # if delete / reclaim the unused trunk files
  140. # default value is false
  141. # since V6.05
  142. delete_unused_trunk_files = false
  143. # the trunk file size, should >= 4MB
  144. # default value is 64MB
  145. # since V3.00
  146. trunk_file_size = 64MB
  147. # if create trunk file advancely
  148. # default value is false
  149. # since V3.06
  150. trunk_create_file_advance = false
  151. # the time base to create trunk file
  152. # the time format: HH:MM
  153. # default value is 02:00
  154. # since V3.06
  155. trunk_create_file_time_base = 02:00
  156. # the interval of create trunk file, unit: second
  157. # default value is 38400 (one day)
  158. # since V3.06
  159. trunk_create_file_interval = 86400
  160. # the threshold to create trunk file
  161. # when the free trunk file size less than the threshold,
  162. # will create he trunk files
  163. # default value is 0
  164. # since V3.06
  165. trunk_create_file_space_threshold = 20G
  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. # if ignore storage_trunk.dat, reload from trunk binlog
  174. # default value is false
  175. # since V3.10
  176. # set to true once for version upgrade when your version less than V3.10
  177. trunk_init_reload_from_binlog = false
  178. # the min interval for compressing the trunk binlog file
  179. # unit: second, 0 means never compress
  180. # FastDFS compress the trunk binlog when trunk init and trunk destroy
  181. # recommand to set this parameter to 86400 (one day)
  182. # default value is 0
  183. # since V5.01
  184. trunk_compress_binlog_min_interval = 86400
  185. # the interval for compressing the trunk binlog file
  186. # unit: second, 0 means never compress
  187. # recommand to set this parameter to 86400 (one day)
  188. # default value is 0
  189. # since V6.05
  190. trunk_compress_binlog_interval = 86400
  191. # compress the trunk binlog time base, time format: Hour:Minute
  192. # Hour from 0 to 23, Minute from 0 to 59
  193. # default value is 03:00
  194. # since V6.05
  195. trunk_compress_binlog_time_base = 03:00
  196. # max backups for the trunk binlog file
  197. # default value is 0 (never backup)
  198. # since V6.05
  199. trunk_binlog_max_backups = 7
  200. # if use storage server ID instead of IP address
  201. # if you want to use dual IPs for storage server, you MUST set
  202. # this parameter to true, and configure the dual IPs in the file
  203. # configured by following item "storage_ids_filename", such as storage_ids.conf
  204. # default value is false
  205. # since V4.00
  206. use_storage_id = false
  207. # specify storage ids filename, can use relative or absolute path
  208. # this parameter is valid only when use_storage_id set to true
  209. # since V4.00
  210. storage_ids_filename = storage_ids.conf
  211. # id type of the storage server in the filename, values are:
  212. ## ip: the ip address of the storage server
  213. ## id: the server id of the storage server
  214. # this paramter is valid only when use_storage_id set to true
  215. # default value is ip
  216. # since V4.03
  217. id_type_in_filename = id
  218. # if store slave file use symbol link
  219. # default value is false
  220. # since V4.01
  221. store_slave_file_use_link = false
  222. # if rotate the error log every day
  223. # default value is false
  224. # since V4.02
  225. rotate_error_log = false
  226. # rotate error log time base, time format: Hour:Minute
  227. # Hour from 0 to 23, Minute from 0 to 59
  228. # default value is 00:00
  229. # since V4.02
  230. error_log_rotate_time = 00:00
  231. # if compress the old error log by gzip
  232. # default value is false
  233. # since V6.04
  234. compress_old_error_log = false
  235. # compress the error log days before
  236. # default value is 1
  237. # since V6.04
  238. compress_error_log_days_before = 7
  239. # rotate error log when the log file exceeds this size
  240. # 0 means never rotates log file by log file size
  241. # default value is 0
  242. # since V4.02
  243. rotate_error_log_size = 0
  244. # keep days of the log files
  245. # 0 means do not delete old log files
  246. # default value is 0
  247. log_file_keep_days = 0
  248. # if use connection pool
  249. # default value is false
  250. # since V4.05
  251. use_connection_pool = true
  252. # connections whose the idle time exceeds this time will be closed
  253. # unit: second
  254. # default value is 3600
  255. # since V4.05
  256. connection_pool_max_idle_time = 3600
  257. # HTTP port on this tracker server
  258. http.server_port = 8080
  259. # check storage HTTP server alive interval seconds
  260. # <= 0 for never check
  261. # default value is 30
  262. http.check_alive_interval = 30
  263. # check storage HTTP server alive type, values are:
  264. # tcp : connect to the storge server with HTTP port only,
  265. # do not request and get response
  266. # http: storage check alive url must return http status 200
  267. # default value is tcp
  268. http.check_alive_type = tcp
  269. # check storage HTTP server alive uri/url
  270. # NOTE: storage embed HTTP server support uri: /status.html
  271. http.check_alive_uri = /status.html

4.3、storage.conf配置文件

  1. [root@node5 fdfs]# cat storage.conf
  2. # is this config file disabled
  3. # false for enabled
  4. # true for disabled
  5. disabled = false
  6. # the name of the group this storage server belongs to
  7. #
  8. # comment or remove this item for fetching from tracker server,
  9. # in this case, use_storage_id must set to true in tracker.conf,
  10. # and storage_ids.conf must be configured correctly.
  11. group_name = group1
  12. # bind an address of this host
  13. # empty for bind all addresses of this host
  14. bind_addr =
  15. # if bind an address of this host when connect to other servers
  16. # (this storage server as a client)
  17. # true for binding the address configured by the above parameter: "bind_addr"
  18. # false for binding any address of this host
  19. client_bind = true
  20. # the storage server port
  21. port = 23000
  22. # connect timeout in seconds
  23. # default value is 30
  24. # Note: in the intranet network (LAN), 2 seconds is enough.
  25. connect_timeout = 5
  26. # network timeout in seconds for send and recv
  27. # default value is 30
  28. network_timeout = 60
  29. # the heart beat interval in seconds
  30. # the storage server send heartbeat to tracker server periodically
  31. # default value is 30
  32. heart_beat_interval = 30
  33. # disk usage report interval in seconds
  34. # the storage server send disk usage report to tracker server periodically
  35. # default value is 300
  36. stat_report_interval = 60
  37. # the base path to store data and log files
  38. # NOTE: the binlog files maybe are large, make sure
  39. # the base path has enough disk space,
  40. # eg. the disk free space should > 50GB
  41. # base_path = /opt/fastdfs
  42. base_path = /data/fastdfs
  43. # max concurrent connections the server supported,
  44. # you should set this parameter larger, eg. 10240
  45. # default value is 256
  46. max_connections = 1024
  47. # the buff size to recv / send data from/to network
  48. # this parameter must more than 8KB
  49. # 256KB or 512KB is recommended
  50. # default value is 64KB
  51. # since V2.00
  52. buff_size = 256KB
  53. # accept thread count
  54. # default value is 1 which is recommended
  55. # since V4.07
  56. accept_threads = 1
  57. # work thread count
  58. # work threads to deal network io
  59. # default value is 4
  60. # since V2.00
  61. work_threads = 4
  62. # if disk read / write separated
  63. ## false for mixed read and write
  64. ## true for separated read and write
  65. # default value is true
  66. # since V2.00
  67. disk_rw_separated = true
  68. # disk reader thread count per store path
  69. # for mixed read / write, this parameter can be 0
  70. # default value is 1
  71. # since V2.00
  72. disk_reader_threads = 1
  73. # disk writer thread count per store path
  74. # for mixed read / write, this parameter can be 0
  75. # default value is 1
  76. # since V2.00
  77. disk_writer_threads = 1
  78. # when no entry to sync, try read binlog again after X milliseconds
  79. # must > 0, default value is 200ms
  80. sync_wait_msec = 50
  81. # after sync a file, usleep milliseconds
  82. # 0 for sync successively (never call usleep)
  83. sync_interval = 0
  84. # storage sync start time of a day, time format: Hour:Minute
  85. # Hour from 0 to 23, Minute from 0 to 59
  86. sync_start_time = 00:00
  87. # storage sync end time of a day, time format: Hour:Minute
  88. # Hour from 0 to 23, Minute from 0 to 59
  89. sync_end_time = 23:59
  90. # write to the mark file after sync N files
  91. # default value is 500
  92. write_mark_file_freq = 500
  93. # disk recovery thread count
  94. # default value is 1
  95. # since V6.04
  96. disk_recovery_threads = 3
  97. # store path (disk or mount point) count, default value is 1
  98. store_path_count = 1
  99. # store_path#, based on 0, to configure the store paths to store files
  100. # if store_path0 not exists, it's value is base_path (NOT recommended)
  101. # the paths must be exist.
  102. #
  103. # IMPORTANT NOTE:
  104. # the store paths' order is very important, don't mess up!!!
  105. # the base_path should be independent (different) of the store paths
  106. # store_path0 = /opt/fastdfs
  107. store_path0 = /data/fastdfs/fdfs_storage
  108. #store_path1 = /opt/fastdfs2
  109. # subdir_count * subdir_count directories will be auto created under each
  110. # store_path (disk), value can be 1 to 256, default value is 256
  111. subdir_count_per_path = 256
  112. # tracker_server can ocur more than once for multi tracker servers.
  113. # the value format of tracker_server is "HOST:PORT",
  114. # the HOST can be hostname or ip address,
  115. # and the HOST can be dual IPs or hostnames seperated by comma,
  116. # the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
  117. # or two different types of inner (intranet) IPs.
  118. # for example: 192.168.2.100,122.244.141.46:22122
  119. # another eg.: 192.168.1.10,172.17.4.21:22122
  120. tracker_server = node5:22122
  121. # tracker_server = 192.168.209.122:22122
  122. #standard log level as syslog, case insensitive, value list:
  123. ### emerg for emergency
  124. ### alert
  125. ### crit for critical
  126. ### error
  127. ### warn for warning
  128. ### notice
  129. ### info
  130. ### debug
  131. log_level = info
  132. #unix group name to run this program,
  133. #not set (empty) means run by the group of current user
  134. run_by_group =
  135. #unix username to run this program,
  136. #not set (empty) means run by current user
  137. run_by_user =
  138. # allow_hosts can ocur more than once, host can be hostname or ip address,
  139. # "*" (only one asterisk) means match all ip addresses
  140. # we can use CIDR ips like 192.168.5.64/26
  141. # and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com
  142. # for example:
  143. # allow_hosts=10.0.1.[1-15,20]
  144. # allow_hosts=host[01-08,20-25].domain.com
  145. # allow_hosts=192.168.5.64/26
  146. allow_hosts = *
  147. # the mode of the files distributed to the data path
  148. # 0: round robin(default)
  149. # 1: random, distributted by hash code
  150. file_distribute_path_mode = 0
  151. # valid when file_distribute_to_path is set to 0 (round robin).
  152. # when the written file count reaches this number, then rotate to next path.
  153. # rotate to the first path (00/00) after the last path (such as FF/FF).
  154. # default value is 100
  155. file_distribute_rotate_count = 100
  156. # call fsync to disk when write big file
  157. # 0: never call fsync
  158. # other: call fsync when written bytes >= this bytes
  159. # default value is 0 (never call fsync)
  160. fsync_after_written_bytes = 0
  161. # sync log buff to disk every interval seconds
  162. # must > 0, default value is 10 seconds
  163. sync_log_buff_interval = 1
  164. # sync binlog buff / cache to disk every interval seconds
  165. # default value is 60 seconds
  166. sync_binlog_buff_interval = 1
  167. # sync storage stat info to disk every interval seconds
  168. # default value is 300 seconds
  169. sync_stat_file_interval = 300
  170. # thread stack size, should >= 512KB
  171. # default value is 512KB
  172. thread_stack_size = 512KB
  173. # the priority as a source server for uploading file.
  174. # the lower this value, the higher its uploading priority.
  175. # default value is 10
  176. upload_priority = 10
  177. # the NIC alias prefix, such as eth in Linux, you can see it by ifconfig -a
  178. # multi aliases split by comma. empty value means auto set by OS type
  179. # default values is empty
  180. if_alias_prefix =
  181. # if check file duplicate, when set to true, use FastDHT to store file indexes
  182. # 1 or yes: need check
  183. # 0 or no: do not check
  184. # default value is 0
  185. check_file_duplicate = 0
  186. # file signature method for check file duplicate
  187. ## hash: four 32 bits hash code
  188. ## md5: MD5 signature
  189. # default value is hash
  190. # since V4.01
  191. file_signature_method = hash
  192. # namespace for storing file indexes (key-value pairs)
  193. # this item must be set when check_file_duplicate is true / on
  194. key_namespace = FastDFS
  195. # set keep_alive to 1 to enable persistent connection with FastDHT servers
  196. # default value is 0 (short connection)
  197. keep_alive = 0
  198. # you can use "#include filename" (not include double quotes) directive to
  199. # load FastDHT server list, when the filename is a relative path such as
  200. # pure filename, the base path is the base path of current/this config file.
  201. # must set FastDHT server list when check_file_duplicate is true / on
  202. # please see INSTALL of FastDHT for detail
  203. ##include /home/yuqing/fastdht/conf/fdht_servers.conf
  204. # if log to access log
  205. # default value is false
  206. # since V4.00
  207. use_access_log = false
  208. # if rotate the access log every day
  209. # default value is false
  210. # since V4.00
  211. rotate_access_log = false
  212. # rotate access log time base, time format: Hour:Minute
  213. # Hour from 0 to 23, Minute from 0 to 59
  214. # default value is 00:00
  215. # since V4.00
  216. access_log_rotate_time = 00:00
  217. # if compress the old access log by gzip
  218. # default value is false
  219. # since V6.04
  220. compress_old_access_log = false
  221. # compress the access log days before
  222. # default value is 1
  223. # since V6.04
  224. compress_access_log_days_before = 7
  225. # if rotate the error log every day
  226. # default value is false
  227. # since V4.02
  228. rotate_error_log = false
  229. # rotate error log time base, time format: Hour:Minute
  230. # Hour from 0 to 23, Minute from 0 to 59
  231. # default value is 00:00
  232. # since V4.02
  233. error_log_rotate_time = 00:00
  234. # if compress the old error log by gzip
  235. # default value is false
  236. # since V6.04
  237. compress_old_error_log = false
  238. # compress the error log days before
  239. # default value is 1
  240. # since V6.04
  241. compress_error_log_days_before = 7
  242. # rotate access log when the log file exceeds this size
  243. # 0 means never rotates log file by log file size
  244. # default value is 0
  245. # since V4.02
  246. rotate_access_log_size = 0
  247. # rotate error log when the log file exceeds this size
  248. # 0 means never rotates log file by log file size
  249. # default value is 0
  250. # since V4.02
  251. rotate_error_log_size = 0
  252. # keep days of the log files
  253. # 0 means do not delete old log files
  254. # default value is 0
  255. log_file_keep_days = 0
  256. # if skip the invalid record when sync file
  257. # default value is false
  258. # since V4.02
  259. file_sync_skip_invalid_record = false
  260. # if use connection pool
  261. # default value is false
  262. # since V4.05
  263. use_connection_pool = true
  264. # connections whose the idle time exceeds this time will be closed
  265. # unit: second
  266. # default value is 3600
  267. # since V4.05
  268. connection_pool_max_idle_time = 3600
  269. # if compress the binlog files by gzip
  270. # default value is false
  271. # since V6.01
  272. compress_binlog = true
  273. # try to compress binlog time, time format: Hour:Minute
  274. # Hour from 0 to 23, Minute from 0 to 59
  275. # default value is 01:30
  276. # since V6.01
  277. compress_binlog_time = 01:30
  278. # if check the mark of store path to prevent confusion
  279. # recommend to set this parameter to true
  280. # if two storage servers (instances) MUST use a same store path for
  281. # some specific purposes, you should set this parameter to false
  282. # default value is true
  283. # since V6.03
  284. check_store_path_mark = true
  285. # use the ip address of this storage server if domain_name is empty,
  286. # else this domain name will ocur in the url redirected by the tracker server
  287. http.domain_name =
  288. # the port of the web server on this storage server
  289. http.server_port = 8888

4.4、client.conf 

  1. [root@node5 bigdata]# cat /etc/fdfs/client.conf
  2. # connect timeout in seconds
  3. # default value is 30s
  4. # Note: in the intranet network (LAN), 2 seconds is enough.
  5. connect_timeout = 5
  6. # network timeout in seconds
  7. # default value is 30s
  8. network_timeout = 60
  9. # the base path to store log files
  10. # base_path = /opt/fastdfs
  11. base_path = /data/fastdfs/client
  12. # tracker_server can ocur more than once for multi tracker servers.
  13. # the value format of tracker_server is "HOST:PORT",
  14. # the HOST can be hostname or ip address,
  15. # and the HOST can be dual IPs or hostnames seperated by comma,
  16. # the dual IPS must be an inner (intranet) IP and an outer (extranet) IP,
  17. # or two different types of inner (intranet) IPs.
  18. # for example: 192.168.2.100,122.244.141.46:22122
  19. # another eg.: 192.168.1.10,172.17.4.21:22122
  20. tracker_server = node5:22122
  21. #tracker_server = 192.168.0.197:22122
  22. #standard log level as syslog, case insensitive, value list:
  23. ### emerg for emergency
  24. ### alert
  25. ### crit for critical
  26. ### error
  27. ### warn for warning
  28. ### notice
  29. ### info
  30. ### debug
  31. log_level = info
  32. # if use connection pool
  33. # default value is false
  34. # since V4.05
  35. use_connection_pool = false
  36. # connections whose the idle time exceeds this time will be closed
  37. # unit: second
  38. # default value is 3600
  39. # since V4.05
  40. connection_pool_max_idle_time = 3600
  41. # if load FastDFS parameters from tracker server
  42. # since V4.05
  43. # default value is false
  44. load_fdfs_parameters_from_tracker = false
  45. # if use storage ID instead of IP address
  46. # same as tracker.conf
  47. # valid only when load_fdfs_parameters_from_tracker is false
  48. # default value is false
  49. # since V4.05
  50. use_storage_id = false
  51. # specify storage ids filename, can use relative or absolute path
  52. # same as tracker.conf
  53. # valid only when load_fdfs_parameters_from_tracker is false
  54. # since V4.05
  55. storage_ids_filename = storage_ids.conf
  56. #HTTP settings
  57. http.tracker_server_port = 80
  58. #use "#include" directive to include HTTP other settiongs
  59. ##include http.conf

五、启动fastdfs

/usr/bin/fdfs_trackerd  /etc/fdfs/tracker.conf 
/usr/bin/fdfs_storaged  /etc/fdfs/storage.conf

查看启动端口

netstat -ntlp
  1. [root@node5 bigdata]# netstat -ntlp
  2. Active Internet connections (only servers)
  3. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  4. tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 51822/fdfs_storaged
  5. tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1332/master
  6. tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 51590/fdfs_trackerd
  7. tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 680/rpcbind
  8. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1090/sshd
  9. tcp6 0 0 ::1:25 :::* LISTEN 1332/master
  10. tcp6 0 0 :::111 :::* LISTEN 680/rpcbind
  11. tcp6 0 0 :::22 :::* LISTEN 1090/sshd

  1. [root@node5 data]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
  2. [2023-11-20 21:56:02] DEBUG - cp: 0x616bc0, tls.enabled: 0, htable_capacity: 0
  3. [2023-11-20 21:56:02] DEBUG - base_path=/data/fastdfs, connect_timeout=5, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=1, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
  4. server_count=1, server_index=0
  5. tracker server is 192.168.42.143:22122
  6. group count: 1
  7. Group 1:
  8. group name = group1
  9. disk total space = 17,394 MB
  10. disk free space = 14,381 MB
  11. trunk free space = 0 MB
  12. storage server count = 1
  13. active server count = 1
  14. storage server port = 23000
  15. storage HTTP port = 8888
  16. store path count = 1
  17. subdir count per path = 256
  18. current write server index = 0
  19. current trunk file id = 0
  20. Storage 1:
  21. id = 192.168.42.143
  22. ip_addr = 192.168.42.143 ACTIVE
  23. http domain =
  24. version = 6.10.
  25. join time = 2023-11-20 21:26:27
  26. up time = 2023-11-20 21:26:38
  27. total storage = 17,394 MB
  28. free storage = 14,381 MB
  29. upload priority = 10
  30. store_path_count = 1
  31. subdir_count_per_path = 256
  32. storage_port = 23000
  33. storage_http_port = 8888
  34. current_write_path = 0
  35. source storage id =
  36. if_trunk_server = 0
  37. connection.alloc_count = 0
  38. connection.current_count = 0
  39. connection.max_count = 0
  40. total_upload_count = 0
  41. success_upload_count = 0
  42. total_append_count = 0
  43. success_append_count = 0
  44. total_modify_count = 0
  45. success_modify_count = 0
  46. total_truncate_count = 0
  47. success_truncate_count = 0
  48. total_set_meta_count = 0
  49. success_set_meta_count = 0
  50. total_delete_count = 0
  51. success_delete_count = 0
  52. total_download_count = 0
  53. success_download_count = 0
  54. total_get_meta_count = 0
  55. success_get_meta_count = 0
  56. total_create_link_count = 0
  57. success_create_link_count = 0
  58. total_delete_link_count = 0
  59. success_delete_link_count = 0
  60. total_upload_bytes = 0
  61. success_upload_bytes = 0
  62. total_append_bytes = 0
  63. success_append_bytes = 0
  64. total_modify_bytes = 0
  65. success_modify_bytes = 0
  66. stotal_download_bytes = 0
  67. success_download_bytes = 0
  68. total_sync_in_bytes = 0
  69. success_sync_in_bytes = 0
  70. total_sync_out_bytes = 0
  71. success_sync_out_bytes = 0
  72. total_file_open_count = 0
  73. success_file_open_count = 0
  74. total_file_read_count = 0
  75. success_file_read_count = 0
  76. total_file_write_count = 0
  77. success_file_write_count = 0
  78. last_heart_beat_time = 2023-11-20 21:55:39
  79. last_source_update = 1970-01-01 08:00:00
  80. last_sync_update = 1970-01-01 08:00:00
  81. last_synced_timestamp = 1970-01-01 08:00:00

这样fastdfs就安装成功了

上次代码验证

  1. [root@node5 bigdata]# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf hello.txt
  2. group1/M00/00/00/wKgqj2VbZz6AEMWLAAAAVg21ZJg024.txt
  1. [root@node5 bigdata]# cat /data/fastdfs/fdfs_storage/data/00/00/wKgqj2VbZz6AEMWLAAAAVg21ZJg024.txt
  2. aasdfasdfasdf
  3. asdfasdfasdf
  4. asd
  5. fasd
  6. fasdfasd
  7. hello world
  8. asdfasdf
  9. asdf
  10. as
  11. df
  12. asdf
  13. asd
  1. 删除文件
  2. # /usr/bin/fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKgqj2VbZz6AEMWLAAAAVg21ZJg024.txt

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/201203
推荐阅读
  

闽ICP备14008679号