吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 721|回复: 3
收起左侧

[学习记录] CentOS 7.9 64位 SCC版安装FastDfs和配置Nginx

[复制链接]
HearLiangshan 发表于 2023-7-27 13:37

最近练习的项目中需要用到FastDfs 和Nginx,这里记录一下安装和配置过程,个人使用部署过程遇到了很多的坑,准备把过程记下来不然忘了。
首先,购买/试用阿里云  CentOS 7.9  64位Scc版系统,进入远程桌面。
由于项目较老,所以我安装的是老版本。不过各组件版本得对应得上。
fastdfs 5.11版本对照:Version 5.11对应的fastdfs-nginx-module的Version 1.20
fastdfs  5.10版本对照:Version 5.10对应的fastdfs-nginx-module的Version 1.19
防止因版本不对产生错误。
我装的是fastdfs 5.11和fastdfs-nginx-module-1.20
1、安装GCC
FastDFS是C语言开发,安装FastDFS需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc
yum install -y gcc gcc-c++

2、安装libevent
FastDFS依赖libevent库
yum -y install libevent

3、 安装libfastcommon
 libfastcommon是FastDFS官方提供的,libfastcommon包含了FastDFS运行所需要的一些基础库。

  1. 获取libfastcommon安装包:

  2. wget https://github.com/happyfish100/libfastcommon/archive/V1.0.38.tar.gz

  3. 解压安装包:tar -zxvf V1.0.38.tar.gz

  4. 进入目录:cd libfastcommon-1.0.38

  5. 执行编译:./make.sh

  6. 安装:./make.sh install
    libfastcommon安装好后会在/usr/lib64 目录下生成  libfastcommon.so 库文件;
    注意:由于FastDFS程序引用usr/lib目录所以需要将/usr/lib64下的库文件拷贝至/usr/lib下。
    cp libfastcommon.so /usr/lib

