FastDFS安装(ARM同样支持)
一、服务器部署规划
| 服务器IP | 部署服务 |
|---|---|
| 192.168.*. | tracker、storage、nginx |
二、数据存储目录
| 应用 | 目录 |
|---|---|
| fastdfs | /usr/bin |
| nginx | /usr/local/nginx |
| tracker_data | /data/fastdfs/tracker |
| storage_data | /data/fastdfs/storage |
| 安装包 | /home/fastdfs/resources |
三、安装部署
1.基本环境依赖安装
yum install -y zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip wget net-tools
2.libfastcommon 环境部署
[root@ks1 ~]# mkdir -p /home/fastdfs/resources
[root@ks1 ~]# cd /home/fastdfs/resources
[root@ks1 resources]# wget https://github.com/happyfish100/libfastcommon/archive/master.zip
[root@ks1 resources]# unzip master.zip
[root@ks1 resources]# cd libfastcommon-master
[root@ks1 libfastcommon-master]# ./make.sh
[root@ks1 libfastcommon-master]# ./make.sh install
3.fastdfs v5.12安装
[root@ks1 libfastcommon-master]# cd ..
[root@ks1 resources]# rm -rf master.zip
[root@ks1 resources]# wget https://github.com/happyfish100/fastdfs/archive/FastDFS_v5.12.zip
[root@ks1 resources]# unzip FastDFS_v5.12.zip
[root@ks1 resources]# mv FastDFS_v5.12 fastdfs-master
[root@ks1 resources]# cd fastdfs-master
[root@ks1 fastdfs-master]# chmod +x make.sh
[root@ks1 fastdfs-master]# ./make.sh
[root@ks1 fastdfs-master]# ./make.sh install
[root@ks1 fastdfs-master]# cp -ar conf/* /etc/fdfs/
[root@ks1 fastdfs-master]# rm -f /home/fastdfs/resources/FastDFS_v5.12.zip
4.tracker server 配置、启动
[root@ks1 fastdfs-master]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/tracker/g" `grep home/yuqing/fastdfs -rl /etc/fdfs/tracker.conf`
[root@ks1 fastdfs-master]# sed -i "s/use_connection_pool = false/use_connection_pool = true/g" `grep use_connection_pool -rl /etc/fdfs/tracker.conf`
[root@ks1 fastdfs-master]# mkdir -p /data/fastdfs/tracker
[root@ks1 fastdfs-master]# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
- [注意]
ARM服务器上搭建Fastdfs和X86一样的安装包和安装步骤,唯一注意的是修改这两个参数,如果不修改trackerd和storage会一直起不来。
1.tracker配置文件tracker.conf
thread_stack_size = 128KB
2.storage配置文件storage.conf
thread_stack_size=1024KB
检查tracker server 是否启动成功
[root@ks1 resources]# ps -ef | grep fdfs_trackerd
root 1117 1 0 08:54 ? 00:00:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
root 2417 1389 0 09:33 pts/0 00:00:00 grep --color=auto fdfs_trackerd
5.storage server 配置、启动
[root@ks1 fastdfs-master]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/storage/g" `grep home/yuqing/fastdfs -rl /etc/fdfs/storage.conf`
[root@ks1 fastdfs-master]# vim /etc/fdfs/storage.conf
里面自带的一个tracker_server 把注释
tracker_server=192.168.**.**:22122
[root@ks1 fastdfs-master]# mkdir -p /data/fastdfs/storage
[root@ks1 fastdfs-master]# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
## 注意 storage.conf 文件一定要放到 /etc/fdfs/下 不然异常 异常如下
[root@localhost conf]# /usr/bin/fdfs_storaged ./storage.conf start
[root@localhost conf]# [2022-04-01 10:33:30] ERROR - file: shared_func.c, line: 968, file /./storage.conf not exist
[2022-04-01 10:33:30] ERROR - file: storage_func.c, line: 1087, load conf file "./storage.conf" fail, ret code: 2
[2022-04-01 10:33:30] CRIT - exit abnormally!
检查storage server是否开启成功
[root@ks1 resources]# ps -ef | grep fdfs_storage
root 1120 1 0 08:54 ? 00:00:01 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
root 2510 1389 0 09:39 pts/0 00:00:00 grep --color=auto fdfs_storage
[root@ks1 resources]#
四、文件上传测试
1.修改tracker server 服务器客户端配置文件
[root@ks1 fastdfs-master]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/client/g" `grep home/yuqing/fastdfs -rl /etc/fdfs/client.conf`
[root@ks1 fastdfs-master]# vim /etc/fdfs/client.conf
tracker_server=192.168.**.**:22122
mkdir -p /data/fastdfs/client
2.执行文件上传命令
[root@ks1 fastdfs-master]# cd /tmp
[root@ks1 tmp]# echo "123" > test.txt
[root@ks1 tmp]# fdfs_test /etc/fdfs/client.conf upload test.txt
This is FastDFS client test program v5.12
Copyright (C) 2008, Happy Fish / YuQing
FastDFS may be copied only under the terms of the GNU General
Public License V3, which may be found in the FastDFS source kit.
Please visit the FastDFS Home Page http://www.csource.org/
for more detail.
[2021-06-10 09:43:51] DEBUG - base_path=/data/fastdfs/client, connect_timeout=30, network_timeout=60, tracker_server_count=2, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0
.......
五、安装fastdfs-nginx-module
[root@ks1 tmp]# cd /usr/local/src
[root@ks1 src]# wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
[root@ks1 src]# tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
[root@ks1 src]# rm -f fastdfs-nginx-module_v1.16.tar.gz
[root@ks1 src]# cd fastdfs-nginx-module/src
[root@ks1 src]# vim config
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib64 -lfastcommon -lfdfsclient"
[root@ks1 src]# sed -i "s/home\/yuqing\/fastdfs/data\/fastdfs\/storage/g" `grep home/yuqing/fastdfs -rl mod_fastdfs.conf`
[root@ks1 src]# sed -i "s/tmp/data\/fastdfs\/storage/g" `grep tmp -rl mod_fastdfs.conf`
[root@ks1 src]# sed -i "s/false/true/g" `grep url_have_group_name -rl mod_fastdfs.conf`
[root@ks1 src]# vim mod_fastdfs.conf
tracker_server=192.168.**.**:22122
[group1]
group_name=group1
storage_server_port=23000
store_path_count=2
store_path0=/data/fastdfs/storage
[root@ks1 src]# cp mod_fastdfs.conf /etc/fdfs
[root@ks1 src]# ln -s /data/fastdfs/storage/data/ /data/fastdfs/storage/data/M00
切记 我们把mod_fastdfs.conf 复制到/ect/fdfa下,一定要修改/etc/fdfs/mod_fastdfs.conf下面的地址(修改成自己的地址)
vim /etc/fdfs/
tracker_server=192.168.**.**:22122
六、nginx安装、配置
1.解压ngx_cache_purge-2.3模块
[root@ks1 src]# cd /usr/local/src
[root@ks1 src]# wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
[root@ks1 src]# tar -zxvf ngx_cache_purge-2.3.tar.gz
[root@ks1 src]# rm -f ngx_cache_purge-2.3.tar.gz
2.nginx编译安装
[root@ks1 src]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[root@ks1 src]# tar -zxvf nginx-1.8.0.tar.gz
[root@ks1 src]# rm -f nginx-1.8.0.tar.gz
[root@ks1 src]# cd nginx-1.8.0
[root@ks1 nginx-1.8.0]# useradd -s /sbin/nologin nginx
[root@ks1 nginx-1.8.0]# ./configure --user=nginx --group=nginx --add-module=/usr/local/src/ngx_cache_purge-2.3 --add-module=/usr/local/src/fastdfs-nginx-module/src --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
[root@ks1 nginx-1.8.0]# make
[root@ks1 nginx-1.8.0]# make install
[root@ks1 nginx-1.8.0]# cd /usr/local/nginx/conf
[root@ks1 conf]# mkdir -p /var/cache/nginx/proxy_cache
3.配置文件修改()
[root@ks1 conf]# vim nginx.conf
worker_processes 1;
error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 300m;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_cache_path /var/cache/nginx/proxy_cache levels=1:2
keys_zone=http-cache:500m max_size=10g inactive=30d use_temp_path=off;
proxy_temp_path /var/cache/nginx/proxy_cache/tmp;
upstream storage_server_group1{
server 192.168.**.**:8080;
}
server {
listen 80;
server_name 192.168.**.**;
location /group1{
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream http_502 http_504 error timeout invalid_header;
# proxy_cache http-cache;
# proxy_cache_valid 200 304 12h;
# proxy_cache_key $uri$is_args$args;
proxy_pass http://storage_server_group1;
expires 30d;
}
location ~/purge(/.*) {
allow 192.168.**.**;
#allow 192.168.**.**;
#allow 192.168.**.**;
deny all;
# proxy_cache_purge http-cache $1$is_args$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8080;
server_name localhost 192.168.**.**;
location / {
root html;
index index.html index.html;
}
location /group1/M00/{
root /storage/fdfs/storage-data;
ngx_fastdfs_module
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
4.nginx启动
[root@ks1 conf]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
[root@ks1 conf]# netstat -npl | grep -E "nginx|fdfs"
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1147/nginx: master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1147/nginx: master
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 1120/fdfs_storaged
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 1117/fdfs_trackerd
5.fs自启动
[root@ks1 conf]# vim /etc/rc.d/rc.local
# fastdfs
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
# nginx
/usr/local/nginx/sbin/nginx
[root@ks1 conf]# chmod +x /etc/rc.d/rc.local
6.浏览器验证
http://192.168.**.**/group1/M00/00/00/wKgFgWDBeECAOzbKAAAABFqCAvc968_big.txt
FastDFS安装(ARM同样支持)的更多相关文章
- FastDFS 安装及使用
FastDFS 安装及使用 2012-11-17 13:10:31| 分类: Linux|举报|字号 订阅 Google了一下,流行的开源分布式文件系统有很多,介绍如下: mogileF ...
- FastDFS安装配置手册
文件服务器分布式系统安装手册 本文档详细的介绍了FastDFS的最小集群安装过程.集群环境如下: tracker:20.2.64.133 .用于调度工作,在访问上起负载均衡的作用. group1: s ...
- Ubuntu安装ARM架构GCC工具链(ubuntu install ARM toolchain)最简单办法
一.安装ARM-Linux-GCC工具链 只需要一句命令: sudo apt-get install gcc-arm-linux-gnueabi 前提是你的Ubuntu系统版本是官网支持的最新的版本, ...
- 【转】Ubuntu安装ARM架构GCC工具链(ubuntu install ARM toolchain)最简单办法
原文网址:http://www.cnblogs.com/muyun/p/3370996.html 一.安装ARM-Linux-GCC工具链 只需要一句命令: sudo apt-get install ...
- FastDFS安装、配置、部署(一)-安装和部署 (转)
FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站 Fast ...
- fastdfs安装过程
Fastdfs于centos7的安装步骤(支持横向拓展) 主要目的:根据网上教程搭建时遇到的问题以及描述不明确的地方进行补充和说明 一.首先需要准备以下4个文件 nginx-1.12.0.tar.gz ...
- FastDFS学习总结(1)--FastDFS安装和部署
FastDFS是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,FastDFS非常适用于基于文件服务的站点,例如图片分享和视频分享网站 Fast ...
- Genymotion模拟器安装ARM架构编译应用失败解决方案
我们在安装一些应用到Genymotion模拟器会提示:adb: failed to install xx.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: ...
- linux环境下安装sphinx中文支持分词搜索(coreseek+mmseg)
linux环境下安装sphinx中文支持分词搜索(coreseek+mmseg) 2013-11-10 16:51:14 分类: 系统运维 为什么要写这篇文章? 答:通过常规的三大步(./confi ...
- Ubuntu 上安装 Freemind 并支持中文
Ubuntu 上安装 Freemind 并支持中文 JAVA 运行时 Freemind 是一个使用 Java 编写的思维导图工具,在安装时,需要到 Java 运行时(使用 OpenJRE 或 Orac ...
随机推荐
- nginx: the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf
Nginx如果未开启SSL模块,配置Https时将提示如题错误 原因:nginx缺少http_ssl_module模块,编译安装的时候带上--with-http_ssl_module配置就行了,但是现 ...
- 吴恩达老师机器学习课程chapter04——神经网络
吴恩达老师机器学习课程chapter04--神经网络 本文是非计算机专业新手的自学笔记,高手勿喷,欢迎指正与其他任何合理交流. 本文仅作速查备忘之用,对应吴恩达(AndrewNg)老师的机器学期课程第 ...
- Python学习笔记文件读写之遍历目录树
随笔记录方便自己和同路人查阅. #------------------------------------------------我是可耻的分割线--------------------------- ...
- C语言学习--指针函数与函数指针
#include<stdio.h> #include<string.h> //指针函数: 是一个函数, 但是这个函数的返回值类型是一个指针 //函数指针: 是一个指针, 这个指 ...
- ElementUI实现手动上传
在做项目中,与同事遇到问题,顺手记录一下 <template> <div class="common-layout"> <el-button size ...
- 【SQL Server】获取表格插入的id(二)——newID()
现在有一个需求,插入api调用日志表.然后,发起HTTP请求()请求时,需要带入日志表的id). 简化无关的添加,SQL Server表格设计如下: CREATE TABLE mylog ( id I ...
- 计算机意外地重新启动或遇到错误windows安装无法继续解决方法
计算机意外地重新启动或遇到错误windows安装无法继续解决步骤如下: 当win10在安装过程中一直卡在"海内存知己,天涯若比邻"时同样实用 解决方法: 按住shift+f10(或 ...
- holiday09
第九天 ping # 检测目标主机是否连接正常 $ ping IP地址 # 检测本地网卡工作正常 $ ping 127.0.0.1 ping 一般用于检测当前计算机到目标计算机之间的网络 是否通畅,数 ...
- 逆向学习物联网-网关W5500-00课程目的
- Django基础篇 02- request常用属性和返回的响应类型、pycharm创建django项目
一.request常用属性 #django 请求对象里面的一些属性 print(request.method)#请求方式 print(request.body) #请求体 print(request. ...