Docker installation fastdfs

Mount the directory

-v /e/fdfs/tracker:/var/fdfs

/e/ FDFS /tracker The folder path in Windows is e :\ FDFS \tracker

/var/fdfs is the absolute path of the file in the container

Check the network

Docker network ls # Docker network create --driver bridge --subnet=192.168.127.0/24 fastdfs_fastDFs_net # Create a network segment Not to useCopy the code

Download mirror

docker pull season/fastdfs
Copy the code

Create tracker container The default port for the tracker server is 22122

## Deployment process adopts bridge network
docker run -ti -d --name trakcer -v /f/fastdfs/tracker_data:/fastdfs/tracker/data -p 22122:22122 season/fastdfs tracker
Copy the code

Use docker images to build storage containers (storage servers, providing capacity and backup services)

## 172.17.0.2 is the IP address of the containerdocker run -tid --name storage -v /f/fastdfs/storage_data:/fastdfs/storage/data -v /f/fastdfs/store_path:/fastdfs/store_path -p 8080:80000 -p 23000:23000 -p 80:80 -e TRACKER_SERVER:172.17.0.2:22122 -e TRACKER_SERVER:172.17.0.2:22122 -e TRACKER_SERVER:172.17.0.2:22122 -e GROUP_NAME=group1 season/fastdfs storageCopy the code

Both services are started at this point

#Fdfs_conf/storage.conf/fdfs_conf
docker exec -it storage bash
cd fdfs_conf
more storage.conf
Copy the code

Next, exit the storage and make a copy of the configuration file:

docker cp storage:/fdfs_conf/storage.conf ./
Copy the code

Copy the modified configuration file to the storagee configuration directory:

docker cp ./storage.conf storage:/fdfs_conf/
Copy the code

Restart the storage container

docker stop storage
docker start storage
Copy the code

Look at the association between the tracker and storage containers

docker exec -it storage bash
cd fdfs_conf
fdfs_monitor storage.conf
Copy the code

Upload files to the storage container in docker simulation client

## Start a client
docker cp ./storage.conf  fdfs_sh:/fdfs_conf/
Copy the code

Change the configuration file, because it has been changed once before, so now directly copy

docker exec -it fdfs_sh bash
Copy the code

Create a TXT file

docker exec -it fdfs_sh bash
echo hello>a.txt
Copy the code

Enter thefdfs_confDirectory and upload the filestorageThe container

cd fdfs_conf

fdfs_upload_file storage.conf /a.txt
Copy the code

Windows command

Netstat aon | findstr searches "22122" # check whether port disable netsh firewall set opmode mode = disable # close the firewall netsh firewall resetCopy the code

Hub.docker.com/r/qbanxiaol…).

Windows Server 2012 R2 operating system

  • Install using Docker-Toolbox

Configuring Mirror Acceleration

docker-machine ssh default
sudo sed -i "s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror=http://hub-mirror.c.163.com |g" /var/lib/boot2docker/profile
exit
docke-machine restart default
Copy the code

Docker installation prompt Error Response from Daemon: Client is newer than Server

Solution: Run the docker version command to check the version of the client(client), and then simply change the client version to be the same as the server version (export DOCKER_API_VERSION=1.22).Copy the code

DockerToolbox tips: default Boot2Docker ISO is out-of-date

Solution: Download and copy the boot2docker.iso file of the latest version to the installation directory and cache directory to resolve the problem.

  • Download the latest versionboot2docker.isoImage, official download address:Github.com/boot2docker…
  • Copy to local cache directory (C:\Users\admin.docker\machine\cache\),
  • Copy it to your local installation directory (C:\Program Files\Docker Toolbox),
  • Run again-DockerRun again-Docker Quickstart TerminaL Terminal console,
  • You can create the default virtual machine.

If the above error is still displayed, it is because the version of boot2docker.iso is not the latest version, and the latest boot2docker. After loading to boot2Docker. iso, there is no problem in opening Docker later.

Mount folder

Blog.csdn.net/qq_33208587…

Fastdfs integrates SpringBoot configuration

#FastDFS
fdfs:
    so-timeout: 1501
    connect-timeout: 601
    thumb-image:             # thumbnail generation parameters
        width: 200
        height: 200
    tracker-list:
        - 192.168118.162.: 22122
Copy the code

Docker for Windows container Intranet access via independent IP

This section describes how to configure routing tables for IP address communication

Look at the route print

## add routeRoute -p add 172.17.0.0 MASK 255.255.255.0 10.0.75.2Copy the code

Docker for Windows container Intranet access via independent IP

Docker FastDfs deployment — method two

-v /e/fdfs/tracker:/var/fdfs

/e/ FDFS /tracker The folder path in Windows is e :\ FDFS \tracker

/var/fdfs is the absolute path of the file in the container

Clone project

## this image is an integrated Nginx image
git clone https://[email protected]/qbanxiaoli/fastdfs.git 
Copy the code

Go to the Fastdfs directory

cd fastdfs
Copy the code

Modify docker-comemage. yml to modify the IP address

Version: '3.0' services: fastdfs: build:. Image: qbanxiaoli/fastdfs Uncomment if necessary. Restart: always container_name: fastdfs ports: -8080:8080-22122:22122:23000:23000 Environment: Asia/Shanghai # nginx service port, default 8080, tracker_server service port, default 22122, FDFS_PORT: Volumes: FDHT_PORT: 11411 # docker host IP address 192.168.118.93 # map local directory to fastdfs data store directory in Docker container, store fastdfs files on host, so that every time you rebuild docker container, the stored files will be lost. - / e/fastdfs/fastdfs: / var/local # because Windows and Unix could not identify the host network, now need new period, the mandatory specified IP is in line with the host IP networks: container fastdfs_net: Ipv4_address: 192.168.118.93 Networks: FastDFs_net: driver: bridge Driver_opts: parent: eth0 ipam: config: -subnet: 192.168.118.0/24Copy the code

Run the docker-compose command

docker-compose up -d
Copy the code

Test whether fastDFS is set up successfully

#Inside the container
docker exec -it fastdfs /bin/bash
Copy the code

Restart tracker_server

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
Copy the code

Restart storage_server

/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
Copy the code

Viewing storage Status

fdfs_monitor /etc/fdfs/client.conf

Copy the code

Visit nginx localhost: 8080

The deployment is successful!