zoukankan      html  css  js  c++  java
  • solr入门命令

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

    导入文档:

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

    删除全部文档:

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

    删除示例:

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

    启动指定Node:

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

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

    上传配置文件到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
  • 相关阅读:
    前端笔记之React(五)Redux深入浅出
    前端笔记之React(四)生命周期&Virtual DOM和Diff算法&日历组件开发
    前端笔记之React(三)使用动态样式表&antd&React脚手架&props实战
    前端笔记之React(二)组件内部State&React实战&表单元素的受控
    前端笔记之React(一)初识React&组件&JSX语法
    详解Asp.net MVC DropDownLists
    String.Format格式说明
    jquery日历datepicker的使用方法
    asp.net文本编辑器(FCKeditor)
    将jira添加至开机自启动
  • 原文地址:https://www.cnblogs.com/sheeva/p/5474784.html
Copyright © 2011-2022 走看看