一,下载 fastdfs6.06

1,官方地址

https://github.com/happyfish100

2,说明:当前版本:共3个子模块

fastdfs v6.06
libfastcommon v1.0.43
fastdfs-nginx-module v 1.22

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

对应的源码可以访问这里获取: https://github.com/liuhongdi/

说明:作者:刘宏缔 邮箱: 371125307@qq.com

3,下载

[root@localhost source]# wget https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz
[root@localhost source]# wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz
[root@localhost source]# wget https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz

二,下载nginx

1,官网地址:

http://nginx.org/

2,下载nginx

[root@localhost source]# wget http://nginx.org/download/nginx-1.17.8.tar.gz

三,安装fastdfs所需的程序包

[root@localhost dest]# yum install gcc gcc-c++
[root@localhost dest]# yum install libtool zlib zlib-devel openssl openssl-devel
[root@localhost dest]# yum -y install pcre pcre-devel libevent libevent-devel perl unzip net-tools wget

说明:在fastdfs的编译安装时会用到这些包,避免编译时出现报错

四,libfastcommon的安装

1,解压libfastcommon的压缩包

 [root@localhost source]# tar -zxvf V1.0.43.tar.gz

2, 编译并安装

[root@localhost source]# cd libfastcommon-1.0.43/
[root@localhost libfastcommon-1.0.43]# ./make.sh && ./make.sh install

3,检查执行的结果,看安装是否成功:

[root@localhost libfastcommon-1.0.43]# ls /usr/lib64|grep libfastcommon
libfastcommon.so
[root@localhost libfastcommon-1.0.43]# ls /usr/lib|grep libfastcommon
libfastcommon.so

说明:如果能看到libfastcommon.so,说明安装成功

五,编译安装fastdfs

1,解压fastdfs

[root@localhost source]# tar -zxvf V6.06.tar.gz

2,安装fastdfs

[root@localhost source]# cd fastdfs-6.06/
[root@localhost fastdfs-6.06]# ./make.sh && ./make.sh install

3,检查fastdfs是否安装成功?

[root@localhost fastdfs-6.06]# ls /usr/bin|grep fdfs
fdfs_appender_test
fdfs_appender_test1
fdfs_append_file
fdfs_crc32
fdfs_delete_file
fdfs_download_file
fdfs_file_info
fdfs_monitor
fdfs_regenerate_filename
fdfs_storaged
fdfs_test
fdfs_test1
fdfs_trackerd
fdfs_upload_appender
fdfs_upload_file

说明:能看到fdfs_打头的这些程序,则表示安装成功

六,生成启动fastdfs所需的配置文件

[root@localhost fastdfs-6.06]# cd /etc/fdfs/
[root@localhost fdfs]# cp storage.conf.sample storage.conf
[root@localhost fdfs]# cp client.conf.sample client.conf
[root@localhost fdfs]# cp tracker.conf.sample tracker.conf

七,启动tracker服务

1,创建tracker服务所需的目录

[root@localhost fdfs]# mkdir /data/fastdfs
[root@localhost fdfs]# mkdir /data/fastdfs/tracker
[root@localhost fdfs]# chmod 777 /data/fastdfs/tracker

2,配置tracker服务,

修改 tracker.conf 文件

[root@localhost fdfs]# vi /etc/fdfs/tracker.conf

只修改base_path一项的值为我们在上面所创建的目录即可

  base_path = /data/fastdfs/tracker

3,启动 tracker 服务

[root@localhost fdfs]# /etc/init.d/fdfs_trackerd start

4,检查tracker服务启动是否成功

[root@localhost fdfs]# ps auxfww | grep fdfs
root 15067 0.0 0.0 12320 964 pts/0 S+ 15:14 0:00 | | \_ grep --color=auto fdfs
root 15026 0.0 0.1 90160 5940 ? Sl 15:13 0:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf

能看到 fdfs_trackerd,表示tracker服务启动成功

5,检查tracker服务是否已绑定端口 22122?

[root@localhost dest]# netstat -anp | grep 22122
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 15026/fdfs_trackerd