4、安装FastDFS

  1. 获取fdfs安装包:
  2. wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz
  3. 解压安装包:tar -zxvf V5.11.tar.gz
  4. 进入目录:cd fastdfs-5.11
  5. 执行编译:./make.sh
  6. 安装:./make.sh install
  7. 查看可执行命令:ls -la /usr/bin/fdfs*
    编辑
    5、安装tracker,配置Tracker服务
  8. 进入/etc/fdfs目录,有三个.sample后缀的文件(自动生成的fdfs模板配置文件),通过cp命令拷贝tracker.conf.sample,删除.sample后缀作为正式文件:

    编辑

  9. 编辑tracker.conf:vi tracker.conf,修改相关参数
    要改动的地方有几处,昨天改的,今天不记得是哪了,直接贴源文件。
    ("i":插入,修改文件,   "Esc"退出修改模式 ,    "Shift+:(输入  :)"再输入wq 再按Ent 就能保存并退出文件了。    w write的意思,q  quit退出)
  10. is this config file disabled

  11. false for enabled

  12. true for disabled

  13. disabled=false
  14. bind an address of this host

  15. empty for bind all addresses of this host

  16. bind_addr=
  17. the tracker server port

  18. port=22122
  19. connect timeout in seconds

  20. default value is 30s

  21. connect_timeout=30
  22. network timeout in seconds

  23. default value is 30s

  24. network_timeout=30
  25. the base path to store data and log files

  26. base_path=/home/fastdfs/tracker
  27. max concurrent connections this server supported

  28. max_connections=256
  29. accept thread count

  30. default value is 1

  31. since V4.07

  32. accept_threads=1
  33. work thread count, should <= max_connections

  34. default value is 4

  35. default value is 4

  36. since V2.00

  37. work_threads=4
  38. min buff size

  39. default value 8KB

  40. min_buff_size = 8KB

  41. max buff size

  42. default value 128KB

  43. max_buff_size = 128KB

  44. the method of selecting group to upload files

  45. 0: round robin

  46. 1: specify group

  47. 2: load balance, select the max free space group to upload file

  48. store_lookup=2
  49. which group to upload file

  50. when store_lookup set to 1, must set store_group to the group name

  51. store_group=group1
  52. which storage server to upload file

  53. 0: round robin (default)

  54. 1: the first server order by ip address

  55. 2: the first server order by priority (the minimal)

  56. Note: if use_trunk_file set to true, must set store_server to 1 or 2

  57. store_server=0
  58. which path(means disk or mount point) of the storage server to upload file

  59. 0: round robin

  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,

  65. no file can be uploaded to this group.

  66. bytes unit can be one of follows:

  67. G or g for gigabyte(GB)

  68. M or m for megabyte(MB)

  69. K or k for kilobyte(KB)

  70. no unit for byte(B)

  71. XX.XX% as ratio such as reserved_storage_space = 10%

  72. reserved_storage_space = 10%
  73. standard log level as syslog, case insensitive, value list:

  74. emerg for emergency

  75. alert

  76. crit for critical

  77. error

  78. warn for warning

  79. notice

  80. info

  81. debug

  82. log_level=info
  83. unix group name to run this program,

  84. not set (empty) means run by the group of current user

  85. run_by_group=
  86. unix username to run this program,

  87. not set (empty) means run by current user

  88. run_by_user=
  89. allow_hosts can ocur more than once, host can be hostname or ip address,

  90. "*" (only one asterisk) means match all ip addresses

  91. we can use CIDR ips like 192.168.5.64/26

  92. and also use range like these: 10.0.1.[0-254] and host[01-08,20-25].domain.com

  93. for example:

  94. allow_hosts=10.0.1.[1-15,20]

  95. allow_hosts=host[01-08,20-25].domain.com

  96. allow_hosts=192.168.5.64/26

  97. allow_hosts=*
  98. sync log buff to disk every interval seconds

  99. default value is 10 seconds

  100. sync_log_buff_interval = 10
  101. check storage server alive interval seconds

  102. check_active_interval = 120
  103. thread stack size, should >= 64KB

  104. default value is 64KB

  105. thread_stack_size = 64KB
  106. auto adjust when the ip address of the storage server changed

  107. default value is true

  108. storage_ip_changed_auto_adjust = true
  109. storage sync file max delay seconds

  110. default value is 86400 seconds (one day)

  111. since V2.00

  112. storage_sync_file_max_delay = 86400
  113. the max time of storage sync a file

  114. default value is 300 seconds

  115. since V2.00

  116. storage_sync_file_max_time = 300
  117. if use a trunk file to store several small files

  118. default value is false

  119. since V3.00

  120. use_trunk_file = false
  121. the min slot size, should <= 4KB

  122. default value is 256 bytes

  123. since V3.00

  124. slot_min_size = 256
  125. the max slot size, should > slot_min_size

  126. store the upload file to trunk file when it's size <=  this value

  127. default value is 16MB

  128. since V3.00

  129. slot_max_size = 16MB
  130. the trunk file size, should >= 4MB

  131. default value is 64MB

  132. since V3.00

  133. trunk_file_size = 64MB
  134. if create trunk file advancely

  135. default value is false

  136. since V3.06

  137. trunk_create_file_advance = false
  138. the time base to create trunk file

  139. the time format: HH:MM

  140. default value is 02:00

  141. since V3.06

  142. trunk_create_file_time_base = 02:00
  143. the interval of create trunk file, unit: second

  144. default value is 38400 (one day)

  145. since V3.06

  146. trunk_create_file_interval = 86400
  147. the threshold to create trunk file

  148. when the free trunk file size less than the threshold, will create

  149. the trunk files

  150. default value is 0

  151. since V3.06

  152. trunk_create_file_space_threshold = 20G
  153. if check trunk space occupying when loading trunk free spaces

  154. the occupied spaces will be ignored

  155. default value is false

  156. since V3.09

  157. NOTICE: set this parameter to true will slow the loading of trunk spaces

  158. when startup. you should set this parameter to true when neccessary.

  159. trunk_init_check_occupying = false
  160. if ignore storage_trunk.dat, reload from trunk binlog

  161. default value is false

  162. since V3.10

  163. set to true once for version upgrade when your version less than V3.10

  164. trunk_init_reload_from_binlog = false
  165. the min interval for compressing the trunk binlog file

  166. unit: second

  167. default value is 0, 0 means never compress

  168. FastDFS compress the trunk binlog when trunk init and trunk destroy

  169. recommand to set this parameter to 86400 (one day)

  170. since V5.01

  171. trunk_compress_binlog_min_interval = 0
  172. if use storage ID instead of IP address

  173. default value is false

  174. since V4.00

  175. use_storage_id = false
  176. specify storage ids filename, can use relative or absolute path

  177. since V4.00

  178. storage_ids_filename = storage_ids.conf
  179. id type of the storage server in the filename, values are:

  180. ip: the ip address of the storage server

  181. id: the server id of the storage server

  182. this paramter is valid only when use_storage_id set to true

  183. default value is ip

  184. since V4.03

  185. id_type_in_filename = ip
  186. if store slave file use symbol link

  187. default value is false

  188. since V4.01

  189. store_slave_file_use_link = false
  190. if rotate the error log every day

  191. default value is false

  192. since V4.02

  193. rotate_error_log = false
  194. rotate error log time base, time format: Hour:Minute

  195. Hour from 0 to 23, Minute from 0 to 59

  196. default value is 00:00

  197. since V4.02

  198. error_log_rotate_time=00:00
  199. rotate error log when the log file exceeds this size

  200. 0 means never rotates log file by log file size

  201. default value is 0

  202. since V4.02

  203. rotate_error_log_size = 0
  204. keep days of the log files

  205. 0 means do not delete old log files

  206. default value is 0

  207. log_file_keep_days = 0
  208. if use connection pool

  209. default value is false

  210. since V4.05

  211. connection_pool_max_idle_time = 3600
  212. HTTP port on this tracker server

  213. http.server_port=8080
  214. check storage HTTP server alive interval seconds

  215. <= 0 for never check

  216. default value is 30

  217. http.check_alive_interval=30
  218. check storage HTTP server alive type, values are:

  219. tcp : connect to the storge server with HTTP port only,

  220. do not request and get response

  221. http: storage check alive url must return http status 200

  222. default value is tcp

  223. http.check_alive_type=tcp
  224. check storage HTTP server alive uri/url

  225. NOTE: storage embed HTTP server support uri: /status.html

  226. http.check_alive_uri=/status.html
  227. 注意一下存放数据和日志的目录,启动后需要查看日志信息
    刚刚配置的目录可能不存在,我们创建出来
    mkdir -p /home/fastdfs/tracker
  228. 启动tracker(支持start|stop|restart):支持以下方式启动
  229. /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start  
  230. fdfs_trackerd /etc/fdfs/tracker.conf  
  231. 可以采用熟悉的服务启动方式:
    service fdfs_trackerd start #
  232. 另外:
  233. 启动fdfs_trackerd服务,停止用stop
  234. 我们可以通过以下命令,设置tracker开机启动:
    sudo chkconfig fdfs_trackerd on
    查看tracker启动日志:进入刚刚指定的base_path(/home/fastdfs/tracker)中有个logs目录,查看tracker.log文件
    cd /home/fastdfs/tracker/logs 
    cat trackerd.log

    编辑
    6.查看端口情况:netstat -apn|grep fdfs
    编辑
    附: 可能遇到的报错:
    /usr/bin/fdfs_trackerd: error while loading shared libraries: libfastcommon.so: cannot open shared object file: No such file or directory

