fix 421 Maximum login limit has been reached. on hdfs-over-ftp

refer:  http://clhjoe.wikispaces.com/fix+421+Maximum+login+limit+has+been+reached.+on+hdfs-over-ftp

hdfs-over-ftp是based on Apache ftpserver project的opensource软件,在我编dfs-fuse编不起来的时候实在是一个access hdfs的好方法,然而实际使用后发现常常会出现Maximum login limit has been reached的问题,trace一下code发现问题出现在ftpserver的ConnectionConfigFactory.java里private int maxLogins = 10;

所以当登入数超过10就一直喷error error error而hdfs-over-ftp又没有地方可以修改这个参数,所以只好自己改了。我是直接在HdfsOverFtpServer.java里修改了startServer()这个method

public static void startServer() throws Exception {
    log.info("Starting Hdfs-Over-Ftp server. port: " + port + " data-ports: " + passivePorts + " hdfs-uri: " + hdfsUri);
    HdfsOverFtpSystem.setHDFS_URI(hdfsUri);
    FtpServerFactory ftpServerFactory = new FtpServerFactory();
    //-->add for set connection limit
    ConnectionConfigFactory scf=new ConnectionConfigFactory (); 
    scf.setMaxLogins(999999);
    //--< 
    DataConnectionConfigurationFactory dataConFactory = new DataConnectionConfigurationFactory(); 
    dataConFactory.setPassivePorts(passivePorts);
    ListenerFactory listenerFactory = new ListenerFactory(); 
    //-->add for set connection limit
    listenerFactory.setDataConnectionConfiguration(dataConFactory.createDataConnectionConfiguration()); 
    //--<
    listenerFactory.setPort(port);
    Map listenerMap = new HashMap(); 
    listenerMap.put("default", listenerFactory.createListener());
    HdfsUserManager userManager = new HdfsUserManager(new Md5PasswordEncryptor(), new File("users.conf"), "admin");
    ftpServerFactory.setListeners(listenerMap);
    ftpServerFactory.setUserManager(userManager); 
    ftpServerFactory.setFileSystem(new HdfsFileSystemFactory()); 
    ftpServerFactory.setConnectionConfig(scf.createConnectionConfig()); 
    FtpServer ftpServer = ftpServerFactory.createServer(); 
    ftpServer.start(); 
}

修改了标记的两块,看不太懂原先hdfs-over-ftp.sh脚本的话,直接将command放screen执行java -cp .:lib/ftplet-api-1.0.0.jar:lib/slf4j-api-1.5.2.jar:lib/ftpserver-core-1.


对应ftpserver-1.0.0-M3这个版本

DefaultConnectionConfig.java里private int maxLogins = 10;

在HdfsOverFtpServer.java里修改了startServer()这个method,在相应位置对应添加如下两块即可

DefaultConnectionConfig con = new DefaultConnectionConfig();
con.setMaxLogins(0);//0代表无限制

server.setConnectionConfig(con);

你可能感兴趣的:(fix 421 Maximum login limit has been reached. on hdfs-over-ftp)