Centos7 FastDFS 安装和配置启动

版权声明:原创文章欢迎转载,不过要记得加出处哦 https://blog.csdn.net/wljk506/article/details/82533543

安装 Centos7

配置IP

https://blog.csdn.net/fenglailea/article/details/12191607
根据上面案例配置出IP和DNS

vim /etc/sysconfig/network-scripts/ifcfg-eth0

部分内容改动为下面的

BOOTPROTO=static
IPV6INIT=no
ONBOOT=yes
IPADDR=192.168.125.132
GATEWAY=192.168.125.1
NETMASK=255.255.255.0
PREFIX=24
DNS1=114.114.114.114
DNS2=8.8.8.8

关闭防火墙

这里是内网测试,所以不涉及到安全问题,这里防火墙全部关闭

systemctl stop firewalld            #关闭
systemctl disable firewalld         #开机禁用

基础安装

yum -y update
yum -y install make cmake gcc gcc-c++ wget

下载软件

下载地址
https://github.com/happyfish100/fastdfs/releases
https://github.com/happyfish100/libfastcommon/releases

cd ~
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.39.tar.gz -O libfastcommon.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz -O fastdfs.tar.gz

安装 libfastcommon

cd ~
tar -zxvf libfastcommon.tar.gz
cd libfastcommon-1.0.39
#编译
./make.sh
./make.sh install 

安装 fastdfs

cd ~
tar -zxvf fastdfs.tar.gz 
cd fastdfs-5.11
#编译
./make.sh
./make.sh install 

查看脚本文件

ls /etc/init.d/ | grep fdfs

输出

fdfs_storaged
fdfs_trackerd

命令行工具在/usr/bin/目录下

ls /usr/bin/ | grep fdfs

输出

fdfs_appender_test
fdfs_appender_test1
fdfs_append_file
fdfs_crc32
fdfs_delete_file
fdfs_download_file
fdfs_file_info
fdfs_monitor
fdfs_storaged
fdfs_test
fdfs_test1
fdfs_trackerd
fdfs_upload_appender
fdfs_upload_file

配置文件

ls /etc/fdfs/

输出

client.conf.sample  storage.conf.sample  storage_ids.conf.sample  tracker.conf.sample

配置跟踪器 trackerd

修改配置文件

cd /etc/fdfs/
#复制配置文件
cp tracker.conf.sample tracker.conf
# 编辑
vim /etc/fdfs/tracker.conf

修改配置文件中的base_path

base_path=/fastdfs/tracker

创建目录

mkdir -p /fastdfs/tracker

fastdfs 相关命令

停止tracker:/etc/init.d/fdfs_trackerd stop
启动tracker:/etc/init.d/fdfs_trackerd start
#
查看目录下文件数:cd /fastdfs/tracker/ && ll
查看进程:ps -el | grep fdfs

启动 fastdfs

启动前查看

cd /fastdfs/tracker/ && ll

启动

/etc/init.d/fdfs_trackerd start

查看

cd /fastdfs/tracker/ && ll

输出

total 0
drwxr-xr-x. 2 root root 83 Sep  8 21:40 data
drwxr-xr-x. 2 root root 26 Sep  8 21:39 logs

表示 启动成功

设置开机启动

配置FastDFS存储 storaged

修改配置文件

cd /etc/fdfs/
cp storage.conf.sample storage.conf
#编辑
vim /etc/fdfs/storage.conf

其中的内容修改为

base_path=/fastdfs/storage
store_path0=/fastdfs/storage
tracker_server=192.168.1.1:22122
http.server_port=80

创建存储目录

mkdir -p /fastdfs/storage

启动存储(storage)

/etc/init.d/fdfs_storaged start

查看是否启动成功

ps -ef | grep fdfs

输出

root     11331     1  0 21:39 ?        00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
root     11382     1  0 21:45 ?        00:00:00 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf

表示启动成功

来自
http://binux.cn/2017/03/05/FastDFS-Install/

猜你喜欢

转载自blog.csdn.net/wljk506/article/details/82533543