注:我只安装了一个tranker 和 一个storage
http://www.cnblogs.com/fish-king/archive/2013/03/14/2960441.html
//系统文章介绍fastdfs 的
http://www.cnblogs.com/chinacloud/category/274364.html
fastdfs 部署
1. 下载fastdfs 安装包
2. ftp 上传 到 usr/local
3. 解压缩 tar -zxv FastDFS_v4.06.tar.gz
4. 安装libenvent
wget --no-check-certificate https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xzf libevent-2.0.21-stable.tar.gz
./configure --prefix=/usr
make clean;
make
sudo make install
5.编译安装 fastdfs
#step 3. make all
./make.sh
#step 4. make install
./make.sh install
6. 修改配置文件(默认配置文件在路径/etc/fdfs 目录下 ),tracker 可以使用默认配置
默认使用22122 端口
#启动Tracker Server
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
#启动过程中出现的错误(成功安装libevent 就不会出现这个问题)
#./fdfs_trackerd: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
#解决办法
ln -s /usr/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
7.创建日志及data的存储路径
#软件安装包存储:
/usr/local/src
/etc/fdfs/* #tracker,storage ·· 配置文件所在目录
#基本目录列表:
/home/fastdfs/tracker #创建tracker目录保存运行日志
/home/fastdfs/fdfs_storage #创建Storage目录保存运行日志及其data数据
mkdir -p /home/fastdfs/tracker;
mkdir -p /home/fastdfs/fdfs_storage;
8. 加入到开机启动
# vim /etc/rc.d/rc.local (我使用ftp方式修改)
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
9. 修改iptables
vim /etc/sysconfig/iptables
#加入下面的配置
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22122 -j ACCEPT
#重启iptables
service iptables restart
10. telnet 看是否启动成功
telent 192.168.13.217 22122
也可以在日志文件中看是否启动成功
日志在我们设置的目录 /home/fastdfs/tracker 目录下
11. 安装 storage(过程和上面类似,主要storage.conf 的tracker 的配置)
#修改storage.conf配置
vim /etc/fdfs/storage.conf
# the name of the group this storage server belongs to
group_name=group1 ->group_name=group2
# the name of the group this storage server belongs to
# the storage server port #the storage server port
port=23000
# the base path to store data and log files #日志目录
base_path=/home/yuqing/fastdfs -> /home/fastdfs/fdfs_storage
# store_path#, based 0, if store_path0 not exists, it's value is base_path #data数据存储目录
# the paths must be exist
store_path0=/home/fastdfs/fdfs_storage
# 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 -> tracker_server=192.168.127.11:22122
#启动storage Server
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
#接下来会出现很多mkdir data path,这是系统在创建数据目录
data path: /home/fastdfs/fdfs_storage/data, mkdir sub dir...
mkdir data path: 00 ...
mkdir data path: 01 ...
mkdir data path: 02 ...
mkdir data path: 03 ...
.......................
data path: /home/fastdfs/fdfs_storage/data, mkdir sub dir done.
#启动成功,加入开机启动
# vim /etc/rc.d/rc.local
/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
启动完成后可以 telnet 192.168.13.218 23000 (iptables 开放23000端口) 看服务是否启动
日志在 /home/fastdfs/fdfs_storage 目录下
12.6. 如何重启server进程?
可以kill掉server进程后,执行启动命令行。如:
killall fdfs_trackerd
/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
或者直接使用FastDFS自带的restart.sh脚本,如:
重启tracker
/usr/local/bin/restart.sh /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
重启storage
/usr/local/bin/restart.sh /usr/local/bin/fdfs_storated /etc/fdfs/storage.conf