解决方案:建立libfastcommon.so软链接
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so

6、配置和启动storage
由于上面已经安装过FastDFS,这里只需要配置storage就好了;
(1)切换目录到: /etc/fdfs/ 目录下;
(2)拷贝一份新的storage配置文件
cp storage.conf.sample storage.conf
刚刚配置的目录可能不存在,我们创建出来
mkdir -p /home/fastdfs/storage
(3)修改storage.conf ;  (同样需要修改的地方不多)

is this config file disabled

false for enabled

true for disabled

disabled=false

bind an address of this host

empty for bind all addresses of this host

bind_addr=

the tracker server port

port=22122

connect timeout in seconds

default value is 30s

connect_timeout=30

network timeout in seconds

default value is 30s

network_timeout=30

the base path to store data and log files

base_path=/home/fastdfs/tracker

max concurrent connections this server supported

max_connections=256

accept thread count

default value is 1

since V4.07

accept_threads=1

work thread count, should <= max_connections

default value is 4

since V2.00

work_threads=4

if disk read / write separated

false for mixed read and write

true for separated read and write

default value is true

since V2.00

disk_rw_separated = true

disk reader thread count per store base path

for mixed read / write, this parameter can be 0

default value is 1

since V2.00

disk_reader_threads = 1

disk writer thread count per store base path

for mixed read / write, this parameter can be 0

default value is 1

since V2.00

disk_writer_threads = 1

when no entry to sync, try read binlog again after X milliseconds

must > 0, default value is 200ms

sync_wait_msec=50

after sync a file, usleep milliseconds

0 for sync successively (never call usleep)

sync_interval=0

storage sync start time of a day, time format: Hour:Minute

Hour from 0 to 23, Minute from 0 to 59

sync_start_time=00:00

storage sync end time of a day, time format: Hour:Minute

Hour from 0 to 23, Minute from 0 to 59

sync_end_time=23:59

write to the mark file after sync N files

default value is 500

