One way is to load the configuration file by invoking the initialization method of the Clientglobal class, and the other is to set the configuration parameters one by two by invoking the API. The latter approach is convenient for loading properties using zookeeper.
1. Load the configuration file:
1 " conf/dfs-client.conf " ; 2 Try { 3
2. Actively set configuration parameters:
1 //time limit for connection timeout, in milliseconds2Clientglobal.setg_connect_timeout ( -); 3 4 //Network Time-out time, in milliseconds5Clientglobal.setg_network_timeout (30000); 6 7Clientglobal.setg_anti_steal_token (false); 8 9 //Character SetTenClientglobal.setg_charset ("UTF-8"); One AClientglobal.setg_secret_key (NULL); - - //port number of the HTTP access Service theClientglobal.setg_tracker_http_port (7271); - - //Tracker Server List -inetsocketaddress[] Tracker_servers =NewInetsocketaddress[sztrackerservers.length]; +tracker_servers[0] ="200.200.200.200:8080"; -tracker_servers[1] ="200.200.201.200:8080"; +tracker_servers[2] ="200.200.202.200:8080"; AClientglobal.setg_tracker_group (NewTrackergroup (trackerservers));
3. Parameter meaning
Connect_timeout, connection time-out
Network_timeout, Network timeout time
Anti_steal_token, anti-theft chain token
CharSet, Character set
Secret_key, key
Tracker_http_port,tracker Server provides the port for the HTTP service
Address List for Tracker_group,tracker Server Group
FASTDFS configuration, deployment and API usage interpretation (4) FASTDFS configuration detailed client configuration (RPM)