说明: 22122端口是在/etc/fdfs/tracker.conf中定义的,

如下:

# the tracker server port
port = 22122

八,启动storage服务

1,创建storage服务所需的目录

[root@localhost fdfs]# mkdir /data/fastdfs/storage
[root@localhost fdfs]# chmod 777 /data/fastdfs/storage/

2,  配置storage服务

编辑storage的配置文件:

[root@localhost fdfs]# vi /etc/fdfs/storage.conf

各配置项包括:

配置base_path为上面所创建的storage目录

base_path = /data/fastdfs/storage
store_path0 = /data/fastdfs/storage

//上面的store_path :存储所在的目录,可以设置多个,注意从0开始

tracker_server = 192.168.3.172:22122 

//上面是tracker_server的ip和端口

http.server_port = 80

//上面是指定http服务的端口

说明:从上面我们可以看到,storage_server在启动时要注册到tracker_server,

从而实现由tracker_server对其进行调度

3,启动storage服务

[root@localhost fdfs]# /etc/init.d/fdfs_storaged start
正在启动 fdfs_storaged (via systemctl): [ 确定 ]

4,检查storage服务启动是否成功?

[root@localhost fdfs]# ps auxfww | grep fdfs
root 15630 0.0 0.0 12320 972 pts/0 S+ 15:46 0:00 | | \_ grep --color=auto fdfs
root 15026 0.0 0.1 155696 6964 ? Sl 15:13 0:00 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
root 15573 2.7 1.7 150736 66292 ? Sl 15:45 0:02 /usr/bin/fdfs_storaged /etc/fdfs/storage.conf

说明:看到fdfs_storaged,表示storage服务启动成功

5,检查storage服务是否已绑定到端口:23000?

[root@localhost fdfs]# netstat -anp | grep 23000
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 15573/fdfs_storaged

说明:23000 端口是在配置文件 /etc/fdfs/storage.conf中定义的,如下:

# the storage server port
port = 23000

九,配置fastdfs的客户端使用的配置文件

1,配置客户端要使用的client.conf

[root@localhost fdfs]# vi /etc/fdfs/client.conf

以下两项配置用到的tracker目录和服务器地址端口

base_path = /data/fastdfs/tracker
tracker_server = 192.168.3.172:22122

2,从客户端的配置可以看到:客户端只需要了解tracker_server的信息

Tracker server作用也正是负载均衡和调度

3, Storage server作用是文件存储,客户端上传的文件最终存储在 Storage 服务器上

十,安装nginx及fastdfs-nginx-module

1,解压nginx:

[root@localhost source]# tar -zxvf nginx-1.17.8.tar.gz

2,解压fastdfs-nginx-module

[root@localhost source]# tar -zxvf V1.22.tar.gz

3,修改config文件,把/usr/local 替换成 /usr

[root@localhost source]# cd fastdfs-nginx-module-1.22/
[root@localhost fastdfs-nginx-module-1.22]# cd src
[root@localhost src]# vi config

4,nginx配置,添加fastdfs-nginx-module和http_stub_status_module 模块

[root@localhost fdfs]# cd /usr/local/source/nginx-1.17.8/
[root@localhost nginx-1.17.8]# ./configure --prefix=/usr/local/soft/nginx --with-http_stub_status_module --add-module=/usr/local/source/fastdfs-nginx-module-1.22/src/

5,编译安装nginx

[root@localhost nginx-1.17.8]# make && make install

6,检查安装是否成功?

[root@localhost nginx-1.17.8]# ls /usr/local/soft/ | grep nginx
nginx

7,查看指定的编译参数是否起作用?

[root@localhost fdfs]# /usr/local/soft/nginx/sbin/nginx -V
nginx version: nginx/1.17.8
built by gcc 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)
configure arguments: --prefix=/usr/local/soft/nginx --with-http_stub_status_module --add-module=/usr/local/source/fastdfs-nginx-module-1.22/src/

十一,配置fastdfs-nginx-module

1,生成配置文件:

[root@localhost nginx-1.17.8]# cp /usr/local/source/fastdfs-nginx-module-1.22/src/mod_fastdfs.conf /etc/fdfs/