write_mark_file_freq=500

path(disk or mount point) count, default value is 1

store_path_count=1

store_path#, based 0, if store_path0 not exists, it's value is base_path

the paths must be exist

store_path0=/home/fastdfs/storage

store_path1=/home/yuqing/fastdfs2

subdir_count  * subdir_count directories will be auto created under each

store_path (disk), value can be 1 to 256, default value is 256

subdir_count_per_path=256

tracker_server can ocur more than once, and tracker_server format is

"host:port", host can be hostname or ip address

tracker_server=...:22122(填自己服务器的ip)

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=debug

unix group name to run this program,

not set (empty) means run by the group of current user

run_by_group=

unix username to run this program,

not set (empty) means run by current user

run_by_user=

allow_hosts can ocur more than once, host can be hostname or ip address,

"*" (only one asterisk) means match all ip addresses

we can use CIDR ips like 192.168.5.64/26

and also use range like these: 10.0.1.[0-254] and 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=192.168.5.64/26

allow_hosts=*

the mode of the files distributed to the data path

0: round robin(default)

1: random, distributted by hash code

file_distribute_path_mode=0

valid when file_distribute_to_path is set to 0 (round robin),

when the written file count reaches this number, then rotate to next path

default value is 100

file_distribute_rotate_count=100

call fsync to disk when write big file

0: never call fsync

other: call fsync when written bytes >= this bytes

default value is 0 (never call fsync)

fsync_after_written_bytes=0

sync log buff to disk every interval seconds

must > 0, default value is 10 seconds

sync_log_buff_interval=10

sync binlog buff / cache to disk every interval seconds

default value is 60 seconds

sync_binlog_buff_interval=10

sync storage stat info to disk every interval seconds

default value is 300 seconds

sync_stat_file_interval=300

thread stack size, should >= 512KB

default value is 512KB

thread_stack_size=512KB

the priority as a source server for uploading file.

the lower this value, the higher its uploading priority.

default value is 10

upload_priority=10

the NIC alias prefix, such as eth in Linux, you can see it by ifconfig -a

multi aliases split by comma. empty value means auto set by OS type

default values is empty

if_alias_prefix=

if check file duplicate, when set to true, use FastDHT to store file indexes

1 or yes: need check

0 or no: do not check

default value is 0

check_file_duplicate=0

file signature method for check file duplicate

hash: four 32 bits hash code

md5: MD5 signature

default value is hash

since V4.01

file_signature_method=hash

namespace for storing file indexes (key-value pairs)

this item must be set when check_file_duplicate is true / on

key_namespace=FastDFS

set keep_alive to 1 to enable persistent connection with FastDHT servers

default value is 0 (short connection)

keep_alive=0

you can use "#include filename" (not include double quotes) directive to

load FastDHT server list, when the filename is a relative path such as

pure filename, the base path is the base path of current/this config file.

must set FastDHT server list when check_file_duplicate is true / on

please see INSTALL of FastDHT for detail

include /home/yuqing/fastdht/conf/fdht_servers.conf

if log to access log

default value is false

since V4.00

use_access_log = false

if rotate the access log every day

default value is false

since V4.00

rotate_access_log = true

rotate access log time base, time format: Hour:Minute

Hour from 0 to 23, Minute from 0 to 59

default value is 00:00

since V4.00

access_log_rotate_time=00:00

if rotate the error log every day

default value is false

since V4.02

rotate_error_log = true

rotate error log time base, time format: Hour:Minute

Hour from 0 to 23, Minute from 0 to 59

default value is 00:00

since V4.02

error_log_rotate_time=00:00

rotate access log when the log file exceeds this size

0 means never rotates log file by log file size

default value is 0

since V4.02

rotate_access_log_size = 0

rotate error log when the log file exceeds this size

0 means never rotates log file by log file size

default value is 0

since V4.02

rotate_error_log_size = 0

keep days of the log files

0 means do not delete old log files

default value is 0

log_file_keep_days = 7

if skip the invalid record when sync file

default value is false

since V4.02

file_sync_skip_invalid_record=false

if use connection pool

default value is false

since V4.05

use_connection_pool = false

connections whose the idle time exceeds this time will be closed

unit: second

default value is 3600

since V4.05

connection_pool_max_idle_time = 3600

use the ip address of this storage server if domain_name is empty,

else this domain name will ocur in the url redirected by the tracker server

http.domain_name=

the port of the web server on this storage server

http.server_port=8888

注意tracker的地址配置是否正确,否则启动时会报错
2、启动Storage
fdfs_storaged /etc/fdfs/storage.conf

