Welcome 微信登录

首页 / 操作系统 / Linux / Ubuntu下FastDFS安装配置记录

一、FastDFS简介 FastDFS是一个个人开发的、轻量级的、开源的分布式文件系统,纯C语言编写,其功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题,具有稳定、高效、易用的优点。更多详见:FastDFS主页:http://code.google.com/p/fastdfs/ 作者为版主的讨论区:http://linux.chinaunix.net/bbs/forum-75-1.html  二、安装环境 1、操作系统:Ubuntu 9.10 32bit2、部署结构:1个tracker、1个storage(1组),PC单机(即tracker、storage均在同一台电脑上) 三、安装过程 官方安装文档:http://code.google.com/p/fastdfs/wiki/Setup  1、获取安装包:从项目主页(http://code.google.com/p/fastdfs/downloads/list )下载部署包 FastDFS_v1.29.tar.gz (FastDFS Server with PHP client extension source code V1.29, 2010-6-30最新发布版本)。2、解压安装包,然后切换到解压后的 FastDFS 主目录执行安装,即依次执行:Cmd代码
  1. tar xzf FastDFS_v1.29.tar.gz   
  2. cd FastDFS   
  3. ./make.sh   
  4. ./make.sh install  
tar xzf FastDFS_v1.29.tar.gzcd FastDFS./make.sh./make.sh install注意: 1)如果无法执行,则需要先安装gcc,Ubuntu系统可通过:sudo apt-get install gcc 安装。
2)Ubuntu系统上安装时需要将 make.sh 最后一段if去掉(从 if [ "$uname" = "Linux" ]; then 开始到倒数第2行),否则 ./make.sh install 时会报错。
3)执行./make.sh install时可能需要 root 权限。
  3a、配置tracker1)在FastDFS主目录的 conf 目录下有配置文件样例 tracker.conf,打开该文件,找到下列片段,红色 部分根据实际情况进行修改:# the base path to store data and log files
base_path=/home/yuqing/fastdfs
  2)启动tracker服务:
命令格式:/usr/local/bin/fdfs_trackerd <tracker_conf_filename> 实例:/usr/local/bin/fdfs_trackerd /FastDFS/conf/tracker.conf 3b、配置storage1)在FastDFS主目录的 conf 目录下有配置文件样例 storage.conf,打开该文件,找到下列片段,红色 部分根据实际情况进行修改:# the base path to store data and log files
base_path=/home/yuqing/fastdfs
  # store_path#, based 0, if store_path0 not exists, it"s value is base_path
# the paths must be exist
store_path0=/home/yuqing/fastdfs

#store_path1=/home/yuqing/fastdfs2  # tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
tracker_server=192.168.209.121:22122
  2)启动storage服务:
命令格式:/usr/local/bin/fdfs_storaged <storage_conf_filename> 实例:/usr/local/bin/fdfs_storaged /FastDFS/conf/storage.conf 第1次启动将会在所设置的存储路径下创建256个子文件夹,需要一些时间。 3)运行监控程序:
命令格式:/usr/local/bin/fdfs_monitor <storage_conf_filename> 实例:/usr/local/bin/fdfs_monitor /FastDFS/conf/storage.conf   控制台将会显示存储服务器的一些信息,类似如下:Txt代码
  1. base_path=/FastDFS/logs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0  
  2. server_count=1, server_index=0  
  3.   
  4. tracker server is 127.0.0.1:22122  
  5.   
  6. group count: 1  
  7.   
  8. Group 1:   
  9. group name = group1   
  10. free space = 42 GB   
  11. storage server count = 1  
  12. active server count = 1  
  13. storage_port = 23000  
  14. storage_http_port = 8888  
  15. store path count = 1  
  16. subdir count per path= 256  
  17. current write server index = 0  
  18.   
  19.     Host 1:   
  20.         ip_addr = 127.0.0.1 (localhost)  ACTIVE   
  21.         http domain =    
  22.         version = 1.29  
  23.         up time = 2010-07-20 16:52:44  
  24.         total storage = 49GB   
  25.         free storage = 42GB   
  26.         upload priority = 10  
  27.         store_path_count = 1  
  28.         subdir_count_per_path = 256  
  29.         storage_port = 23000  
  30.         storage_http_port = 8888  
  31.         current_write_path = 0  
  32.         source ip_addr =    
  33.         total_upload_count = 2  
  34.         success_upload_count = 2  
  35.         total_set_meta_count = 0  
  36.         success_set_meta_count = 0  
  37.         total_delete_count = 0  
  38.         success_delete_count = 0  
  39.         total_download_count = 0  
  40.         success_download_count = 0  
  41.         total_get_meta_count = 0  
  42.         success_get_meta_count = 0  
  43.         total_create_link_count = 0  
  44.         success_create_link_count = 0  
  45.         total_delete_link_count = 0  
  46.         success_delete_link_count = 0  
  47.         last_heart_beat_time = 2010-07-20 17:23:31  
  48.         last_source_update = 2010-07-20 17:16:43  
  49.         last_sync_update = 1970-01-01 08:00:00  
  50.         last_synced_timestamp= 1970-01-01 08:00:00  
base_path=/FastDFS/logs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0server_count=1, server_index=0tracker server is 127.0.0.1:22122group count: 1Group 1:group name = group1free space = 42 GBstorage server count = 1active server count = 1storage_port = 23000storage_http_port = 8888store path count = 1subdir count per path= 256current write server index = 0Host 1:ip_addr = 127.0.0.1 (localhost)ACTIVEhttp domain = version = 1.29up time = 2010-07-20 16:52:44total storage = 49GBfree storage = 42GBupload priority = 10store_path_count = 1subdir_count_per_path = 256storage_port = 23000storage_http_port = 8888current_write_path = 0source ip_addr = total_upload_count = 2success_upload_count = 2total_set_meta_count = 0success_set_meta_count = 0total_delete_count = 0success_delete_count = 0total_download_count = 0success_download_count = 0total_get_meta_count = 0success_get_meta_count = 0total_create_link_count = 0success_create_link_count = 0total_delete_link_count = 0success_delete_link_count = 0last_heart_beat_time = 2010-07-20 17:23:31last_source_update = 2010-07-20 17:16:43last_sync_update = 1970-01-01 08:00:00last_synced_timestamp= 1970-01-01 08:00:004、测试安装是否成功,上传一个文件:1)在 storage 服务器上 ,通过提供的命令行工具进行上传:命令格式:/usr/local/bin/fdfs_test <storage_conf_filename> <operation>实例:/usr/local/bin/fdfs_test /FastDFS/conf/storage.conf   upload /home/x.zip  控制台将会一些信息,类似如下:Txt代码
  1. This is FastDFS client test program v1.29  
  2.   
  3. Copyright (C) 2008, Happy Fish / YuQing   
  4.   
  5. FastDFS may be copied only under the terms of the GNU General   
  6. Public License V3, which may be found in the FastDFS source kit.   
  7. Please visit the FastDFS Home Page http://www.csource.org/    
  8. for more detail.   
  9.   
  10. base_path=/FastDFS/logs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0  
  11. group_name=group1, ip_addr=127.0.0.1, port=23000  
  12. storage_upload_by_filename   
  13. group_name=group1, remote_filename=M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470.zip   
  14. source ip address: 127.0.0.1  
  15. file timestamp=2010-07-20 17:16:43  
  16. file size=2688829  
  17. file url: http://127.0.0.1/group1/M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470.zip   
  18. storage_upload_slave_by_filename   
  19. group_name=group1, remote_filename=M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470_big.zip   
  20. source ip address: 127.0.0.1  
  21. file timestamp=2010-07-20 17:16:43  
  22. file size=2688829  
  23. file url: http://127.0.0.1/group1/M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470_big.zip  
This is FastDFS client test program v1.29Copyright (C) 2008, Happy Fish / YuQingFastDFS may be copied only under the terms of the GNU GeneralPublic License V3, which may be found in the FastDFS source kit.Please visit the FastDFS Home Page http://www.csource.org/ for more detail.base_path=/FastDFS/logs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0group_name=group1, ip_addr=127.0.0.1, port=23000storage_upload_by_filenamegroup_name=group1, remote_filename=M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470.zipsource ip address: 127.0.0.1file timestamp=2010-07-20 17:16:43file size=2688829file url: http://127.0.0.1/group1/M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470.zipstorage_upload_slave_by_filenamegroup_name=group1, remote_filename=M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470_big.zipsource ip address: 127.0.0.1file timestamp=2010-07-20 17:16:43file size=2688829file url: http://127.0.0.1/group1/M00/00/00/fwAAAUxFaXsAAAAAACkHPTYooKs470_big.zip至此,基本的安装已经成功。 说明:
1)在 tracker 和 storage 服务器是相互独立的情况下,在完成安装步骤的1-2后,第3步根据是 tracker 或 storage 而分别执行对应的 3a 或 3b 步骤即可。 2)storage 服务器是以心跳的方式主动向 tracker 服务器汇报自己的信息的,所以启动 tracker 和 storage 的顺序是任意的。Ubuntu下用ProxyChains穿墙安装Dropbox包你能学会的技术:Linux内核入门集相关资讯      Ubuntu知识 
  • Ubuntu 有这功能吗?-回答4个新用  (10/14/2014 16:54:49)
  • Ubuntu小知识总结  (07/08/2013 17:02:10)
  • 万圣节Halloween与Ubuntu  (10/31/2012 07:59:01)
  • Ubuntu系统诞生10周年:让Linux更  (10/14/2014 16:53:00)
  • Ubuntu ???方发布 Ubuntu 应用程序  (02/15/2013 21:49:58)
  • Ubuntu内置捐款选项:为掌握用户需  (10/11/2012 13:57:23)
本文评论 查看全部评论 (0)
表情: 姓名: 字数