2,编辑配置文件:

[root@localhost nginx-1.17.8]# vi /etc/fdfs/mod_fastdfs.conf

配置以下几项

connect_timeout=10
tracker_server=192.168.3.172:22122
url_have_group_name = true
store_path0=/data/fastdfs/storage

3,复制另两个web访问用到配置文件到fdfs配置目录下:

[root@localhost nginx-1.17.8]# cd /usr/local/source/fastdfs-6.06/conf/
[root@localhost conf]# cp http.conf /etc/fdfs/
[root@localhost conf]# cp mime.types /etc/fdfs/

十二,配置nginx

编辑nginx的配置文件:

[root@localhost conf]# vi /usr/local/soft/nginx/conf/nginx.conf

在server listen 80 的这个server配置下面,

增加一个location

       location ~/group([0-9]) {
root /data/fastdfs/storage/data;
ngx_fastdfs_module;
}

十三,启动nginx

1,启动

[root@localhost storage]# /usr/local/soft/nginx/sbin/nginx 

2,检查nginx是否已成功启动

[root@localhost storage]# ps auxfww | grep nginx
root 24590 0.0 0.0 12320 980 pts/0 S+ 16:44 0:00 | | \_ grep --color=auto nginx
root 24568 0.0 0.0 41044 428 ? Ss 16:44 0:00 \_ nginx: master process /usr/local/soft/nginx/sbin/nginx
nobody 24569 0.0 0.1 74516 4940 ? S 16:44 0:00 \_ nginx: worker process

十四,测试上传一张图片

1,准备一张图片,然后上传

[root@localhost storage]# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/liuhongdi/image/nginx.jpg
group1/M00/00/00/wKgDrF5U32GAZAo1AAAyP-hllUI402.jpg

注意fdfs所返回的地址,我们需要使用这个地址进行访问

2,打开浏览器:访问这个地址:

http://192.168.3.172/group1/M00/00/00/wKgDrF5U32GAZAo1AAAyP-hllUI402.jpg

可以看到图片

3,说明:192.168.3.172是拼接的本地服务器的ip

4,实际的图片位于文件系统中什么位置?

[root@localhost data]# pwd
/data/fastdfs/storage/data

[root@localhost data]# ls 00/00
wKgDrF5U32GAZAo1AAAyP-hllUI402.jpg

可见/group1/M00这两个目录是由fdfs所管理生成的目录:

它们分别代表fdfs生成的组名和磁盘

十五,查看fdfs的版本

[root@localhost data]# fdfs_monitor /etc/fdfs/client.conf | grep version
[2020-02-25 16:58:01] DEBUG - base_path=/data/fastdfs/tracker, connect_timeout=5, network_timeout=60, tracker_server_count=1, 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 version = 6.06

十六,监控fdfs的运行状态

[root@localhost data]# fdfs_monitor /etc/fdfs/client.conf

十七,查看本地centos的版本

[root@localhost lib]# cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)

centos8安装fastdfs6.06(单机方式)的更多相关文章

  1. centos8安装fastdfs6.06集群方式三之:storage的安装/配置/运行

    一,查看本地centos的版本 [root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) 说 ...

  2. centos8安装fastdfs6.06集群方式二之:tracker的安装/配置/运行

    一,查看本地centos的版本 [root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) 说 ...

  3. centos8安装fastdfs6.06集群方式一之:软件下载与安装

    一,查看本地centos的版本 [root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) 说 ...

  4. CentOS8安装fastdfs6.06

    目录 一.准备环境 二.解压并编译安装 1.解压下载好的包 2.编译安装 2.1.编译安装 libfastcommon 2.2.编译安装 fastdfs 2.3.安装 nginx 和 fastdfs- ...

  5. Hadoop三种安装模式:单机模式,伪分布式,真正分布式

    Hadoop三种安装模式:单机模式,伪分布式,真正分布式 一 单机模式standalone单 机模式是Hadoop的默认模式.当首次解压Hadoop的源码包时,Hadoop无法了解硬件安装环境,便保守 ...

  6. Hadoop安装教程_单机/伪分布式配置_CentOS6.4/Hadoop2.6.0

    Hadoop安装教程_单机/伪分布式配置_CentOS6.4/Hadoop2.6.0 环境 本教程使用 CentOS 6.4 32位 作为系统环境,请自行安装系统.如果用的是 Ubuntu 系统,请查 ...

  7. CentOS8安装VirtualBox,并创建CentOS虚拟机

    安装VirtualBox 执行以下命令并启用VirtualBox和EPEL包仓库 [root@localhost~] dnf config-manager --add-repo=https://dow ...

  8. Myeclipse安装svn插件(link方式)

    Myeclipse安装svn插件(link方式) 优点:1.离线安装2.非侵入式 演示版本 myeclipse--myeclipse8.6 svn--subeclipse-site-1.6.5.zip ...

  9. CMake安装(源码方式)

    CMake主页是 https://cmake.org/download/ 一.不指定安装目录方式(不需要配置环境变量) 1.安装必备包(存在的包不用卸载,yum会自动更新) yum install - ...

