1、下载:
wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.14-stable.tar.gz
wget http://fastdfs.googlecode.com/files/FastDFS_v3.02.tar.gz
rpm -qa|grep libevent ##检查是否已经安装libevent,如果安装,请卸载
2、安装
# tar -zxvf libevent-2.0.14-stable.tar.gz
# cd libevent-2.0.14-stable
# ./configure –prefix=/usr/local/libevent
# make && make install
# tar -zxvf FastDFS_v3.02.tar.gz
# cd FastDFS
# vi make.sh #编辑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/include LIBRARY_PATH=/usr/local/libevent/lib
# ./make.sh install
安装完毕(不管是安装tracker服务器还是storage服务器服务器,都需要执行上面的安装步骤,只是在启动的时候方式不一样)。
3、配置
配置启动tracker服务器(服务器IP:192.168.1.100):
# vi /etc/fdfs/tracker.conf(红色标注的地方需要修改:bind_addr后面填上本服务器IP地址,base_path填写文件存放的目录)
disabled=false
bind_addr=192.168.1.100
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
保存退出
启动tracker服务器
第一次启动前要做的准备工作
# mkdir -p /home/data/fastdfs(建立FastDFS文件存放目录)
# echo '/usr/local/libevent/include/' >> /etc/ld.so.conf
# echo '/usr/local/libevent/lib/' >> /etc/ld.so.conf
# ldconfig
# /usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf(启动tracker服务器)
查看服务是否启动:
ps -ef |grep track
netstat -ntpl |grep fdfs
可以通过如上2个命令查看服务是否启动和端口是否启用
配置启用storage服务器(服务器IP:192.168.1.101):
# vi /etc/fdfs/storage.conf(红色标注的地方需要修改:bind_addr后面填上本服务器IP地址,base_path填写文件存放的目录,store_path0填写文件存放的目录,tracker_server填写tracker服务器的IP和端口)
disabled=false
group_name=group1
bind_addr=192.168.1.101
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.1.100: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
保存退出
启动storage服务器
第一次启动前要做的准备工作
# mkdir -p /home/data/fastdfs(建立FastDFS文件存放目录)
# echo '/usr/local/libevent/include/' >> /etc/ld.so.conf
# echo '/usr/local/libevent/lib/' >> /etc/ld.so.conf
# ldconfig
# /usr/local/FastDFS/bin/fdfs_trackerd /etc/fdfs/tracker.conf(启动tracker服务器)
转载请注明:IT运维空间 » linux » 安装FastDFS文件系统
发表评论