Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The implementation method of deploying FastDFS in Docker

2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Docker install fastdfs

Mount directory

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

The folder path of / e/fdfs/tracker in windows is E:\ fdfs\ tracker

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

View the network

Docker network ls # Network list docker network create-- driver bridge-- subnet=192.168.127.0/24 fastdfs_fastdfs_net # create a custom network segment and do not use it

Download the image

Docker pull season/fastdfs

The default port for creating a tracker container Tracker server is 22122

# # deployment process is based on bridge network docker run-ti-d-name trakcer-v / f/fastdfs/tracker_data:/fastdfs/tracker/data-p 22122ti 22122 season/fastdfs tracker

Use docker images to build storage containers (storage servers that provide capacity and backup services)

# # 172.17.0.2 is the ip address of the container docker run-tid-- name storage-v / f/fastdfs/storage_data:/fastdfs/storage/data-v / f/fastdfs/store_path:/fastdfs/store_path-p 808080pur808080-p 23000pur23000-p 80:80-e TRACKER_SERVER:172.17.0.2:22122-e GROUP_NAME=group1 season/fastdfs storage

At this point, both services are started with

# configure the service, enter the storage container, configure the port accessed by http in the configuration file of storage, and configure the storage.confdocker exec-it storage bashcd fdfs_confmore storage.conf in the fdfs_conf directory

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

Docker cp storage:/fdfs_conf/storage.conf. /

Copy the modified configuration file to the configuration directory in storagee:

Docker cp. / storage.conf storage:/fdfs_conf/

Restart the storage container

Docker stop storagedocker start storage

See the relationship between the tracker container and the storage container

Docker exec-it storage bashcd fdfs_conffdfs_monitor storage.conf

Upload files to the storage container in the docker simulation client

# # Open a client docker cp. / storage.conf fdfs_sh:/fdfs_conf/

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

Docker exec-it fdfs_sh bash

Create a txt file

Docker exec-it fdfs_sh bashecho hello > a.txt

Go to the fdfs_conf directory and upload the file to the storage container

Cd fdfs_conffdfs_upload_file storage.conf / a.txt

Windows command

Netstat-aon | findstr "22122" # check whether the port disables netsh firewall set opmode mode=disable # turn off firewall netsh firewall reset

Https://hub.docker.com/r/qbanxiaoli/fastdfs)

Windows Server 2012 R2 environment uses docker-toolbox installation configuration image acceleration

Docker-machine ssh defaultsudo sed-I "s | EXTRA_ARGS=' | EXTRA_ARGS='--registry-mirror= http://hub-mirror.c.163.com | g" / var/lib/boot2docker/profileexitdocke-machine restart default

Docker installation Tip: Error response from daemon: client is newer than server

Solution: check the version of client (client side) with the command docker version, and then simply and roughly change the client version to the same version as the server version (export DOCKER_API_VERSION=1.22) to copy the code

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

Solution: this problem can be solved by downloading and copying the latest version of the boot2docker.iso file and placing it in the installation directory and cache directory.

Download the latest version of boot2docker.iso image from the official download address: copy https://github.com/boot2docker/boot2docker/releases to the local cache directory (C:\ Users\ admin.docker\ machine\ cache\), and copy it to the local installation directory (C:\ Program Files\ Docker Toolbox). Run-Docker again-Docker Quickstart Termina l terminal console, and you can create the ```default`` virtual machine normally.

If you still prompt the above error, it is because the version of boot2docker.iso is not the latest version, and the latest boot2docker.iso will be checked and downloaded online at startup, but the slow access speed of github leads to a jam, so the disconnected network skips the check step. After loading to boot2docker.iso, there will be no problem in opening docker later.

Mount folder

Https://www.jb51.net/article/176813.htm

Fastdfs integrated SpringBoot configuration

# FastDFSfdfs: so-timeout: 1501 connect-timeout: 601thumb-image: # thumbnail generation parameters width: 200height: 200tracker-list:-192.168.118.162connect-timeout 22122

The method of Direct access of docker for windows Container Intranet through Independent IP

Realize ip interworking by configuring routing table

View route print

# # add routing route-p add 172.17.0.0 MASK 255.255.255.0 10.0.75.2

The method of Direct access of docker for windows Container Intranet through Independent IP

Mode II of FastDfs-- deployment in Docker

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

The folder path of / e/fdfs/tracker 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://qbanxiaoli@github.com/qbanxiaoli/fastdfs.git

Enter the fastdfs directory

Cd fastdfs

Modify docker-compose.yml, modify ip

Shellversion: '3.0'services: fastdfs: build:. Image: qbanxiaoli/fastdfs # whether the container needs to be booted + automatically restarted. Uncomment if necessary. Restart: always container_name: fastdfs ports:-8080 environment: 22122-23000 environment: # time TZ: Asia/Shanghai # nginx service port, default port 8080, WEB_PORT: 8080 # tracker_server service port, default port 22122, FDFS_PORT: 22122 # fastdht service port, default port 11411, you can modify FDHT_PORT: 11411 # docker host IP private network address By default, the address of the eth0 network card IP: 192.168.118.93 volumes: # maps the local directory to the fastdfs data storage directory in the docker container, and stores the fastdfs files on the host, so that the previously stored files will not be lost every time the docker container is rebuilt. -/ e/fastdfs/fastdfs:/var/local # since windows and unix cannot recognize the host network, you need to create a new IP address range to force the container ip to be consistent with the host ip networks: fastdfs_net: ipv4_address: 192.168.118.93networks: fastdfs_net: driver: bridge driver_opts: parent: eth0 ipam: config:-subnet: 192.168.118.0

Execute the docker-compose command

Shelldocker-compose up-d

Test whether the fastdfs is built successfully

# enter docker exec-it fastdfs / bin/bash inside the container

Restart tracker_server

Shell/usr/bin/fdfs_trackerd / etc/fdfs/tracker.conf restart

Restart storage_server

Shell/usr/bin/fdfs_storaged / etc/fdfs/storage.conf restart

View storage status

Shellfdfs_monitor / etc/fdfs/client.conf

Localhost:8080 accesses nginx

Indicates that the deployment is successful!

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 233

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report