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

About centos7 fastdfs deployment

藏色散人
Release: 2020-12-21 15:09:02
forward
1921 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

3. Modify the configuration

1 .Modify vi tracker.conf

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

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中保持一致)
Copy after login

3.Modify vi client.conf

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

4. Start the service:

sh fastfdfs_services.sh
Copy after login

or use:

/etc/init.d/fdfs_trackerd start/stop/restart
/etc/init.d/fdfs_storaged start/stop/restart
Copy after login

6. Test the fastfdfs upload service:

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

See the following similar service ok

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

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
Copy after login

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
Copy after login

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
Copy after login

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;
        }
 
       }
Copy after login

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
Copy after login

10. Test visit:

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

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

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template