1. 程式人生 > >【FastDFS專題】fastdfs使用實戰(配置篇)

【FastDFS專題】fastdfs使用實戰(配置篇)

FastDFS的配置檔案在/usr/local/webserver/fastdfs/etc目錄下,其中包括
 client.conf    客戶端上傳配置檔案
 storage.conf    檔案儲存伺服器配置檔案
 tracker.conf    負責均衡排程伺服器配置檔案
 http.conf        http伺服器配置檔案
 
跟蹤器tracker:192.168.0.6
儲存節點Storage:192.168.0.5
 
一、配置及啟動Tracker Server
1、修改tracker.conf檔案,修改如下
base_path=/usr/local/webserver/fastdfs/   
http.server_port= 8090   # 指定埠  
#include http.conf       # HTTP支援
 
3、啟動tracker伺服器
/usr/local/webserver/fastdfs/bin/fdfs_trackerd /usr/local/webserver/fastdfs/etc/tracker.conf 
 
4、檢視tracker的啟動日誌
tailf /usr/local/webserver/fastdfs/logs/trackerd.log
[2011-12-09 10:34:44] INFO - FastDFS v3.02, base_path=/usr/local/webserver/fastdfs, run_by_group=, run_by_user=, 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=4096MB, 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, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB
[2011-12-09 10:34:44] 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
[2011-12-09 10:34:44] ERROR - file: ../common/sockopt.c, line: 735, bind port 22122 failed, errno: 98, error info: Address already in use.
[2011-12-09 10:35:06] INFO - FastDFS v3.02, base_path=/usr/local/webserver/fastdfs, run_by_group=, run_by_user=, 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=4096MB, 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, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB
[2011-12-09 10:35:06] 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啟動成功。

二、配置及啟動Storage Server
1、修改storage.conf檔案,修改如下:
 #可以自定義,但必須存在此目錄,用於儲存storage相關的log、group內的相關資訊
 group_name=lxsym         #自定義組
 base_path=/usr/local/webserver/fastdfs  #安裝路徑
 store_path0=/data/fastdfs   #資料儲存路徑(可以指定多個)
 tracker_server=192.168.0.6:22122   #跟蹤器IP及埠
 http.server_port= 8090   # 指定埠
 #include http.conf       # HTTP支援
 
 2、啟動storage伺服器
 /usr/local/webserver/fastdfs/bin/fdfs_storaged /usr/local/webserver/fastdfs/etc/storage.conf
 
 3、檢視storage伺服器啟動日誌
 tailf /usr/local/webserver/fastdfs/logs/storaged.log
[2011-12-18 18:13:28] INFO - FastDFS v3.02, base_path=/usr/local/webserver/fastdfs, 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, work_threads=4, disk_rw_separated=1, disk_reader_threads=1, disk_writer_threads=1, disk_rw_direct=0, 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, FDHT group count=0, FDHT server count=0, FDHT key_namespace=, FDHT keep_alive=0, HTTP server port=8888, domain name=
[2011-12-18 18:13:28] 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
[2011-12-18 18:13:50] INFO - file: storage_param_getter.c, line: 97, storage_ip_changed_auto_adjust=1, store_path=0, reserved_storage_space=4096 MB, use_trunk_file=0, slot_min_size=0, slot_max_size=16 MB, trunk_file_size=64 MB
[2011-12-18 18:13:52] INFO - file: tracker_client_thread.c, line: 304, successfully connect to tracker server 192.168.0.6:22122, as a tracker client, my ip is 192.168.0.5
[2011-12-18 18:13:52] INFO - file: tracker_client_thread.c, line: 1100, tracker server 192.168.0.6:22122, set tracker leader: 192.168.0.6:22122
storage server啟動成功。