首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 互联网 >

solr对跨服务器表联合查询的配备

2013-09-05 
solr对跨服务器表联合查询的配置目前我们有两个库,不在同一个服务器上,如:A服务器上库有个account表,B服务

solr对跨服务器表联合查询的配置

目前我们有两个库,不在同一个服务器上,如:A服务器上库有个account表,B服务器上有个两个库:其实就是把一个大数据表拆分成两个库(这块我不明白为什么负责这个开发的人把一个表放在两个库里,而且每个库有多个表结构相同的表),比如 follow1有个表A B和C,follow2有个C D和E表,其实都是存放相同的数据,这六个表的数据差不多有1000W,现在建索引我这边需要一个多小时,data-config.xml配置如下

<dataConfig>

   <dataSource type="JdbcDataSource" name="ds-1" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://ip1:5901/relationship_1" user="****"   password="*****" batchSize="-1"/>   <dataSource type="JdbcDataSource" name="ds-2" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://ip1:5902/relationship_2" user="****"   password="******" batchSize="-1"/>   <dataSource type="JdbcDataSource" name="ds-3" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://ip2:3306/v506" user="****"   password="******" batchSize="-1"/>

 <document name="follow_log">   <entity dataSource="ds-1" name="following1" pk="logId" query="select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId, accountId,targetAccount,followFlag,friendFlag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_1 ) union all (select * from relationship_following_3 ) union all (select * from relationship_following_5 )) as f" deltaImportQuery="select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId, accountId,targetAccount,followFlag,friendFlag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_1 where cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) = '${dih.delta.logId}') union all (select * from relationship_following_3 where cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) = '${dih.delta.logId}') union all (select * from relationship_following_5 where cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) = '${dih.delta.logId}')) as f" deltaQuery="select f.logId from ((select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_1 where followTime >= '${dih.last_index_time}' or friendTime >= '${dih.last_index_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_3 where followTime >= '${dih.last_index_time}' or friendTime >= '${dih.last_index_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_5 where followTime >= '${dih.last_index_time}' or friendTime >= '${dih.last_index_time}')) as f">      <field column="logId" name="logId"/>      <field column="accountId" name="accountId"/>      <field column="targetAccount" name="targetAccount"/>      <field column="followFlag" name="followFlag"/>      <field column="friendFlag" name="friendFlag"/>      <field column="followTime" name="followTime"/>      <field column="friendTime" name="friendTime"/>      <field column="friendly" name="friendly"/>      <field column="blockFlag" name="blockFlag"/>      <field column="blockReason" name="blockReason"/>      <field column="blockTime" name="blockTime"/>      <field column="joinFlag" name="joinFlag"/>          <entity dataSource="ds-3" name="account" query="select name,photoPath,l99NO,accountType,online from account where accountId = '${following1.targetAccount}'">                  <field column="name" name="name"/>                  <field column="photoPath" name="photoPath"/>                  <field column="l99NO" name="l99NO"/>                  <field column="accountType" name="accountType"/>                  <field column="online" name="online"/>          </entity>   </entity>   <entity dataSource="ds-2" name="following2" pk="logId" query="select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId, accountId,targetAccount,followFlag,friendFlag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_2 ) union all (select * from relationship_following_4 ) union all (select * from relationship_following_6 )) as f" deltaImportQuery="select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId, accountId,targetAccount,followFlag,friendFlag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_2 where cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) = '${dih.delta.logId}') union all (select * from relationship_following_4 where cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) = '${dih.delta.logId}') union all (select * from relationship_following_6 where cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) = '${dih.delta.logId}')) as f" deltaQuery="select f.logId from ((select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_2 where followTime >= '${dih.last_index_time}' or friendTime >= '${dih.last_index_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_4 where followTime >= '${dih.last_index_time}' or friendTime >= '${dih.last_index_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_6 where followTime >= '${dih.last_index_time}' or friendTime >= '${dih.last_index_time}')) as f">      <field column="logId" name="logId"/>      <field column="accountId" name="accountId"/>      <field column="targetAccount" name="targetAccount"/>      <field column="followFlag" name="followFlag"/>      <field column="friendFlag" name="friendFlag"/>      <field column="followTime" name="followTime"/>

<field column="friendTime" name="friendTime"/>      <field column="friendly" name="friendly"/>      <field column="blockFlag" name="blockFlag"/>      <field column="blockReason" name="blockReason"/>      <field column="blockTime" name="blockTime"/>      <field column="joinFlag" name="joinFlag"/>          <entity dataSource="ds-3" name="account" query="select name,photoPath,l99NO,accountType,online from account where accountId = '${following2.targetAccount}'">                  <field column="name" name="name"/>                  <field column="photoPath" name="photoPath"/>                  <field column="l99NO" name="l99NO"/>                  <field column="accountType" name="accountType"/>                  <field column="online" name="online"/>          </entity>    </entity>   </document></dataConfig>


学习这个没多久,不知道有没有更好的办法来实现

热点排行