打开端口
sudo iptables -I INPUT -p tcp -m tcp --dport 22122 -j ACCEPT
sudo service iptables save
sudo iptables -I INPUT -p tcp -m tcp --dport 23000 -j ACCEPT
sudo service iptables save
tracker的配置只有一处:
# the base path to store data and log files
base_path=/opt/fastdfs/tracker/data-and-log/
tracker优化配置
#工作线程数,通常设置为CPU数量
work_threads=1
# 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
#上传组(卷)的方式:0轮询,1:指定,2:负载平衡(剩余空间最大选择)
store_lookup=2
# which group to upload file
# when store_lookup set to 1, must set store_group to the group name
#如果上一参数选择1方式,即制定组名,当前参数用来设置指定的组,如果选择其他方式,当前参数无效
store_group=group2
# 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)
#同组推送方式0.轮询方式,1.根据ip地址进行排序选择第一个服务器,2.根据优先级进行排序(优先级由storeServer的配置文件中upload_priority属性设置)
#当使用集群且进行文件append上传时,建议配置为1,否则append可能路由到一个还没同步到的节点上,导致错误
store_server=0
# 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
#选择哪个文件目录进行上传(一个StoreServer上面可以有多个base_path)0.轮询,2.剩余空间最大
store_path=0
# 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集群配置4处需要注意
日志文件
# the base path to store data and log files
base_path=/home/fastdfs-storage/data-and-log
存储挂载文件
# 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/file
tracker设置成集群
# tracker_server can ocur more than once, and tracker_server format is
# "host:port", host can be hostname or ip address
tracker_server=10.129.3.8:22122
tracker_server=10.129.3.10:22122
# 这里只能填内网的ip地址,不能填127.0.0.1/localhost,因为tracker可能会有tracker集群,127.0.0.1导致相互同步信息错误
storage需要注意的
group_name=group1
所有的副本集都是用group1,当你横向扩展加入到fastdfs时候,才需要新的设置新的group2,一般一个storage server对应一个groupName
store_path0=/home/fastdfs-storage/file
对应M00,store_path1对应M01
/02/44是fastdfs自动生成的文件夹
tracker和storage的ip访问安全配置
tracker.conf和storage.conf修改如下:
allow_hosts=100.5.22.53
allow_hosts=100.5.22.54
allow_hosts=100.5.22.55
allow_hosts=127.0.0.1
allow_hosts=localhost
vim /xxxx/tracker.conf
/usr/bin/fdfs_trackerd /xxxx/tracker.conf restart
vim /yyyy/storage.conf
/usr/bin/fdfs_storaged /yyyy/storage.conf restart