Solrcloud service application of e-commerce system system notes

In the above solrcloud, we can build a solr search service for frequently searched data , and expose the service call interface through dubbo. The data indexed by solr needs to be synchronized with the database. We can configure the synchronization interval. The author of the original text triggers the synchronization by rest api. This is also a method, but it is not advisable in practical applications.

1. Configure the synchronization interval between the database and solr, the default is 30 minutes for incremental synchronization, here we modify it to 1 minute

#################################################

#                                               #

#       dataimport scheduler properties         #

#                                               #

#################################################

 

#  to sync or not to sync

#  1 - active; anything else - inactive

syncEnabled=1

 

#  which cores to schedule

#  in a multi-core environment you can decide which cores you want syncronized

#  leave empty or comment it out if using single-core deployment

syncCores=core1,core2

 

#  solr server name or IP address

#  [defaults to localhost if empty]

server=localhost

 

#  solr server port

#  [defaults to 80 if empty]

port=8080

 

#  application name/context

#  [defaults to current ServletContextListener's context (app) name]

webapp=solr

 

#  URL params [mandatory]

#  remainder of URL

params=/dataimport?command=delta-import&clean=false&commit=true

 

#  schedule interval

#  number of minutes between two runs

#  [defaults to 30 if empty]

interval=1

 

# The time interval for redoing the index, in minutes, the default is 7200, that is, 5 days;

# Empty, 0, or commented out: means never redo the index

reBuildIndexInterval=7200

 

# redo index parameters

reBuildIndexParams=/dataimport?command=full-import&clean=true&commit=true

 

# The timing start time of the redo index interval, the time of the first real execution = reBuildIndexBeginTime+reBuildIndexInterval*60*1000;

# Two formats: 2012-04-11 03:10:00 or 03:10:00, the latter will automatically complete the date part as the date when the service is started

reBuildIndexBeginTime=03:10:00

2. Trigger solr synchronization when data is modified. This solution can use asynchronous mode, such as MQ

In the system, after adding a product, it is necessary to update the cache and synchronize the index database, so we use the second solution to deal with it together ( I currently tend to operate the database, update the cache ), send a product addition message, multiple consumers listen, and then Perform cache addition and index library synchronization operations.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325402645&siteId=291194637