2021-02-16

2522 단어 linux
docker 설치fastdfs
  • 미러 인덱스 docker pull delron/fastdfs
  • tracker 서비스 시작 docker run -d --network=host --name tracker -v/root/fastdfs/tracker:/var/fdfs delron/fastdfs tracker
  • storage 서비스 시작
  • docker run -d --name storage --restart=always --net host -v /root/fastdfs/storage:/var/fdfs -e TRACKER_SERVER="IP  :22122" delron/fastdfs storage
    
  • 가장 기초적인fastdfs는 이미 사용할 수 있습니다
  • 테스트
    docker exec -it storage bash
    echo "test" > test.txt         
    fdfs_upload_file /etc/fdfs/client.conf test.txt  
          
    ip:8888/group1/M00/00/00/**********************
    
  • 여러 항목이 사용하지 않는 경로 저장소를 사용합니다
    프로젝트 환경은 단일 노드로 같은 그룹 아래에서 프로젝트 디렉터리로 나누어 서로 다른 프로젝트 내용을 저장한다.
    새 스토리지 디렉토리
    mkdir -p/data/fastdfs/storage/blog
    저장 파일 편집
    vim/etc/fdfs/storage를 편집합니다.conf
    store_path_count=2
    
    store_path0=/data/fastdfs/storage/blog
    store_path1=/data/fastdfs/storage/img
    
    

    mod 편집fastdfs.conf
    [root@VM-0-9-centos ~]# vim /etc/fdfs/mod_fastdfs.conf 
    
    store_path_count=2
    
    
    store_path0=/data/fastdfs/storage/blog
    store_path1=/data/fastdfs/storage/img
    
    
    
    group_count = 0
    
    
    [group1]
    group_name=group1
    storage_server_port=23000
    store_path_count=2
    store_path0=/data/fastdfs/storage/blog
    store_path1=/data/fastdfs/storage/img
    
    
    

    nginx 설정
  • 2급 도메인 이름을 설정하고 8888 포트vim/root/nginx/conf.d/blog를 가리킵니다.conf
    server {
    
        listen 80;
    
        server_name img.lvxiaoyi.top;
    
        location / {
    
            proxy_set_header X-Real-IP $remote_addr;
    
            proxy_set_header Host $http_host;
    
            proxy_pass http://IP  :8888;
        }
    }
    
    
  • vim/usr/local/nginx/conf/nginx.conf
  • server {
            listen       8888;
            server_name      ;
            #location ~/group[0-9]/ {
            #    ngx_fastdfs_module;
            #}
            #
    
            location /group1/M00 {
              alias  /data/fastdfs/storage/blog/data;
              # ngx_fastdfs_module;
            }
    
            location /group1/M01 {
              alias /data/fastdfs/storage/img/data;
              # ngx_fastdfs_module;
            }
    
    

    테스트
    파일을 첫 번째 항목으로 전송
    fdfs_upload_file /etc/fdfs/client.conf test.txt IP  :23000 0
    
    group1/M00/00/00/rBEACWAqiOeAD54SAAAAIE3xxaY240.txt
    
    
    
    

    파일을 두 번째 파일로 전송
    fdfs_upload_file /etc/fdfs/client.conf test.txt IP  :23000 1
    

    방문
    http://  /group1/M00/00/00/rBEACWAqiOeAD54SAAAAIE3xxaY240.txt
    

    좋은 웹페이지 즐겨찾기