プログラミングの質問を説明するビデオ: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

プロジェクトコードを2回開始します。ポート番号は、それぞれ8001と8002です。

JMeterを使用して、1秒以内に10個のhttp要求をシミュレートします。

次のコマンドを実行して、サーバーにアップロードされたビデオファイルを表示します。

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

おすすめ

転載: blog.csdn.net/qq_40286307/article/details/109220235