设为首页 收藏本站
查看: 1346|回复: 0

[经验分享] FastDFS安装使用实战二(配置篇)

[复制链接]

尚未签到

发表于 2015-9-10 09:51:22 | 显示全部楼层 |阅读模式
FastDFS安装使用实战二(配置篇)
  Keywords:FastDFS、分布式文件系统、Ubuntu
  Author:soartju
  转载请注明出处:http://soartju.iteye.com/blog/803524
  
  
  FastDFS的配置文件在%FastDFS%/conf目录下,其中包括 Client.conf    客户端上传配置文件 Storage.conf    文件存储服务器配置文件 Tracker.conf    负责均衡调度服务器配置文件 http.conf        http服务器配置文件
配置文件需要根据服务器环境的不同,进行不同的配置,具体可以参考FastDFS官方的安装配置文档http://code.google.com/p/fastdfs/wiki/Setup,以及FastDFS原理介绍文档http://code.google.com/p/fastdfs/wiki/Overview
在本例中,Tracker Server,Storage Server都安装在一台服务器上,IP:10.0.2.15

1、配置及启动Tracker Server
  A、修改%FastDFS%/conf/tracker.conf文件,修改如下 #可以自己指定目录位置,但目录必须存在,用于存储日志及storage server等信息,否则tracker server无法启动


  • base_path=/home/yuqing/fastdfs -> base_path=/home/soar/fastdfs_tracker

base_path=/home/yuqing/fastdfs -> base_path=/home/soar/fastdfs_tracker
  #改成你想要的http端口,将来http下载文件的端口就是他了


  • http.server_port=8080 -> http.server_port=8090   

http.server_port=8080 -> http.server_port=8090
  #http支持


  • ##include http.conf -> #include http.conf

##include http.conf -> #include http.conf
  #默认4GB,如果空间不足,建议调小,否则会报no free space的异常,无法正常启动


  • reserved_storage_space = 4GB -> reserved_storage_space = 1GB

reserved_storage_space = 4GB -> reserved_storage_space = 1GB  
  #tracker server对storage server供服务的端口,使用默认的即可,也可以自定义


  • port=22122  

port=22122
  B、将http.conf文件拷贝到/etc/fdfs目录下,执行


  • sudo cp %FastDFS%/conf/http.conf /etc/fdfs/

sudo cp %FastDFS%/conf/http.conf /etc/fdfs/
  注:为了支持http,必须将这个文件拷贝到此目录,否则无法启动,报param http.XXX not exist or is empty类似的错误
  C、进入/usr/local/bin/目录,启动tracker服务器,执行


  • sudo fdfs_trackerd %FastDFS%/conf/tracker.conf

sudo fdfs_trackerd %FastDFS%/conf/tracker.conf
  D、进入/home/soar/fastdfs_tracker/logs/trackerd.log查看tracker的启动日志,如果看到类似


  • [2010-11-04 16:21:25] INFO - FastDFS v2.02, base_path=/home/soar/fastdfs_tracker, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, work_threads=4, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=4MB, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s  
  • [2010-11-04 16:21:25] INFO - HTTP supported: server_port=8090, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0, check_active_interval=30, check_active_type=tcp, check_active_uri=/status.html  

[2010-11-04 16:21:25] INFO - FastDFS v2.02, base_path=/home/soar/fastdfs_tracker, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, work_threads=4, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=4MB, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s
[2010-11-04 16:21:25] INFO - HTTP supported: server_port=8090, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0, check_active_interval=30, check_active_type=tcp, check_active_uri=/status.html
  
  恭喜你,tracker server已经启动成功!

2、配置及启动Storage Server
  A、修改%FastDFS%/conf/storage.conf文件,修改如下: #可以自定义,但必须存在此目录,用于存储storage相关的log、group内的相关信息


  • base_path=/home/yuqing/fastdfs -> /home/soar/fastdfs_storge

base_path=/home/yuqing/fastdfs -> /home/soar/fastdfs_storge
  #文件的存储位置,在一台storage server上可以指定多个存储位置


  • store_path0=/home/yuqing/fastdfs -> store_path0=/home/soar/fastdfs_storge

store_path0=/home/yuqing/fastdfs -> store_path0=/home/soar/fastdfs_storge
  #必须指定


  • group_name=group1

group_name=group1
  #修改成tracker server的IP和端口信息


  • tracker_server=192.168.209.121:22122 -> tracker_server=10.0.2.15:22122  

tracker_server=192.168.209.121:22122 -> tracker_server=10.0.2.15:22122
  #http支持


  • ##include http.conf ->#include http.conf

##include http.conf ->#include http.conf
  B、进入/usr/local/bin/目录,启动storage服务器,执行


  • sudo fdfs_storaged %FastDFS%/conf/storage.conf

sudo fdfs_storaged %FastDFS%/conf/storage.conf
  C、进入/home/soar/fastdfs_tracker/logs/storage.log查看storage服务器启动日志,如果看到类似


  • [2010-11-04 16:37:16] INFO - FastDFS v2.02, base_path=/home/soar/fastdfs_storge, store_path_count=1, subdir_count_per_path=256, group_name=group1, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, 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=200ms, 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=60s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=  
  • [2010-11-04 16:37:16] INFO - HTTP supported: server_port=8888, http_trunk_size=262144, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0  
  • [2010-11-04 16:37:16] INFO - file: storage_param_getter.c, line: 48, storage_ip_changed_auto_adjust=1  
  • [2010-11-04 16:37:19] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 10.0.2.15:22122, as a tracker client, my ip is 10.0.2.15  

[2010-11-04 16:37:16] INFO - FastDFS v2.02, base_path=/home/soar/fastdfs_storge, store_path_count=1, subdir_count_per_path=256, group_name=group1, connect_timeout=30s, network_timeout=60s, port=23000, bind_addr=, client_bind=1, max_connections=256, 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=200ms, 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=60s, sync_stat_file_interval=300s, thread_stack_size=512 KB, upload_priority=10, if_alias_prefix=, check_file_duplicate=0, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
[2010-11-04 16:37:16] INFO - HTTP supported: server_port=8888, http_trunk_size=262144, default_content_type=application/octet-stream, anti_steal_token=0, token_ttl=0s, anti_steal_secret_key length=0, token_check_fail content_type=, token_check_fail buff length=0
[2010-11-04 16:37:16] INFO - file: storage_param_getter.c, line: 48, storage_ip_changed_auto_adjust=1
[2010-11-04 16:37:19] INFO - file: tracker_client_thread.c, line: 274, successfully connect to tracker server 10.0.2.15:22122, as a tracker client, my ip is 10.0.2.15

  恭喜你,storage server已经启动成功!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-111810-1-1.html 上篇帖子: Fastdfs安装部署文档v1.0(2014-11-11) 下篇帖子: FastDFS介绍和配置过程 二
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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