Linux之FastDFS安装

FastDFS安装

1. 安装依赖库

yum install gcc libevent libevent-devel -y

2. 安装libfastcommon 库

libfastcommon 库是 FastDFS 文件系统运行需要的公共 C 语言函数库

2.1 下载地址:

https://github.com/happyfish100/libfastcommon/tree/V1.0.36 【注意版本】

2.2 解压:

unzip libfastcommon-1.0.36.zip

2.3 编译:

./make.sh

2.4 安装:

./make.sh install

3. 安装fastDFS

3.1 下载地址:

https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz 【注意版本】

3.2 解压:

tar -zxvf fastdfs-5.11.tar.gz

3.3 编译:

./make.sh

3.4 安装:

./make.sh install

4. 检查编译安装后的文件

ll /usr/bin/fdfs*

ll /etc/fdfs/

cd /survey/storeSoftware/fastDFS/fastdfs-5.11/conf
执行:
cp http.conf /etc/fdfs/
cp mime.types /etc/fdfs/

5. FastDFS配置

5.1 删除/etc/fdfs/目录下配置文件的后缀名.sample的文件

5.2 修改tracker.conf文件  【配置文件中不要出现中文】

vim /survey/storeSoftware/fastDFS/fastdfs-5.11/conf/tracker.conf

//文件末尾添加如下内容
base_path=/opt/fastdfs/tracker              【#配置tracker存储数据的目录,需要手动创建】

5.3 修改storage.conf文件

复制代码
vim /survey/storeSoftware/fastDFS/fastdfs-5.11/conf/storage.conf

//文件末尾添加如下内容
base_path=/opt/fastdfs/storage
store_path_count=1
store_path0=/opt/fastdfs/storage/files
tracker_server=192.168.95.128:22122    【不能使用127.0.0.1:22122, 注意把默认的tracker_server设置注释掉】
复制代码

5.4 拷贝配置文件并创建目录

cp  /survey/storeSoftware/fastDFS/fastdfs-5.11/conf/tracker.conf  /survey/storeSoftware/fastDFS/fastdfs-5.11/conf/storage.conf  /etc/fdfs/

创建目录:
/opt/fastdfs/tracker       /opt/fastdfs/storage        /opt/fastdfs/storage/files

6. 启动FastDFS

6.1 启动tracker服务 【任意目录执行】

fdfs_trackerd /etc/fdfs/tracker.conf

6.2 启动storage服务

fdfs_storaged /etc/fdfs/storage.conf

6.3 查看storage是否已经注册到了tracker下

fdfs_monitor /etc/fdfs/storage.conf

7. FastDFS重启和关闭

fdfs_trackerd /etc/fdfs/tracker.conf restart               
fdfs_storaged /etc/fdfs/storage.conf restart
fdfs_trackerd /etc/fdfs/tracker.conf stop
fdfs_storaged /etc/fdfs/storage.conf stop

8. 使用fdfs_test进行测试

复制代码
vim /survey/storeSoftware/fastDFS/fastdfs-5.11/conf/client.conf      //文件末尾添加如下内容
base_path=/opt/fastdfs/client         # 存放日志的目录,需要手动创建
tracker_server=192.168.179.128:22122          【不能使用127.0.0.1:22122, 注意把默认的tracker_server设置注释掉】
cp  /survey/storeSoftware/fastDFS/fastdfs-5.11/conf/client.conf  /etc/fdfs/
创建测试文件:
touch testfile.txt
fdfs_test /etc/fdfs/client.conf upload testfile.txt
复制代码

posted @ 2022-10-08 13:46  liubingPersonalBlog  阅读(22)  评论(0)    收藏  举报