您的位置:首页 > 编程语言 > PHP开发

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

2013-11-05 17:21 1606 查看
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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