sh /etc/init.d/fdfs_storaged
service fdfs_storaged start # 启动fdfs_storaged服务,停止用stop
另外,我们可以通过以下命令,设置tracker开机启动:
chkconfig fdfs_storaged on
3、查看日志
cd /home/fastdfs/storage/logs
cat storaged.log

[2023-07-26 15:48:35] INFO - FastDFS v5.11, base_path=/home/fastdfs/storage, store_path_count=1, subdir_count_per_path=256, group_name=group1, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, accept_threads=1, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=1, sync_wait_msec=50ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=10s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, file_signature_method=hash, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=, use_access_log=0, rotate_access_log=1, access_log_rotate_time=00:00, rotate_error_log=1, error_log_rotate_time=00:00, rotate_access_log_size=0, rotate_error_log_size=0, log_file_keep_days=7, file_sync_skip_invalid_record=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
[2023-07-26 15:48:35] INFO - file: storage_param_getter.c, line: 191, use_storage_id=0, id_type_in_filename=ip, storage_ip_changed_auto_adjust=1, store_path=0, reserved_storage_space=10.00%, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, store_slave_file_use_link=0
[2023-07-26 15:48:35] INFO - file: storage_func.c, line: 257, tracker_client_ip: ****, my_server_id_str: ****, g_server_id_in_filename: -822470484
[2023-07-26 15:48:35] DEBUG - file: storage_ip_changed_dealer.c, line: 241, last my ip is ****, current my ip is ****
[2023-07-26 15:48:35] ERROR - file: sockopt.c, line: 861, bind port 23000 failed, errno: 98, error info: Address already in use.
[2023-07-26 15:48:35] CRIT - exit abnormally!

这是因为此时Storage已经启动了,再执行启动命令就会报错地址已被使用,此时可以执行restart命令进行重启.
fdfs_storaged /etc/fdfs/storage.conf restart
出现上述信息表示Storage已启动成功.

[2023-07-26 15:51:09] INFO - FastDFS v5.11, base_path=/home/fastdfs/storage, store_path_count=1, subdir_count_per_path=256, group_name=group1, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, accept_threads=1, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, buff_size=256KB, heart_beat_interval=30s, stat_report_interval=60s, tracker_server_count=1, sync_wait_msec=50ms, sync_interval=0ms, sync_start_time=00:00, sync_end_time=23:59, write_mark_file_freq=500, allow_ip_count=-1, file_distribute_path_mode=0, file_distribute_rotate_count=100, fsync_after_written_bytes=0, sync_log_buff_interval=10s, sync_binlog_buff_interval=10s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, file_signature_method=hash, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=, use_access_log=0, rotate_access_log=1, access_log_rotate_time=00:00, rotate_error_log=1, error_log_rotate_time=00:00, rotate_access_log_size=0, rotate_error_log_size=0, log_file_keep_days=7, file_sync_skip_invalid_record=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
[2023-07-26 15:51:09] INFO - file: storage_param_getter.c, line: 191, use_storage_id=0, id_type_in_filename=ip, storage_ip_changed_auto_adjust=1, store_path=0, reserved_storage_space=10.00%, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, store_slave_file_use_link=0
[2023-07-26 15:51:09] INFO - file: storage_func.c, line: 257, tracker_client_ip: ****, my_server_id_str: ****, g_server_id_in_filename: -822470484
[2023-07-26 15:51:09] DEBUG - file: storage_ip_changed_dealer.c, line: 241, last my ip is ****, current my ip is ****
[2023-07-26 15:51:09] DEBUG - file: fast_task_queue.c, line: 227, max_connections: 256, init_connections: 256, alloc_task_once: 256, min_buff_size: 262144, max_buff_size: 262144, block_size: 263288, arg_size: 1008, max_data_size: 268435456, total_size: 67401728
[2023-07-26 15:51:09] DEBUG - file: fast_task_queue.c, line: 284, malloc task info as whole: 1, malloc loop count: 1
[2023-07-26 15:51:09] DEBUG - file: tracker_client_thread.c, line: 225, report thread to tracker server ****:22122 started
[2023-07-26 15:51:09] INFO - file: tracker_client_thread.c, line: 310, successfully connect to tracker server ****:22122, as a tracker client, my ip is****
[2023-07-26 15:51:09] INFO - file: tracker_client_thread.c, line: 1263, tracker server ****:22122, set tracker leader: ****:22122

或者
ps -ef | grep storage

杀死对应的进程号

