FastDFS安装
环境介绍: tracker:192.168.43.129 storage:192.168.43.130
软件下载: wget wget –no-check-certificate
安装开始 一 首先安装libevent FastDFS这个步骤在tracker storage都需要操作 wget –no-check-certificate tar zxvf libevent-2.0.20-stable.tar.gz ./configure && make && make install
ln -s /usr/local/lib/libevent* /lib/ ln -s /usr/local/lib/libevent* /lib64/
wget tar zxvf FastDFS_v3.02.tar.gz cd FastDFS
- vim make.sh ############ TARGET_PREFIX=/usr/local 改成 TARGET_PREFIX=/usr/local/FastDFS #WITH_HTTPD=1 改成 WITH_HTTPD=1 #WITH_LINUX_SERVICE=1 改成 WITH_LINUX_SERVICE=1 ############ ./make.sh ./make.sh install
这样软件安装就已经完成 现在就单独配置tracker storage的配置文件了
- 二 登陆192.168.43.129 配置/etc/fdfs/tracker.conf[root@server fdfs]#grep -v '^#' tracker.conf |grep -v '^$'disabled=falsebind_addr=port=22122 ##端口connect_timeout=30network_timeout=60base_path=/home/data/fastdfs ##存储路径max_connections=256work_threads=4store_lookup=2store_group=group2store_server=0store_path=0download_server=0reserved_storage_space = 1GBlog_level=inforun_by_group=run_by_user=allow_hosts=*sync_log_buff_interval = 10check_active_interval = 120thread_stack_size = 64KBstorage_ip_changed_auto_adjust = truestorage_sync_file_max_delay = 86400storage_sync_file_max_time = 300use_trunk_file = false slot_min_size = 256slot_max_size = 16MBtrunk_file_size = 64MBhttp.disabled=falsehttp.server_port=8090 ##http端口 默认是8080http.check_alive_interval=30http.check_alive_type=tcphttp.check_alive_uri=/status.htmlhttp.need_find_content_type=true
启动tracher服务: /usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf [root@clinet2 fdfs]# netstat -antp|grep fdfs tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 20112/fdfs_trackerd tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 20112/fdfs_trackerd tcp 0 0 192.168.43.129:22122 192.168.43.130:54911 ESTABLISHED 20112/fdfs_trackerd
- 登陆192.168.43.130 配置storage 配置/etc/fdfs/ storage.conf && client.conf &&http.conf[root@clinet1 fdfs]# grep -v '^#' storage.conf |grep -v '^$'disabled=falsegroup_name=group1bind_addr=192.168.43.130 ##本storage的ip client_bind=trueport=23000 ##默认端口 connect_timeout=30network_timeout=60heart_beat_interval=30stat_report_interval=60base_path=/home/data/fastdfs ##存储路径max_connections=256buff_size = 256KBwork_threads=4disk_rw_separated = truedisk_rw_direct = falsedisk_reader_threads = 1disk_writer_threads = 1sync_wait_msec=50sync_interval=0sync_start_time=00:00sync_end_time=23:59write_mark_file_freq=500store_path_count=1store_path0=/home/data/fastdfs ##路径subdir_count_per_path=256tracker_server=192.168.43.129:22122 ##tracher服务器ip地址log_level=inforun_by_group=run_by_user=allow_hosts=*file_distribute_path_mode=0file_distribute_rotate_count=100fsync_after_written_bytes=0sync_log_buff_interval=10sync_binlog_buff_interval=10sync_stat_file_interval=300thread_stack_size=512KBupload_priority=10if_alias_prefix=check_file_duplicate=0key_namespace=FastDFSkeep_alive=0http.disabled=falsehttp.domain_name=http.server_port=8888 ##本stroage的http端口http.trunk_size=256KBhttp.need_find_content_type=true
- [root@clinet1 fdfs]# grep -v '^#' http.conf |grep -v '^$'http.default_content_type = application/octet-streamhttp.mime_types_filename=mime.typeshttp.anti_steal.check_token=falsehttp.anti_steal.token_ttl=900http.anti_steal.secret_key=FastDFS1234567890http.anti_steal.token_check_fail=/home/data/fastdfs/conf/anti-steal.jpg ##路径
- [root@clinet1 fdfs]# grep -v '^#' client.conf |grep -v '^$' connect_timeout=30network_timeout=60base_path=/home/data/fastdfs ##存储路径tracker_server=192.168.43.129:22122 ##tracherip地址和启动端口log_level=infohttp.tracker_server_port=8090 ##这个是tracher的httpd端口 默认是8080
所有配置完成,启动服务 /usr/local/FastDFS/bin/fdfs_storaged /etc/fdfs/storage.conf [root@clinet1 fdfs]# netstat -antp|grep fdfs tcp 0 0 192.168.43.130:8888 0.0.0.0:* LISTEN 12724/fdfs_storaged tcp 0 0 192.168.43.130:23000 0.0.0.0:* LISTEN 12724/fdfs_storaged tcp 0 0 192.168.43.130:54911 192.168.43.129:22122 ESTABLISHED 12724/fdfs_storaged
测试: 在storage服务器里面执行: [root@clinet1 ~]# /usr/local/FastDFS/bin/fdfs_test /etc/fdfs/client.conf upload hello.html This is FastDFS client test program v3.02
Copyright (C) 2008, Happy Fish / YuQing
FastDFS may be copied only under the terms of the GNU General Public License V3, which may be found in the FastDFS source kit. Please visit the FastDFS Home Page for more detail.
[2013-02-28 20:09:30] INFO - base_path=/home/data/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0
tracker_query_storage_store_list_without_group: server 1. group_name=group1, ip_addr=192.168.43.130, port=23000
group_name=group1, ip_addr=192.168.43.130, port=23000 storage_upload_by_filename group_name=group1, remote_filename=M00/00/00/wKgrglEvSPqtBR-EAAAADcvnyC854.html source ip address: 192.168.43.130 file timestamp=2013-02-28 20:09:30 file size=13 file crc32=3420964911 file url: storage_upload_slave_by_filename group_name=group1, remote_filename=M00/00/00/wKgrglEvSPqtBR-EAAAADcvnyC854_big.html source ip address: 192.168.43.130 file timestamp=2013-02-28 20:09:30 file size=13 file crc32=3420964911 file url:
####上述就说明hello.html这个文件已经被上传到192.168.43.129 tracker服务器中 然后使用 即可访问