linux fastdfs安装与配置
时间: 2023-11-22 21:51:00 浏览: 105
以下是Linux FastDFS安装与配置的步骤:
1.下载FastDFS安装包并解压缩:
```shell
wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz
tar -zxvf V5.11.tar.gz
```
2.安装libfastcommon:
```shell
cd fastdfs-5.11/libfastcommon/
./make.sh
./make.sh install
```
3.安装FastDFS:
```shell
cd ../fastdfs/
./make.sh
./make.sh install
```
4.配置Tracker服务器:
```shell
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
vi /etc/fdfs/tracker.conf
```
在tracker.conf中修改base_path和http.server_port参数,例如:
```
base_path=/data/fastdfs/tracker
http.server_port=8080
```
5.配置Storage服务器:
```shell
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
vi /etc/fdfs/storage.conf
```
在storage.conf中修改base_path、store_path0、tracker_server参数,例如:
```
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
tracker_server=192.168.36.100:22122
tracker_server=192.168.36.103:22122
```
6.配置客户端:
```shell
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
vi /etc/fdfs/client.conf
```
在client.conf中修改base_path和tracker_server参数,例如:
```
base_path=/data/fastdfs/client
tracker_server=192.168.36.100:22122
tracker_server=192.168.36.103:22122
```
7.配置Nginx:
```shell
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
vi /usr/local/nginx/conf/nginx.conf
```
在http节点下添加如下配置:
```
location /group1/M00 {
root /data/fastdfs/storage/data;
ngx_fastdfs_module;
}
```
8.启动Tracker和Storage服务器:
```shell
/etc/init.d/fdfs_trackerd start
/etc/init.d/fdfs_storaged start
```
9.测试FastDFS:
```shell
echo "Hello, FastDFS!" > test.txt
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf test.txt
```
以上是Linux FastDFS安装与配置的步骤。
阅读全文