<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>《Kafka+Spark Streaming+Redis实时计算整合实践》的评论</title>
	<atom:link href="http://shiyanjun.cn/archives/1097.html/feed" rel="self" type="application/rss+xml" />
	<link>http://shiyanjun.cn/archives/1097.html</link>
	<description>简单之美，难得简单，享受简单的唯美。</description>
	<lastBuildDate>Wed, 19 Feb 2025 08:08:30 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.2</generator>
	<item>
		<title>作者：rentao</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-141830</link>
		<dc:creator><![CDATA[rentao]]></dc:creator>
		<pubDate>Tue, 04 Aug 2020 08:38:13 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-141830</guid>
		<description><![CDATA[我测试过在Drvier端创建pool对象然后进行广播，但在excutor中通过broadcast.value获取的pool对象不能正常使用。具体原因也不清楚。。。]]></description>
		<content:encoded><![CDATA[<p>我测试过在Drvier端创建pool对象然后进行广播，但在excutor中通过broadcast.value获取的pool对象不能正常使用。具体原因也不清楚。。。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：rentao</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-141829</link>
		<dc:creator><![CDATA[rentao]]></dc:creator>
		<pubDate>Tue, 04 Aug 2020 08:29:55 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-141829</guid>
		<description><![CDATA[很好的文章。你在第一个例子中使用单例对象来定义redisPool，而scala中单例对象是具有懒加载属性的，我理解这里不加lazy关键字应该也能在yarn模式下运行呀？我测试了下把lazy字段去掉，在yarn模式下能正常运行。]]></description>
		<content:encoded><![CDATA[<p>很好的文章。你在第一个例子中使用单例对象来定义redisPool，而scala中单例对象是具有懒加载属性的，我理解这里不加lazy关键字应该也能在yarn模式下运行呀？我测试了下把lazy字段去掉，在yarn模式下能正常运行。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Yanjun</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-61240</link>
		<dc:creator><![CDATA[Yanjun]]></dc:creator>
		<pubDate>Sat, 22 Sep 2018 10:52:04 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-61240</guid>
		<description><![CDATA[可以用的啊，您可以配置一个主从复制Redis架构，主Redis做实时写，数据放到内存中，从Redis做复制，持久化数据。]]></description>
		<content:encoded><![CDATA[<p>可以用的啊，您可以配置一个主从复制Redis架构，主Redis做实时写，数据放到内存中，从Redis做复制，持久化数据。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：liucj</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-61225</link>
		<dc:creator><![CDATA[liucj]]></dc:creator>
		<pubDate>Fri, 21 Sep 2018 07:05:08 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-61225</guid>
		<description><![CDATA[能单独用redis做存储吗？数据丢失了怎么办]]></description>
		<content:encoded><![CDATA[<p>能单独用redis做存储吗？数据丢失了怎么办</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：zhangzai</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-60375</link>
		<dc:creator><![CDATA[zhangzai]]></dc:creator>
		<pubDate>Sat, 14 Jul 2018 07:53:52 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-60375</guid>
		<description><![CDATA[只能通过lazyrefrence的方式复用一个pool吗？可以放在broadcast里吗]]></description>
		<content:encoded><![CDATA[<p>只能通过lazyrefrence的方式复用一个pool吗？可以放在broadcast里吗</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Yanjun</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-60074</link>
		<dc:creator><![CDATA[Yanjun]]></dc:creator>
		<pubDate>Sun, 29 Apr 2018 14:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-60074</guid>
		<description><![CDATA[是的，文章中管理Redis连接确实有问题，应该放到foreachPartition中，对于每个Partition数据的处理，调度时会在一个Node上运行，也就是在一个Executor中，保证每Executor每JedisPool的对应关系。
我已经修正博文，感谢提出宝贵意见，谢谢！]]></description>
		<content:encoded><![CDATA[<p>是的，文章中管理Redis连接确实有问题，应该放到foreachPartition中，对于每个Partition数据的处理，调度时会在一个Node上运行，也就是在一个Executor中，保证每Executor每JedisPool的对应关系。<br />
我已经修正博文，感谢提出宝贵意见，谢谢！</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：汪旭</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-60010</link>
		<dc:creator><![CDATA[汪旭]]></dc:creator>
		<pubDate>Sun, 08 Apr 2018 07:37:48 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-60010</guid>
		<description><![CDATA[我也实现了这个方法，但是总是报错
foreachPartition(partition=&gt;{

      var pool = RedisClient.pool
      while(pool==null){
        pool=RedisClient.pool
      }
      partition.foreach(record=&gt;{
        val bro_jedis = pool.getResource
        bro_jedis.select(1)
          if(bro_jedis.exists(record._1)){
            val temp_num = bro_jedis.get(record._1).split(&quot;,&quot;)
            val total_num = temp_num(0).toInt
            val peak_num = temp_num(1).toInt
            bro_jedis.set(record._1,(record._2._1+total_num).toString+&quot;,&quot;+(record._2._2+peak_num).toString)
          }else{
            bro_jedis.set(record._1,record._2._1.toString+&quot;,&quot;+record._2._2.toString)
          }
          //RedisClient.pool.returnResource(bro_jedis)
        if(bro_jedis!=null){bro_jedis.close()}
      })
      if(pool!=null){pool.close()}
    })]]></description>
		<content:encoded><![CDATA[<p>我也实现了这个方法，但是总是报错<br />
foreachPartition(partition=&gt;{</p>
<p>      var pool = RedisClient.pool<br />
      while(pool==null){<br />
        pool=RedisClient.pool<br />
      }<br />
      partition.foreach(record=&gt;{<br />
        val bro_jedis = pool.getResource<br />
        bro_jedis.select(1)<br />
          if(bro_jedis.exists(record._1)){<br />
            val temp_num = bro_jedis.get(record._1).split(&#8220;,&#8221;)<br />
            val total_num = temp_num(0).toInt<br />
            val peak_num = temp_num(1).toInt<br />
            bro_jedis.set(record._1,(record._2._1+total_num).toString+&#8221;,&#8221;+(record._2._2+peak_num).toString)<br />
          }else{<br />
            bro_jedis.set(record._1,record._2._1.toString+&#8221;,&#8221;+record._2._2.toString)<br />
          }<br />
          //RedisClient.pool.returnResource(bro_jedis)<br />
        if(bro_jedis!=null){bro_jedis.close()}<br />
      })<br />
      if(pool!=null){pool.close()}<br />
    })</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：hzqtx</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-59343</link>
		<dc:creator><![CDATA[hzqtx]]></dc:creator>
		<pubDate>Mon, 13 Nov 2017 03:36:51 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-59343</guid>
		<description><![CDATA[这个redis pool 问题确实是一个严重问题，我当时花了较长时间才解决，应该在foreachPartition中定义 lazy reference 的 redis pool ，复用一个pool，这样才不会无限增长，当时我的应用数据量很大 一分钟就涨到几千个连接数。
文中的这种方式我也试过，是有问题的，会不断增长连接数。]]></description>
		<content:encoded><![CDATA[<p>这个redis pool 问题确实是一个严重问题，我当时花了较长时间才解决，应该在foreachPartition中定义 lazy reference 的 redis pool ，复用一个pool，这样才不会无限增长，当时我的应用数据量很大 一分钟就涨到几千个连接数。<br />
文中的这种方式我也试过，是有问题的，会不断增长连接数。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：dapeng</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-59273</link>
		<dc:creator><![CDATA[dapeng]]></dc:creator>
		<pubDate>Fri, 27 Oct 2017 09:35:32 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-59273</guid>
		<description><![CDATA[是不是要不然就会报redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool]]></description>
		<content:encoded><![CDATA[<p>是不是要不然就会报redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：letitgo</title>
		<link>http://shiyanjun.cn/archives/1097.html#comment-59210</link>
		<dc:creator><![CDATA[letitgo]]></dc:creator>
		<pubDate>Thu, 07 Sep 2017 07:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://shiyanjun.cn/?p=1097#comment-59210</guid>
		<description><![CDATA[InternalRedisClient 要放在最外层，否则redis pool会不断创建。]]></description>
		<content:encoded><![CDATA[<p>InternalRedisClient 要放在最外层，否则redis pool会不断创建。</p>
]]></content:encoded>
	</item>
</channel>
</rss>
