首页 > 代码库 > Centos7.2 FastDFS_V5.05 集群的安装与配置
Centos7.2 FastDFS_V5.05 集群的安装与配置
环境: Centos 7.2/64位 两台服务器 都为tracker 和 storage
10.100.0.1 storage tracker
10.100.0.2 storage tracker
1 和 2安装配置类似, 下面以一台为例
1, 安装依赖包,添加fastDFS运行用户
yum install -y zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip useradd -s /sbin/nologin fastdfs
2,创建数据存储目录
mkdir -p /export/fastdfs/{storage,tracker}
[root@localhost src]# ll /export/fastdfs
total 0
drwxr-xr-x 2 root root 6 Dec 10 15:18 storage #Storage目录保存运行日志及其data数据
drwxr-xr-x 2 root root 6 Dec 10 15:17 tracker #tracker目录保存运行日志
3,安装libfastcommon
下载最新版本: libfastcommonwget https://github.com/happyfish100/libfastcommon/archive/master.zipunzip master.zipcd libfastcommon-master/./make.sh./make.sh install
4, 安装Fastdfs
wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with%20PHP%20Extension%20Source%20Code%20V5.05/FastDFS_v5.05.tar.gz/download
tar zxf FastDFS_v5.05.tar.gz && cd FastDFS
./make.sh./make.sh install
chown -R fastdfs: /export/fastdfs
5, 配置tracker 和 storage 配置文件, 对应修改(配置文件的路径:/etc/fdfs/)
vi storage.conf
group_name=group1
base_path=/export/fastdfs/storage
store_path0=/export/fastdfs/storage
tracker_server=192.168.0.205:22122
tracker_server=192.168.0.206:22122
http.server_port=80
vi tracker.confbase_path=/export/fastdfs/tracker
vi client.conftracker_server=192.168.0.205:22122tracker_server=192.168.0.206:22122
6.安装fastdfs-nginx-module模块
cd /usr/local
wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz/download
tar zxf fastdfs-nginx-module_v1.16.tar.gz
cd fastdfs-nginx-module/src
vi conf #更改如下, 去掉local,并指定lib64(64系统)CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"CORE_LIBS="$CORE_LIBS -L/usr/lib64 -lfastcommon -lfdfsclient"
vi mod_fastdfs.confgroup_name=group1base_path=/export/fastdfs/storagestore_path0=/export/fastdfs/storagetracker_server=192.168.0.205:22122tracker_server=192.168.0.206:22122url_have_group_name = true #是true 不是ture
并且该文件修改完成以后复制到/etc/fdfs/目录
7.安装Nginx
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar zxf nginx-1.8.0.tar.gz
useradd -s /sbin/nologin www
cd nginx-1.8.0
/configure --user=www --group=www --add-module=/usr/local
/fastdfs-nginx-module/src/ --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
makemake install
8.配置Nginx
server { listen 80; server_name 192.168.0.205; root /webdata/fastdfs.com; index index.html index.htm; location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.html last; } location /group1/M00 { root /export/fastdfs/storage/data/; ngx_fastdfs_module; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js)$ { # fastcgi_cache cache_one; #nginx.conf 开启cache才行,要不然启动报错 fastcgi_cache_valid 200 10m; fastcgi_cache_valid 304 3m; fastcgi_cache_valid 301 302 1h; fastcgi_cache_valid any 1m; fastcgi_cache_min_uses 1; fastcgi_cache_use_stale error timeout invalid_header http_500; fastcgi_cache_key $host$request_uri; access_log off; } } access_log off;}
Centos7.2 FastDFS_V5.05 集群的安装与配置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。