docker下搭建fastdfs分布式集群

主機(jī)說明

兩臺(tái)設(shè)備:10.10.10.155、10.10.10.156

配置docker環(huán)境

yum install -y yum-utils device-mapper-persistent-data lvm2

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

yum install docker -y

systemctl start docker

systemctl enable docker

docker version

關(guān)閉防火墻

systemctl status firewalld

systemctl stop firewalld

systemctl disable firewalld

開始搭建

從git服務(wù)器上下載工程

git clone https://git.oschina.net/zjg23/fastdfs_in_docker.git

創(chuàng)建掛在dockers容器的路徑(要確保有足夠的存儲(chǔ)空間)

mkdir -p /root/fastdfs/{tracker,storage}

構(gòu)建鏡像

cd fastdfs_in_docker

docker build -t zjg23/fastdfs:2.0 .

docker images

構(gòu)建tracker(10.10.10.155)

docker run -d --name fdfs_tracker -v /root/fastdfs/tracker:/export/fastdfs/tracker --net=host -e TRACKER_BASE_PATH=/export/fastdfs/tracker -e TRACKER_PORT=22123 zjg23/fastdfs:2.0 sh /usr/local/src/tracker.sh

docker ps

查看端口是否啟用

? 端口默認(rèn)為22122

lsof -i:22123

構(gòu)建storage

docker run -d --name fdfs_storage -v /root/fastdfs/storage:/export/fastdfs/storage --net=host -e STORAGE_PORT=23001 -e STORAGE_BASE_PATH=/export/fastdfs/storage -e STORAGE_PATH0=/export/fastdfs/storage -e TRACKER_SERVER=10.10.10.155:22123 -e HTTP_SERVER_PORT=8080 -e GROUP_NAME=group1 zjg23/fastdfs:2.0 sh /usr/local/src/storage.sh

修改配置文件

docker exec -it ** bash

mkdir -p /root/fastdfs

vi /etc/fdfs/client.conf

? bese_pash=/root/fastdfs

? tracker_server=10.10.10.155:22123

? http.tracker_server_port=8080

查看部署架構(gòu)是否正確

/usr/bin/fdfs_monitor /etc/fdfs/client.conf

修改nginx配置

查看啟用的模塊

/usr/local/nginx/sbin/nginx -V

編譯nginx添加image_filter_module支持(圖片壓縮)

cd /usr/local/src/ngin

yum -y install gd-devel

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_image_filter_module --add-module=/usr/local/src/fastdfs-nginx-module/src

make

cp ./objs/nginx /usr/local/nginx/sbin/ /usr/local/nginx/sbin/nginx -V

編輯nginx主配置文件

vi /usr/local/nginx/conf/nginx.conf

上傳命令

/usr/bin/fdfs_test /etc/fdfs/client.conf upload ***

查看命令

原圖

http://10.10.10.155:8080/group1/M00/00/00/CgoKm1zrYEeALA5PAAwmlZvzQuk793.png

https://dfs.sxhgpark.com/group1/M00/00/00/CgoKm1zrYEeALA5PAAwmlZvzQuk793_70x30.png

縮略圖

http://10.10.10.155:8080/group1/M00/00/00/CgoKm1zrYEeALA5PAAwmlZvzQuk793_700x300.png

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容