Home  >  Article  >  Operation and Maintenance  >  About centos7 fastdfs deployment

About centos7 fastdfs deployment

藏色散人
藏色散人forward
2020-12-21 15:08:411836browse

The following tutorial column from centos will introduce to you about centos7 fastdfs deployment. I hope it will be helpful to friends in need!

About centos7 fastdfs deployment

centos7 fastdfs deployment

### start from here
 
## 前置准备依赖c++ :
yum -y install libevent  libevent-devel perl  make gcc zlib  zlib-devel pcre pcre-devel  gcc-c++  openssl-devel

1. Install libfastcommon

wget https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz
mv V1.0.43.tar.gz libfastcommon-1.0.43.tar.gz && tar -xvf  libfastcommon-1.0.43.tar.gz
cd libfastcommon-1.0.43 && ./make.sh  && ./make.sh install

2. Install fastdfs # Pay attention to the conf Mine.types and http.conf must be copied. Secondly, it is recommended to download this version 6.x, otherwise there will be compatibility issues during installation

wget https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz
mv V6.06.tar.gz fdfs6.06.tar.gz && tar -xvf fdfs6.06.tar.gz
cd  cd fastdfs-6.06 && ./make.sh  && ./make.sh install
cp -r conf/* /etc/fdfs && rm -f *.sample
 
. 在$base_path 下新建data 和logs目录(存储trackerd.log 和storaged.log)
cd $base_path && mkdir -p data && mkdir  logs

3. Modify the configuration

1 .Modify vi tracker.conf

    port=22122  # tracker服务器端口(默认22122,一般不修改)
    base_path=/etc/fdfs # 存储日志和数据的根目录

2.Modify vi storage.conf

  port=23000             # storage服务端口(默认23000,一般不修改)
    base_path=/etc/fdfs    # 数据和日志文件存储根目录
    store_path0=/etc/fdfs  # 第一个存储目录
    tracker_server=192.168.110.151:22122  # tracker也就是fdfs服务器IP和端口
    http.server_port=8888  # http访问文件的端口(默认8888,看情况修改,和nginx中保持一致)

3.Modify vi client.conf

    base_path=/etc/fdfs
    tracker_server=192.168.110.151:22122    #tracker服务器IP和端口

4. Start the service:

sh fastfdfs_services.sh

or use:

/etc/init.d/fdfs_trackerd start/stop/restart
/etc/init.d/fdfs_storaged start/stop/restart

6. Test the fastfdfs upload service:

/usr/bin/fdfs_test  /etc/fdfs/client.conf  upload  $filename

See the following similar service ok

example file url: http://192.168.110.151/group1/M00/00/00/wKhul1-qhhKAO3ywAAABcxvxSxw5288_big.jpg

7.nginx, because it has not been integrated with nginx yet Integration cannot be downloaded using http

7.1 Install fastdfs-nginx-module Install fastdfs-nginx-module:

    wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz
    cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs

Configure nginx moudle:

    vim /etc/fdfs/mod_fastdfs.conf
    tracker_server=192.168.0.104:22122  #tracker服务器IP和端口
    url_have_group_name=true
    store_path0=/home/dfs

Install nginx:

wget http://nginx.org/download/nginx-1.15.4.tar.gz #下载nginx压缩包
    tar -zxvf nginx-1.15.4.tar.gz
    cd nginx-1.15.4/
    ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/  # 添加fastdfs-nginx-module模块
    make && make install

7.2#Configure nginx.config

  touch  /usr/local/nginx/logs/nginx.pid && chmod a+w /usr/local/nginx/logs/nginx.pid
    vim /usr/local/nginx/conf/nginx.conf
    #添加如下配置
        pid /usr/local/nginx/logs/nginx.pid;
 
        server {
        listen       8888;   ## 该端口为storage.conf中的http.server_port相同
        server_name  192.168.110.151;
 
        location ~/group[0-9]/ {
            ngx_fastdfs_module;
       }
 
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
 
       }

8. Turn off the firewall:

systemctl stop firewalld.service

9.nginx start and stop

./nginx -c /usr/local/nginx/conf/nginx.conf # 根据配置启动
/usr/local/nginx/sbin/nginx #启动nginx
/usr/local/nginx/sbin/nginx -s reload #重启nginx
/usr/local/nginx/sbin/nginx -s stop #停止nginx

10. Test visit:

nginx访问
访问:http://192.168.0.104:8888/group1/M00/00/00/wKgAaFyMoNKAUNcVAAWjVxW4v70993.jpg

The above is the detailed content of About centos7 fastdfs deployment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete