linux下安装和配置fastdfs
时间: 2023-11-14 14:06:15 浏览: 50
FastDFS是一个开源的轻量级分布式文件系统,可以用于存储大文件,支持文件上传、下载和删除等操作。下面是在Linux下安装和配置FastDFS的步骤:
1. 安装libfastcommon
```
$ git clone https://github.com/happyfish100/libfastcommon.git
$ cd libfastcommon/
$ ./make.sh
$ ./make.sh install
```
2. 安装FastDFS
```
$ git clone https://github.com/happyfish100/fastdfs.git
$ cd fastdfs/
$ ./make.sh
$ ./make.sh install
```
3. 配置Tracker服务器
在/etc/fdfs目录下创建tracker目录,并在该目录下创建tracker.conf文件,内容如下:
```
#bind_addr= # bind to all IP addresses
port=22122
# base_path=/home/yuqing/fastdfs/tracker # the base storage path for storing data and logs
# store_group=group1,group2 # the group name list that can be used in this tracker server
# group_name=group1 # the group name of this tracker server
```
4. 配置Storage服务器
在/etc/fdfs目录下创建storage目录,并在该目录下创建storage.conf文件,内容如下:
```
#base_path=/home/yuqing/fastdfs/storage # the base storage path for storing data and logs
#store_path0=/home/yuqing/fastdfs/storage # the first storage path for storing data
tracker_server=192.168.1.100:22122
#group_name=group1 # the group name of this storage server
#http.server_port=8888 # the port that the HTTP server listens on
```
其中,tracker_server为Tracker服务器的IP和端口号。
5. 启动Tracker和Storage服务器
启动Tracker服务器:
```
$ /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
```
启动Storage服务器:
```
$ /usr/bin/fdfs_storaged /etc/fdfs/storage.conf
```
6. 测试上传和下载文件
上传文件:
```
$ /usr/bin/fdfs_upload_file /etc/fdfs/client.conf test.jpg
```
下载文件:
```
$ /usr/bin/fdfs_download_file /etc/fdfs/client.conf group1 M00/00/00/test.jpg /tmp/test.jpg
```
其中,group1为存储文件的组名,M00/00/00/test.jpg为文件的路径和文件名。
以上就是在Linux下安装和配置FastDFS的全部步骤。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)