Could not connect to ZooKeeper slave01:2181,slave02:2181,slave03:2181

原创 2015年11月20日 17:20:53

这是在通过写MapReduce读取HBase的数据,给指定的列加上索引到solr发现的

zookeeper.out日志

2015-11-20 16:59:20,603 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.77 - max is 60
2015-11-20 16:59:20,619 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.76 - max is 60
2015-11-20 16:59:20,762 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.76 - max is 60
2015-11-20 16:59:20,774 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.77 - max is 60
2015-11-20 16:59:20,915 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.76 - max is 60
2015-11-20 16:59:20,973 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.77 - max is 60
2015-11-20 16:59:21,219 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.77 - max is 60
2015-11-20 16:59:22,058 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@193] - Too many connections from /10.21.3.77 - max is 60


MapReduce执行报错
15/11/20 16:59:41 INFO mapreduce.Job: Task Id : attempt_1448000031899_0003_m_000012_2, Status : FAILED
Error: org.apache.solr.common.SolrException: java.util.concurrent.TimeoutException: Could not connect to ZooKeeper slave01:2181,slave02:2181,slave03:2181 within 10000 ms
        at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:164)
        at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:115)
        at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:105)
        at org.apache.solr.common.cloud.ZkStateReader.<init>(ZkStateReader.java:212)
        at org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:241)
        at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:524)
        at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:124)
        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
        at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:102)
        at com.yiban.mapreduce.HBaseToSolrIndex$HBaseToSolrIndexMapper.map(HBaseToSolrIndex.java:60)
        at com.yiban.mapreduce.HBaseToSolrIndex$HBaseToSolrIndexMapper.map(HBaseToSolrIndex.java:29)
        at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1656)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.util.concurrent.TimeoutException: Could not connect to ZooKeeper slave01:2181,slave02:2181,slave03:2181 within 10000 ms
        at org.apache.solr.common.cloud.ConnectionManager.waitForConnected(ConnectionManager.java:223)
        at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:156)
        ... 18 more




查看zookeeper 2181端口的连接数:使用netstat -nap | grep 2181 | wc -l查看
正常连接数
[root@slave01 hbase-1.0.2]#  netstat -nap | grep 2181 | wc -l
11
[root@slave02 lib]#  netstat -nap | grep 2181 | wc -l
11
[root@slave03 lib]# netstat -nap | grep 2181 | wc -l
15
运行MapReduce连接数,太多不正常
[root@slave01 hbase-1.0.2]#  netstat -nap | grep 2181 | wc -l
801
[root@slave01 hbase-1.0.2]#  netstat -nap | grep 2181 | wc -l
826
[root@slave02 lib]#  netstat -nap | grep 2181 | wc -l
566
[root@slave02 lib]#  netstat -nap | grep 2181 | wc -l
641
[root@slave03 lib]# netstat -nap | grep 2181 | wc -l
196
[root@slave03 lib]# netstat -nap | grep 2181 | wc -l
529
[root@slave03 lib]# netstat -nap | grep 2181 | wc -l
563
[root@slave03 lib]# ^C
[root@slave03 lib]# netstat -nap | grep 2181 | wc -l
546


有问题代码
写在MapReduce里的map方法里面(这里是局部变量,每调用一次map方法就会创建一个zookeeper连接,导致连接数直线上升)
CloudSolrServer solrServer = new CloudSolrServer("slave01:2181,slave02:2181,slave03:2181");//获取zookeeper地址
正常代码
写在加载时的静态块里面(整个MapReduce只创建一个zookeeper连接)
private static CloudSolrServer solrServer;
static{
solrServer = new CloudSolrServer("slave01:2181,slave02:2181,slave03:2181");//获取zookeeper地址

}

总结:不管是什么连接,能用全局创建尽量用全局创建,这样能避免连接数过多问题

相关文章推荐

Spark排错与优化

此文章新地址一.报错常见错误1.shuffle.FetchFailedException错误提示(1) missing output locationorg.apache.spark.shuffle....
  • lsshlsw
  • lsshlsw
  • 2015年10月15日 17:08
  • 31969

org.apache.zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:218

在vmware中安装hadoop伪分布式,使用host-only模式使用hbase shell一直正常,后来为了能上网改为了Briged模式。 启动后再命令端看到了关于hbase的异常信息org.a...

解决zookeeper报错[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@362] - Exception causing close

zookeeper.out报错: 2016-12-10 18:05:46,958 [myid:3] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:...

异常 dubbo中provider和consumer加载异常 Zookeeper注册

异常如下 INFO zkclient.ZkEventThread - Starting ZkClient event thread.  INFO zkclient.ZkEventThread - Te...

ZooKeeper安装运行

ZooKeeper介绍   ZooKeeper是Hadoop的正式子项目,它是一个针对大型分布式系统的可靠协调系统,提供的功能包括:配置维护、名字服务、分布式同步、组服务等。ZooKeeper的目标就...
  • cuiran
  • cuiran
  • 2013年01月16日 14:51
  • 24938

zookeeper启动失败的排错

运行zookeeperd后显示启动成功: JMX enabled by default Using config: /data/programfiles/zookeeper-3.4.5/b...
  • newjueqi
  • newjueqi
  • 2014年08月12日 17:57
  • 49269

zookeeper启动失败的排错

1.执行zkServer.sh start 后显示: JMX enabled by default Using config:/home/hadoop/app/zookeeper-3.4.5/bi...

solr - org.apache.solr.common.SolrException: Could not load config for solrconfig.xml

错误:org.apache.solr.common.SolrException: Could not load config for solrconfig.xml 解决:solr/home位置不对。...
  • chruan
  • chruan
  • 2013年03月07日 09:07
  • 19128

solr SearchHandler扩展,解决httpclient连接问题以及对连接异常的容错处理

solr SearchHandler扩展,解决httpclient连接问题以及对连接异常的容错处理 solr 1.4在分布式搜索时,如果有一台机请求失败,默认会重连3次,如果还是失败...

dubbo-provider启动报错:Unable to connect to zookeeper server within timeout: 5000

确认网络访问正常,确认dubbo配置是官方提供的示例配置情况下报错如下: 2017-08-30 21:03:12,774 [main-EventThread] [org.apache.zookeepe...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Could not connect to ZooKeeper slave01:2181,slave02:2181,slave03:2181
举报原因:
原因补充:

(最多只允许输入30个字)