07.Linux系统-Fastdfs分布式文件系统-互为主从配置搭建部署

亦碎流年 2019-12-05

Fastdfs分布式文件系统-互为主从配置部署

1.安装基础依赖

yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel unzip

2.下载安装 libfastcommon

wget https://github.com/happyfish100/libfastcommon/archive/master.zip

3.解压安装

unzip master.zip
cd libfastcommon-master
./make.sh && ./make.sh install

4.下载安装V5.08.zip

wget https://github.com/happyfish100/fastdfs/archive/V5.08.zip

5.解压安装

unzip V5.08.zip
cd fastdfs-5.08
./make.sh && ./make.sh install

6.备份配置文件

cd /etc/fdfs
cp client.conf.sample client.conf
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf

7.修改配置文件storage.conf,client.conf,tracker.conf

vim storage.conf
bind_addr=0.0.0.0              (可默认为空)
base_path=/home/yuqing/fastdfs       (可自行修改路径,确保路径存在,子路径会自动生成)
store_path0=/home/yuqing/fastdfs      (可自行修改路径,确保路径存在,子路径会自动生成)
tracker_server=xx.xx.xx.xx:22122      (可多个server)

vim client.conf
base_path=/home/yuqing/fastdfs       (可自行修改路径,确保路径存在,子路径会自动生成)
tracker_server=xx.xx.xx.xx:22122      (同storage.conf中的sever)

vim tracker.conf
reserved_storage_space=5GB

8.创建数据和日志路径

mkdir -p /home/yuqing/fastdfs

9.开放22122端口和23000端口(启动相关服务)

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf

10.上传文件测试

/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /master.zip

互为主从搭建只需在另一台机器上安装相同版本fastdfs即可
安装完后可scp -r /etc/fdfs :/etc 覆盖配置文件即保证两边机器配置文件相同
注:如果报错可修改配置文件权限为777重启即可

 

 

相关推荐