프로그래밍 질문을 설명하는 비디오 : Redis + FastDFS 작은 비디오 업로드

수요

Redis 분산 잠금을 사용하여 높은 동시성에서 작은 동영상 업로드 문제 해결

1. 직접 프런트 엔드 페이지 디자인

2, Redis + FastDFS

3. 기능 프로세스에서 오류가보고되지 않습니다.

비디오 설명

BiliBili 링크

프로그래밍 질문 : Redis + FastDFS 작은 동영상 업로드

기술

로드 밸런싱에 nginx를 사용하고 FastDFS 서버를 구성하십시오.

upstream renda {
    
    
    server 192.168.1.116:8001;
    server 192.168.1.116:8002;
}

server {
    
    
    listen       80;
    server_name  www.videouploadtest.com;
    # set client body size to 10M
    client_max_body_size 10M;
    location / {
    
    
        proxy_pass http://renda;
        index index.html index.htm;
    }
}


server {
    
    
    listen       80;
    server_name  www.fdfsstorage.com;

    location /group1/M00 {
    
    
        root /home/fastdfs/fdfs_storage/data;
        ngx_fastdfs_module;
    }
}

SwitchHosts를 사용하여 로컬 호스트 주소를 편집합니다.

# video upload hw
192.168.186.128 www.videouploadtest.com # 上传视频业务
192.168.186.128 www.fdfsstorage.com # FastDFS 小视频存储仓库

Nginx를 다시 시작합니다.

/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

FastDFS의 추적기를 시작합니다.

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

FastDFS 저장소 시작 :

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

Redis 시작 :

/usr/local/bin/redis-server /opt/redis-5.0.4/redis.conf

프로젝트 코드를 두 번 시작하면 포트 번호는 각각 8001과 8002입니다.

JMeter를 사용하여 1 초 내에 10 개의 http 요청을 시뮬레이션합니다.

서버에 업로드 된 비디오 파일을 보려면 다음 명령을 실행하십시오.

cd /home/fastdfs/fdfs_storage/data/00/00/
ll

추천

출처blog.csdn.net/qq_40286307/article/details/109220235