How to install FastDFS in Docker

How to install FastDFS in Docker

Pull the image

docker pull season/fastdfs:1.2

Start Tracker

docker run -ti -d --name trakcer -v /opt/fastdfs/tracker_data:/fastdfs/tracker/data --net=host season/fastdfs:1.2 tracker

Start Storage

Note that replace {ipaddress}

docker run -ti -d --name storage -v /opt/fastdfs/storage_data:/fastdfs/storage/data -v /opt/fastdfs/store_path:/fastdfs/store_path --net=host -e TRACKER_SERVER:{ipaddress}:22122 season/fastdfs:1.2 storage

Modify the configuration file

The directory of vim is the directory after cp, such as my directory is /usr/local/fastdfs/conf
Replace the following parameters in the configuration file with your corresponding IP

docker cp storage:/fdfs_conf/. /usr/local/fastdfs/conf

vim tracker.conf
bind_addr=${ipaddress}

vim storage.conf
tracker_server=${ipaddress}:22122

vim-client.conf
tracker_server=${ipaddress}:22122

#cp the modified configuration file back to the image docker cp /usr/local/fastdfs/conf/. storage:/fdfs_conf

#Restart the storage service docker restart storage

Configure Nginx

Mount nginx.conf and mod_fastdfs.conf in the storage service

#Add location /group1/M00 to the nginx.conf configuration file {
      #root /fastdfs/store_path/data;
      ngx_fastdfs_module;
}

#Configure cross-domain in the server. Configure cross-domain in the server. add_header 'Access-Control-Allow-Origin' '*';
  add_header 'Access-Control-Allow-Credentials' 'true';
  add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

#Add url_have_group_name=true in mod_fastdfs.conf

Start Nginx

Note: When starting nginx, you need to map the paths of nginx.conf and mod_fastdfs.conf mounted in the previous step, so you need to write them according to your own paths, and remember to replace the {ipaddress} parameter

docker run -id --name fastdfs_nginx --restart=always -v /opt/fastdfs/store_path:/fastdfs/store_path -v /usr/local/fastdfs/nginx_conf/nginx.conf:/etc/nginx/conf/nginx.conf -v /usr/local/fastdfs/nginx_conf/mod_fastdfs.conf:/etc/fdfs/mod_fastdfs.conf -p 8888:80 -e GROUP_NAME=group1 -e TRACKER_SERVER={ipaddress}:22122 -e STORAGE_SERVER_PORT=23000 season/fastdfs:1.2 nginx

Configuring the Firewall

firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --zone=public --add-port=23000/tcp --permanent
firewall-cmd --reload

This is the end of this article about the steps to install FastDFS on Docker. For more information about installing FastDFS on Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed example of installing FastDfs file server using docker compose
  • Some notes on installing fastdfs image in docker
  • Building FastDFS file system in Docker (multi-image tutorial)
  • How to deploy FastDFS in Docker
  • How to use docker compose to build fastDFS file server

<<:  Web page HTML code: production of scrolling text

>>:  How to center images horizontally and vertically in DIV or DIV

Recommend

Summary of Button's four Click response methods

Button is used quite a lot. Here I have sorted ou...

Install tomcat and deploy the website under Linux (recommended)

Install jdk: Oracle official download https://www...

Docker completely deletes private library images

First, let’s take a look at the general practices...

MySQL/MariaDB Root Password Reset Tutorial

Preface Forgotten passwords are a problem we ofte...

Detailed explanation of simple html and css usage

I will use three days to complete the static page...

Three ways to avoid duplicate insertion of data in MySql

Preface In the case of primary key conflict or un...

VSCode configuration Git method steps

Git is integrated in vscode, and many operations ...

A small introduction to the use of position in HTML

I just learned some html yesterday, and I couldn&#...

Server stress testing concepts and methods (TPS/concurrency)

Table of contents 1 Indicators in stress testing ...

Apply provide and inject to refresh Vue page method

Table of contents Method 1: Call the function dir...

How to avoid duplication of data when inserting in MySql batch

Table of contents Preface 1. insert ignore into 2...

Embedded transplant docker error problem (summary)

After a long period of transplantation and inform...

HTML css js implements Tab page sample code

Copy code The code is as follows: <html xmlns=...