SolrOperationsTools使用

basic Solr scripts

 

These scripts are used to manage the index data on the Solr server:

Name

Description

abc

Atomic Backup post-Commit tells the Solr server to perform a commit. A snapshot of the index directory is made after the commit if the Solr server is configured to do so (by enabling the postCommit event listener in solr/conf/solrconfig.xml ). A backup of the most recent snapshot directory is then made if the commit is successful. Backup directories are named backup.yyyymmddHHMMSS where yyyymmddHHMMSS is the timestamp of when the snaphot was taken.

abo

Atomic Backup post-Optimize tells the Solr server to perform an optimize. A snapshot of the index directory is made after the optimize if the Solr server is configured to do so (by enabling the postCommit or postOptimize event listener in solr/conf/solrconfig.xml ). A backup of the most recent snapshot directory is then made if the optimize is successful. Backup directories are named backup.yyyymmddHHMMSS where yyyymmddHHMMSS is the timestamp of when the snaphot was taken.

backup

Backup the index directory using hard links. Backup directories are named backup.yyyymmddHHMMSS where yyyymmddHHMMSS is the timestamp of when the backup was taken.

backupcleaner

Runs as a cron job to remove backups more than a configurable number of days old or all backups except for the most recent n number of backups. Also can be run manually.

commit

Issues a commit to the Solr server. This will also cause a snapshot to be created if the Solr server is configured to take a snapshot after a commit (by enabling the postCommit event listener in solr/conf/solrconfig.xml ).

optimize

Issues an optimize to the Solr server. Note : Optimization may take up to several minutes depending on the size of the index. This will also causes a snapshot to be created if the Solr server is configured to take a snapshot after an optimize (by enabling the postCommit or postOptimize event listener in solr/conf/solrconfig.xml ).

readercycle

tells the Solr server to close its current reader and open a new one. This has the effect of making any recent updates and deletions visible to the new reader.

 

 

abc

 

  • usage: abc [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-U url] [-v] [-V]
           -h          specify Solr hostname (defaults to localhost)
           -p          specify Solr port number
           -w          specify name of Solr webapp (defaults to solr)
           -u          specify user to sudo to before running script
           -U          specify full update url (overrides -h,-p,-w parameters)
           -d          specify directory holding index data (defaults to data)
           -v          increase verbosity
           -V          output debugging info

 

abo

 

  • usage: abo [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-U url] [-v] [-V]
           -h          specify Solr hostname (defaults to localhost)
           -p          specify Solr port number
           -w          specify name of Solr webapp (defaults to solr)
           -u          specify user to sudo to before running script
           -U          specify full update url (overrides -h,-p,-w parameters)
           -d          specify directory holding index data (defaults to data)
           -v          increase verbosity
           -V          output debugging info

 

backup

 

  • usage: backup [-d dir] [-u username] [-v]
           -d          specify directory holding index data
           -u          specify user to sudo to before running script
           -v          increase verbosity
           -V          output debugging info

 

backupcleaner

 

  • usage: backupcleaner -D <days> | -N <num> [-d dir] [-u username] [-v]
           -D <days>   cleanup backups more than <days> days old
           -N <num>    keep the most recent <num> number of backups and
                       cleanup up the remaining ones that are not being pulled
           -d          specify directory holding index data
           -u          specify user to sudo to before running script
           -v          increase verbosity
           -V          output debugging info

 

commit

 

  • usage: commit [-h hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V]
           -h          specify Solr hostname (defaults to localhost)
           -p          specify Solr port number
           -w          specify name of Solr webapp (defaults to solr)
           -u          specify user to sudo to before running script
           -U          specify full update url (overrides -h,-p,-w parameters)
           -v          increase verbosity
           -V          output debugging info

 

optimize

 

  • usage: optimize [-h hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V]
           -h          specify Solr hostname (defaults to localhost)
           -p          specify Solr port number
           -w          specify name of Solr webapp (defaults to solr)
           -u          specify user to sudo to before running script
           -U          specify full update url (overrides -h,-p,-w parameters)
           -v          increase verbosity
           -V          output debugging info

 

readercycle

 

usage: readercycle [-p hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V]
       -h          specify Solr hostname (defaults to localhost)
       -p          specify Solr port number
       -w          specify name of Solr webapp (defaults to solr)
       -u          specify user to sudo to before running script
       -U          specify full update url (overrides -h,-p,-w parameters)
       -v          increase verbosity
       -V          output debugging info

 

solr 优化索引成 2段或N段

默认 solr 优化索引的时候,只一个段,比起 N段(N不是很大)来说,可能有点耗时。索引为N段也不会一个文件太大。

可以有两种方式:

url:

  1. curl   "http://localhost:8080/solr/update?maxSegments=2&optimize=true"   
curl "http://localhost:8080/solr/update?maxSegments=2&optimize=true"

xml:

curl  http://localhost:8080/solr/update --data-binary  "<optimize maxSegments=\"2\" />"  -H  "Content-type:text/xml; charset=utf-8"


 

你可能感兴趣的:(Opera)