随机推荐

  1. jzoj1497. 景点中心

    Description 话说宁波市的中小学生在镇海中学参加计算机程序设计比赛,比赛之余,他们在镇海中学的各个景点参观.镇海中学共有n个景点,每个景点均有若干学生正在参观.这n个景点以自然数1至n编号, ...

  2. Unity3D获得服务器时间/网络时间/后端时间/ServerTime,适合单机游戏使用

    说明 一些游戏开发者在做单机游戏功能时(例如:每日奖励.签到等),可能会需要获得服务端标准时间,用于游戏功能的逻辑处理. 问题分析 1.自己如果有服务器:自定义一个后端API,客户端按需请求就行了: ...

  3. 用ajax获取后端数据,显示在前端,实现了基本计算器功能

    下午在看视频的时候,遇到一个问题:如何把后端 print_r或echo的数据显示在前端.百度了一下,说是用ajax,想着前一阵子学习了ajax,并且最近也想做一个计算器,于是就自己钻起来了. 计算器的 ...

  4. 分布式系统监视zabbix讲解六之自定义监控项

    概述 Zabbix支持许多在多种情况下使用宏.宏是一个变量,由如下特殊语法标识: {MACRO} 根据在上下文中, 宏解析为一个特殊的值. 有效地使用宏可以节省时间,并使Zabbix变地更加高效. 在 ...

  5. git代码管理——克隆项目到本地仓库及上传本地项目到仓库

    一.克隆项目到本地仓库 1.github网站操作 1.1 登录github 首先创建一个仓库,点击“New” 1.2 输入仓库信息 1.3 创建完成后,会多出一个仓库 2.安装git客户端 2.1 安 ...

  6. 新手接触springboot

    新手使用springboot或者说,刚接触java行业,有些不明白的就是项目的架构是怎么样的,我今天在这儿稍微整理了一下 有些新手可能在想,springboot是怎么解决最原始的增-删-改-查, 快速 ...

  7. 1.4Hadoop伪分布式安装

  8. 使用VSCode和CMake构建跨平台的C/C++开发环境

    日前在学习制作LearnOpenGL教程的实战项目Breakout游戏时,希望能将这个小游戏开发成跨平台的,支持在多个平台运行.工欲善其事必先利其器,首先需要做的自然是搭建一个舒服的跨平台C/C++开 ...

  9. 面试的加分项:懂点 Nginx 反向代理与负载均衡

      学到老活到老 前端圈一直很新,一直要不停的学习,而且在进入大厂的路上,还要求熟悉一门后台语言等等.用一句别人开玩笑的话来说,java十年前的技术现在还能用,而前端的技术就不是这样的了 突然想起了d ...

  10. Oracle学习(四)SQL高级--表优化相关(序列、视图等)

    INDEX(索引) 可以在表中创建索引,以便更加快速高效地查询数据. 用户无法看到索引,它们只能被用来加速搜索/查询. PS:更新一个包含索引的表需要比更新一个没有索引的表花费更多的时间,这是由于索引 ...