Commit 0c026d84 by [zhangzhiwei]

添加分库操作

parent 267df575
...@@ -2,6 +2,7 @@ package com.zhiwei.searchhotcrawler.dao; ...@@ -2,6 +2,7 @@ package com.zhiwei.searchhotcrawler.dao;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -12,6 +13,7 @@ import com.zhiwei.searchhotcrawler.bean.WeiboHotSearch; ...@@ -12,6 +13,7 @@ import com.zhiwei.searchhotcrawler.bean.WeiboHotSearch;
import com.zhiwei.searchhotcrawler.cache.CacheManager; import com.zhiwei.searchhotcrawler.cache.CacheManager;
import com.zhiwei.searchhotcrawler.config.Config; import com.zhiwei.searchhotcrawler.config.Config;
import com.zhiwei.searchhotcrawler.dbtemplate.MongoDBTemplate; import com.zhiwei.searchhotcrawler.dbtemplate.MongoDBTemplate;
import com.zhiwei.tools.timeparse.TimeParse;
import com.zhiwei.tools.tools.ZhiWeiTools; import com.zhiwei.tools.tools.ZhiWeiTools;
public class WeiboHotSearchDAO extends MongoDBTemplate{ public class WeiboHotSearchDAO extends MongoDBTemplate{
...@@ -19,10 +21,17 @@ public class WeiboHotSearchDAO extends MongoDBTemplate{ ...@@ -19,10 +21,17 @@ public class WeiboHotSearchDAO extends MongoDBTemplate{
public WeiboHotSearchDAO() { public WeiboHotSearchDAO() {
super(); super();
super.setDbName(Config.dbName); super.setDbName(Config.dbName);
// Date date = new Date();
// String time = TimeParse.dateFormartString(date, "yyyy");
// if(Calendar.MONTH<6){
// collWeiboName = Config.collWeiboName + time+"_01";
// }else{
// collWeiboName = Config.collWeiboName + time+"_06";
// }
// System.out.println("collWeiboName========="+collWeiboName);
super.setCollName(Config.collWeiboName); super.setCollName(Config.collWeiboName);
} }
/** /**
* @Title: addWeiboHotSearch * @Title: addWeiboHotSearch
* @author hero * @author hero
......
...@@ -23,15 +23,15 @@ public class HotSearchRun { ...@@ -23,15 +23,15 @@ public class HotSearchRun {
public void showTimer() { public void showTimer() {
scheduExec.scheduleAtFixedRate(new WeiboHotSearchRun(), 0, 1, TimeUnit.MINUTES); scheduExec.scheduleAtFixedRate(new WeiboHotSearchRun(), 0, 1, TimeUnit.MINUTES);
scheduExec.scheduleAtFixedRate(new ZhihuHotSearchRun(), 0, 1 , TimeUnit.MINUTES); // scheduExec.scheduleAtFixedRate(new ZhihuHotSearchRun(), 0, 1 , TimeUnit.MINUTES);
} }
public static void main(String[] args) { public static void main(String[] args) {
new UpdateWechatUserRun().start(); new UpdateWechatUserRun().start();
ZhiWeiTools.sleep(10000); ZhiWeiTools.sleep(10000);
new HotSearchRun().showTimer(); new HotSearchRun().showTimer();
new CacheListener().startListen(); // new CacheListener().startListen();
new SendWeiboHotSearchRun().start(); // new SendWeiboHotSearchRun().start();
new SendZhihuHotSearchRun().start(); // new SendZhihuHotSearchRun().start();
} }
} }
mongoIp=202.107.192.94 #mongoIp=202.107.192.94
#mongoIp=192.168.0.101 mongoIp=192.168.0.101
mongoPort=30000 mongoPort=30000
db.username=zzwno db.username=zzwno
db.paasword=zzwno1q2w3e4r db.paasword=zzwno1q2w3e4r
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment