用Docker安装和运行FastDFS流程

1.获取fastfds镜像

    docker load -i ⽂文件路路径/fastdfs_docker.tar  使用下载好的文件安装

    docker image pull delron/fastdfs    

2.运行tracker

docker run -dti --network=host --name tracker -v /var/fdfs/tracker:/var/fdfs delron/fastdfs tracker
docker container start tracker    重新运行已有的tracker

3.运行storage

docker run -dti --network=host --name storage -e TRACKER_SERVER=10.211.55.5:22122 -v /var/fdfs/storage:/var/fdfs delron/fastdfs storage
docker container start storage

4.运行FastDFS客户端

    1.安装依赖包

    pip install fdfs_client-py-master.zip
    pip install mutagen
    pip isntall requests

    2.  .项⽬中准备客户端配置文件

client.conf
base_path=FastDFS客户端存放⽇日志⽂文件的⽬目录
tracker_server=运⾏行行tracker服务的机器器ip:22122

    3.    终端shell演练

运行:
    from fdfs_client.client import Fdfs_client
    client = Fdfs_client('meiduo_mall/utils/fastdfs/client.conf')
    ret = client.upload_by_filename('/Users/zhangjie/Desktop/01.jpeg')
结果:
    >>> ret = client.upload_by_filename('/Users/delron/Desktop/1.png')
    getting connection
    
    
    >>> ret
    {'Group name': 'group1', 'Remote file_id': 'group1/M00/00/02/CtM3BVr-k6SACjAIAAJctR1ennA809.png', 'Status': 'Upload successed.', 'Local file name': '/Users/delron/Desktop/1.png', 'Uploaded size': '151.00KB', 'Storage IP': '10.211.55.5'}
    >>>

你可能感兴趣的:(Docker,docker,FastDFS,ubuntu)