FastDFS (two) installation and use
installation
Install gcc (required when compiling)
yum install -y gcc gcc-c++
Install libevent (runtime requirement)
yum -y install libevent
Install libfastcommon
Libfastcommon is officially provided by FastDFS. Libfastcommon contains some basic libraries needed for FastDFS to run.
Upload libfastcommon-master.zip to /usr
安装解压zip包的命令: yum install -y unzip
解压包: unzip libfastcommon.zip
进入目录: cd libfastcommon-master
Compile
./make.sh
If the permissions of make.sh are insufficient, authorization is required (executable rights)
chmod 777 make.sh
installation
./make.sh install
After libfastcommon is installed, the libfastcommon.so library file will be generated in the /usr/src directory
Install Tracker
tar -zxvf FastDFS_v5.05.tar.gz
cd FastDFS
./make.sh
./make.sh install
Configuration
Tracker configuration
-
tracker.conf file
#端口号 port=22122 #基础目录(Tracker运行时会向此目录存储storage的管理数据)(基础目录不存在的话,需要自行创建 mkdir /home/fastdfs) base_path=/home/fastdfs
Storage configuration
-
storage.conf file
#配置组名 group_name=group1 #端口 port=23000 #向tracker心跳间隔(秒) heart_beat_interval=30 #storage基础目录 #目录不存在,需要自行创建 base_path=/home/fastdfs #store存放文件的位置(store_path) #可以理解一个磁盘一个path,多个磁盘,多个store_path #fdfs_storage目录不存在,需要自行创建 #mkdir /home/fastdfs/fdfs_storage store_path0=/home/fastdfs/fdfs_storage #如果有多个挂载磁盘则定义多个store_path,如下 #store_path1=..... (M01) #store_path2=..... (M02) #配置tracker服务器:IP tracker_server=10.1.220.247:22122 #如果有多个则配置多个tracker #tracker_server=10.1.220.x:22122
Start service
Start tracker
/usr/bin/fdfs_trackerd /usr/FastDFS/conf/tracker.conf restart
Start storage
/usr/bin/fdfs_storaged /usr/FastDFS/conf/storage.conf restart
//切记 如果是云服务器 一定要开启相对应端口
View all running ports
netstat -ntlp