solr入門命令

#####################shell命令#############################html

導入文檔:node

sh bin/post -c gettingstarted docs/index.htmlshell

刪除所有文檔:curl

 sh bin/post -c gettingstarted -d "<delete><query>*:*</query></delete>"post

刪除示例:url

bin/solr stop -all ; rm -Rf example/cloud/spa

啓動指定Node:server

sh bin/solr start -c -s example/cloud/node1/solr/ -p 8983xml

sh bin/solr start -c -s example/cloud/node2/solr/ -p 7574htm

 

上傳配置文件到zk:

sh zkcli.sh -cmd upconfig -zkhost 127.0.0.1:2181 -confname default-configset -confdir /root/program-files/solr-5.1.0/configs

 

上傳文件到zk:

sh zkcli.sh -zkhost localhost:2181 -cmd putfile /solr.xml /path/to/solr.xml

 

建立collection:

curl 'http://127.0.0.1:8983/solr/admin/collections?action=CREATE&name=default-collection&instanceDir=default-collection&dataDir=data&config=solrconfig.xml&schema=schema.xml&numShards=2&collection.configName=default-configset&replicationFactor=2'

 

刪除collection:

curl 'http://localhost:8983/solr/admin/collections?action=delete&name=default-collection'

 

從新加載collection(可讓zk上修改後的配置文件生效):

curl 'http://localhost:8983/solr/admin/collections?action=RELOAD&name=default-collection'

 

建立core:

curl 'http://localhost:8983/solr/admin/cores?name=default-collection_shard1_replica2&action=create&collection=default-collection&shard=shard1'

 

刪除core:

curl 'http://localhost:8983/solr/admin/cores?action=UNLOAD&core=default-collection_shard2_replica1' (命令不會刪除core的實際文件夾,須要手動刪除)

 

刪除shard:

curl 'http://localhost:8983/solr/admin/collections?action=DELETESHARD&shard=shard1&collection=default-collection'

 

根據指定server目錄啓動一個實例:

sh bin/solr start -c -p 7574 -d server2 -z 127.0.0.1:2181

 

#####################http命令#############################

 #建立collection
http://10.125.2.44:8001/solr/admin/collections?wt=xml&indexInfo=false&action=CREATE&name=meixin_group&instanceDir=meixin_group&dataDir=data&config=solrconfig.xml&schema=schema.xml&collection=meixin_group&numShards=1&collection.configName=meixin_group&replicationFactor=2 
 
 
 #刪除collection
http://10.125.2.44:8001/solr/admin/collections?wt=xml&indexInfo=false&action=DELETE&name=meixin_topic

#reload collection
http://10.125.2.44:8001/solr/admin/collections?wt=xml&indexInfo=false&action=RELOAD&name=meixin_group 
 
 
 #刪除全部數據
http://10.125.2.44:8001/solr/meixin_group/update/?stream.body=<delete><query>*:*</query></delete>&stream.contentType=text/xml;charset=utf-8&commit=true 
 
#查看實時schema(用zk更新配置文件後,若是沒有reload,用該命令看到的schema是舊的,能夠用來檢測reload是否成功)
http://10.125.2.44:8001/solr/meixin_product/schema?wt=xml
 
#刷新collection(修改了zk上的collection配置文件後,用來使配置文件生效)
http://10.125.2.44:8001/solr/admin/collections?action=RELOAD&name=meixin_product
相關文章
相關標籤/搜索