介绍下fastdfs在rhel上的部署过程

下面将介绍下fastdfs在rhel上的部署过程
tracker服务器:192.168.123.110/24
storage服务器:192.168.123.20/24
一:编译安装
# wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.14
-stable.tar.gz
# tar -zxvpf libevent-2.0.14-stable.tar.gz
# cd libevent-2.0.14-stable
# ./configure --prefix=/usr/local/libevent-2.0.14 &&
make && make install
# wget http://fastdfs.googlecode.com/files/FastDFS_v3.02.tar.gz
# tar -zxvf FastDFS_v3.02.tar.gz
# cd FastDFS
# grep -A 4 '/usr/local/FastDFS' make.sh
TARGET_PREFIX=/usr/local/FastDFS
TARGET_CONF_PATH=/etc/fdfs
WITH_HTTPD=1
WITH_LINUX_SERVICE=1
# ./make.sh C_INCLUDE_PATH=/usr/local/libevent-2.0.14/include
LIBRARY_PATH=/usr/local/libevent-2.0.14/lib
# ./make.sh install
# ls /etc/fdfs/
client.conf http.conf mime.types storage.conf tracker.conf
二:tracker配置文件
# grep -v '^#' /etc/fdfs/tracker.conf |grep -v '^$'
disabled=false
bind_addr=192.168.123.110
port=22122
connect_timeout=30
network_timeout=60
base_path=/home/data/fastdfs
max_connections=256
work_threads=4
store_lookup=2
store_group=group2
store_server=0
store_path=0
download_server=0
reserved_storage_space = 4GB
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
http.disabled=false
http.server_port=8080
http.check_alive_interval=30
http.check_alive_type=tcp
http.check_alive_uri=/status.html
http.need_find_content_type=true

# grep -v '^#' /etc/fdfs/http.conf |grep -v '^$'
http.default_content_type = application/octet-stream
http.mime_types_filename=/etc/fdfs/mime.types
http.anti_steal.check_token=false
http.anti_steal.token_ttl=900
http.anti_steal.secret_key=FastDFS1234567890
http.anti_steal.token_check_fail=/home/data/fastdfs/conf/anti-steal.jpg
三:启动tracker服务,需要注意tracker.conf文件最后一行为#include httpd.conf
# /usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/local/FastDFS/bin/fdfs_trackerd: error while loading shared libraries: libevent-
2.0.so.5: cannot open shared object file: No such file or directory
# echo '/usr/local/libevent-2.0.14/include/' >> /etc/ld.so.conf
# echo '/usr/local/libevent-2.0.14/lib/' >> /etc/ld.so.conf
# ldconfig
# /usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf
[2012-07-04 17:52:25] ERROR - file: tracker_func.c, line: 160, "/home/data/fastdfs"
can't be accessed, error info: No such file or directory
# mkdir -p /home/data/fastdfs
# /usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf
# echo $?
22
# cat /home/data/fastdfs/logs/trackerd.log
[2012-07-04 17:52:50] ERROR - file: ../common/fdfs_http_shared.c, line: 128, param
"http.mime_types_filename" not exist or is empty
# tail -1 /etc/fdfs/tracker.conf
#include http.conf
# /usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf
# echo $?
0
# ps -ef |grep track
root 3535 1 0 15:47 ? 00:00:00 /usr/local/FastDFS/bin/fdfs_trackerd
/etc/fdfs/tracker.conf

# netstat -ntpl |grep fdfs
tcp 0 0 192.168.123.110:22122 0.0.0.0:* LISTEN
3535/fdfs_trackerd
tcp 0 0 192.168.123.110:8080 0.0.0.0:* LISTEN
3535/fdfs_trackerd
四:storage配置文件
# grep -v '^#' /etc/fdfs/storage.conf |grep -v '^$'
disabled=false
group_name=group1
bind_addr=192.168.123.20
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/home/data/fastdfs
max_connections=256
buff_size = 256KB
work_threads=4
disk_rw_separated = true
disk_rw_direct = false
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
store_path0=/home/data/fastdfs
subdir_count_per_path=256
tracker_server=192.168.123.110:22122
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
key_namespace=FastDFS
keep_alive=0
http.disabled=false
httphttp.domain_name=
http.server_port=8888
http.trunk_size=256KB
http.need_find_content_type=true

