zoukankan      html  css  js  c++  java
  • FastDFS的配置、部署与API使用解读(4)FastDFS配置详解之Client配置(转)

    一种方式是通过调用ClientGlobal类的初始化方法对配置文件进行加载,另一种是通过调用API逐一设置配置参数。后一种方式对于使用Zookeeper等加载属性的方式很方便。


    1. 加载配置文件:

    1 String configFileName = "conf/dfs-client.conf";  
    2             try {  
    3                 ClientGlobal.init(configFileName); 

    2. 主动设置配置参数:

     1     //连接超时的时限,单位为毫秒  
     2     ClientGlobal.setG_connect_timeout(2000);  
     3       
     4     //网络超时的时限,单位为毫秒  
     5     ClientGlobal.setG_network_timeout(30000);  
     6       
     7     ClientGlobal.setG_anti_steal_token(false);  
     8       
     9     //字符集  
    10     ClientGlobal.setG_charset("UTF-8");  
    11       
    12     ClientGlobal.setG_secret_key(null);  
    13       
    14     //HTTP访问服务的端口号    
    15     ClientGlobal.setG_tracker_http_port(7271);  
    16       
    17     //Tracker服务器列表  
    18     InetSocketAddress[] tracker_servers = new InetSocketAddress[szTrackerServers.length];  
    19     tracker_servers[0] = "200.200.200.200:8080";  
    20     tracker_servers[1] = "200.200.201.200:8080";  
    21     tracker_servers[2] = "200.200.202.200:8080";  
    22     ClientGlobal.setG_tracker_group(new TrackerGroup(trackerServers));  

    3. 参数含义

    connect_timeout,连接超时时间

    network_timeout,网络超时时间

    anti_steal_token,防盗链Token

    charset,字符集

    secret_key,密钥

    tracker_http_port,Tracker Server提供HTTP服务的端口

    tracker_group,Tracker Server Group的地址列表

  • 相关阅读:
    Python 变量回收
    centos服务器内部开启端口
    mysql启动不起来汇总
    torch中DataLoader加载字典
    torch.meshgrid函数
    如何配置好python脚本的命令行参数
    git忽略文件,.gitignore配置
    jupyter如何解析命令行参数argv
    怎么制作虚拟环境的yaml
    如何提高matplotlib在jupyter中作图的分辨率
  • 原文地址:https://www.cnblogs.com/sandea/p/4439284.html
Copyright © 2011-2022 走看看