kill -9 xxxx
fdfs_storaged /etc/fdfs/storage.conf
最后,通过ps -ef | grep fdfs 查看进程:
编辑
7、安装Nginx和fastdfs-nginx-module模块

  1. 下载Nginx安装包
  2. wget http://nginx.org/download/nginx-1.15.2.tar.gz
  3. 下载fastdfs-nginx-module安装包
  4. wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.20.tar.gz
  5. 解压nginx:tar -zxvf nginx-1.15.2.tar.gz
  6. 安装nginx的依赖库
  7. yum install pcre
  8. yum install pcre-devel
  9. yum install zlib
  10. yum install zlib-devel
  11. yum install openssl
    yum install openssl-devel
  12. 解压fastdfs-nginx-module:tar -xvf V1.20.tar.gz
    将fastdfs-nginx-module/src下的mod_fastdfs.conf拷贝至/etc/fdfs/下
  13. cp mod_fastdfs.conf /etc/fdfs/
  14. 并修改 /etc/fdfs/mod_fastdfs.conf 的内容;vi /etc/fdfs/mod_fastdfs.conf
  15. 更改下面几处配置的内容:
    base_path=/home/fastdfs

tracker_server=10.129.44.128:22122

tracker_server=192.168.172.20:22122 #(多个tracker配置多行)

url_have_group_name=true        #url中包含group名称

store_path0=/home/fastdfs/storage  #指定文件存储路径(上面配置的store路径)
3.将libfdfsclient.so拷贝至/usr/lib下
cp /usr/lib64/libfdfsclient.so /usr/lib/
4.创建nginx/client目录
mkdir -p /var/temp/nginx/client

  1. 进入nginx目录:cd nginx-1.15.2
  2. 配置,并加载fastdfs-nginx-module模块:
    ./configure --prefix=/usr/local/nginx --add-module=/opt/fastdfs-nginx-module-1.20/src/
  3. 编译安装
  4. make & make install

    fastdfs安装好了,nginx安装好了, 到了安装fastdfs-nginx-module的时候, 编译报错了
    安装成功后查看生成的目录,如下所示:
    cd /usr/local/nginx

    ll

    编辑
    8.拷贝配置文件到 /etc/fdfs 下;
    cd /opt/fastdfs-5.11/conf/
    cp http.conf mime.types /etc/fdfs/
    9.修改nginx配置文件

  5. mkdir /usr/local/nginx/logs # 创建logs目录
  6. cd /usr/local/nginx/conf/ vim nginx.conf
  7. 做如下的修改:
  8. 编辑
    (我目前没改,因为没  ngx_fastdfs_module这个文件/文件夹)

    说明:
    location /group1/M00/:group1为nginx 服务FastDFS的分组名称,M00是FastDFS自动生成编号,对应store_path0=/home/fdfs_storage,如果FastDFS定义store_path1,这里就是M01
    注意:  如若安装fastdfs-nginx-module的时候遇到如下报错:
    /usr/local/include/fastdfs/fdfs_define.h:15:27: 致命错误:common_define.h:没有那个文件或目录
    解决方法:
    编辑 fastdfs-nginx-module-1.20/src/config 文件
    vim fastdfs-nginx-module-1.20/src/config
    改变的文件内容

       ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
      CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

    再重新到nginx目录下
    ./configure --prefix=/usr/local/nginx --add-module=/opt/fastdfs-nginx-module-1.20/src/

    make & make install

    消除错误。
    10.查看安装路径:whereis nginx
    编辑
    11.启动、停止:
    cd /usr/local/nginx/sbin/
    ./nginx
    ./nginx -s stop #此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程

    ./nginx -s quit #此方式停止步骤是待nginx进程处理任务完毕进行停止

./nginx -s reload

12.查看此时的nginx版本:发现fastdfs模块已经安装好了
(我把fastdfs-nginx-module-1.20文件夹改成了astdfs-nginx-module,之前找不到文件名astdfs-nginx-module-1.20,不过后来感觉不改也行。出了不存在文件名的报错主要看自己的文件名是不是都有、都对上了)

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| HearLiangshan 发表于 2023-7-27 13:38
附件里没插入图片选项,无图
Marken888 发表于 2023-7-27 17:26
 楼主| HearLiangshan 发表于 2023-8-7 22:38
Marken888 发表于 2023-7-27 17:26
可以使用图床上传网络图片

好的,谢谢。有空我重发一份。(这文章在csdn也能搜到,所以我之前就偷了点懒)
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-6-6 05:41

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表