# grep -v '^#' /etc/fdfs/client.conf |grep -v '^$'
connect_timeout=30
network_timeout=60
base_path=/home/data/fastdfs
tracker_server=192.168.123.110:22122
log_level=info
http.tracker_server_port=8080

# grep -v '^#' /etc/fdfs/http.conf |grep -v '^$'
http.default_content_type = application/octet-stream
http.mime_types_filename=mime.types
http.anti_steal.check_token=false
http.anti_steal.token_ttl=900
http.anti_steal.secret_key=FastDFS1234567890
http.anti_steal.token_check_fail=/home/data/fastdfs/conf/anti-steal.jpg
五:启动storage,需要注意storage.conf文件最后一行为#include httpd.conf
# mkdir -p /home/data/fastdfs
# echo '/usr/local/libevent-2.0.14/include/' >> /etc/ld.so.conf
# echo '/usr/local/libevent-2.0.14/lib/' >> /etc/ld.so.conf
# ldconfig

# tail -2 /etc/fdfs/storage.conf
#use "#include" directive to include HTTP other settings
#include http.conf

# /usr/local/FastFDS/bin/fdfs_storaged /etc/fdfs/storage.conf
mkdir data path: 00 ...
mkdir data path: 01 ...
mkdir data path: 02 ...
———输出省略————
data path: /home/data/fastdfs/data, mkdir sub dir done.

# ps -ef |grep fdfs
root 14451 1 0 16:15 ? 00:00:00 /usr/local/FastFDS/bin/fdfs_storaged
/etc/fdfs/storage.conf
root 14468 8238 0 16:16 pts/1 00:00:00 grep fdfs

# netstat -ntpl |grep fdfs
tcp 0 0 192.168.123.20:8888 0.0.0.0:* LISTEN
14451/fdfs_storaged
tcp 0 0 192.168.123.20:23000 0.0.0.0:* LISTEN
14451/fdfs_storaged
五:测试文件上传
# /usr/local/FastFDS/bin/fdfs_test /etc/fdfs/client.conf upload /etc/passwd
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 http://www.csource.org/
for more detail.
[2012-07-30 16:25:59] 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.123.20, port=23000 group_name=group1, ip_addr=192.168.123.20, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKh7FFAWRRfcMOGtAAAHKBGhZhE8065783
source ip address: 192.168.123.20
file timestamp=2012-07-30 16:25:59
file size=1832
file crc32=295790097
file url: http://192.168.123.110:8080/group1/M00/00/00/wKh7FFAWRRfcMOGtAAAHKBGhZhE8065783
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKh7FFAWRRfcMOGtAAAHKBGhZhE8065783_big
source ip address: 192.168.123.20
file timestamp=2012-07-30 16:25:59
file size=1832
file crc32=295790097
file url: http://192.168.123.110:8080/group1/M00/00/00/wKh7FFAWRRfcMOGtAAAHKBGhZhE8065783_big
# /usr/local/FastFDS/bin/fdfs_test /etc/fdfs/client.conf upload 2.jpg
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 http://www.csource.org/
for more detail.
[2012-07-30 16:29:22] 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.123.20, port=23000 group_name=group1, ip_addr=192.168.123.20, port=23000
storage_upload_by_filename
group_name=group1, remote_filename=M00/00/00/wKh7FFAWReLzPs4sAAEYquSDGwc472.jpg
source ip address: 192.168.123.20
file timestamp=2012-07-30 16:29:22
file size=71850
file crc32=3833797383
file url: http://192.168.123.110:8080/group1/M00/00/00/wKh7FFAWReLzPs4sAAEYquSDGwc472.jpg
storage_upload_slave_by_filename
group_name=group1, remote_filename=M00/00/00/wKh7FFAWReLzPs4sAAEYquSDGwc472_big.jpg
source ip address: 192.168.123.20
file timestamp=2012-07-30 16:29:22
file size=71850
file crc32=3833797383
file url: http://192.168.123.110:8080/group1/M00/00/00/wKh7FFAWReLzPs4sAAEYquSDGwc472_big.jpg
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值