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,friendF lag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_1 ) union all (select * from relationship_following_3 ) u nion all (select * from relationship_following_5 )) as f" deltaImportQuery="select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId, accountId,targetAccount,followF lag,friendFlag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_1 where cast(CONCAT(accountId,targetAccount) a s 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_ind ex_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_3 where followTime >= '${dih.last_index_time}' or friendTi me >= '${dih.last_index_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_5 where followTime >= '${dih.last_ind ex_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,friendF lag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_2 ) union all (select * from relationship_following_4 ) u nion all (select * from relationship_following_6 )) as f" deltaImportQuery="select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId, accountId,targetAccount,followF lag,friendFlag,followTime,friendTime,friendly,blockFlag,blockReason,blockTime,joinFlag from ((select * from relationship_following_2 where cast(CONCAT(accountId,targetAccount) a s 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_ind ex_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_4 where followTime >= '${dih.last_index_time}' or friendTi me >= '${dih.last_index_time}') union all (select cast(CONCAT(accountId,targetAccount) as SIGNED INTEGER) logId from relationship_following_6 where followTime >= '${dih.last_ind ex_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>


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

你可能感兴趣的:(mysql,索引,大数据,服务器,Solr)