1、建立solr1 solr2 solr3目录
2、在目录下unzip solr.zip tar -zxvf solr.tar.gz
3、启动:
nohup java -Dbootstrap_confdir=../conf -Dcollection.configName=collectionName -DzkHost=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183 -DSTOP.PORT=4001 -DSTOP.KEY=key -jar -Xmx2g -Xms2g start.jar &
指明分片数和 启动端口的启动命令
nohup java -Dbootstrap_confdir=../conf -Dcollection.configName=collectionName -DzkHost=127.0.0.1:2181,127.0.0.1:2183 -DnumShards=2 -Djetty.port=8999 -DSTOP.PORT=4002 -DSTOP.KEY=key -jar -Xmx2g -Xms2g start.jar &
停止
:
java -DSTOP.PORT=4001 -DSTOP.KEY=key -jar start.jar --stop
参数说明
Dbootstrap_confdir
配置文件
Dcollection.configName
集合名
DzkHost zookeeper
名
DnumShards
分片数
Djetty.port jetty
服务端口(也支持tomcat)
DSTOP.PORT
停止服务的端口
curl 创建和删除集合
创建collection
curl 'http://127.0.0.1:8988/solr/admin/collections?action=CREATE&name=test&numShards=2&replicationFactor=2&collection.configName=user_tags_conf'
指定核和分片删除
curl 'http://127.0.0.1:8988/solr/admin/collections?action=DELETEREPLICA&replica=core1&collection=test&shard=shard1'
整体删除collection
curl 'http://127.0.0.1:8988/solr/admin/collections?action=DELETE&name=test'
其他
/admin/collections?action=RELOAD: reload a collection
/admin/collections?action=SPLITSHARD: split a shard into two new shards
/admin/collections?action=CREATESHARD: create a new shard
/admin/collections?action=DELETESHARD: delete an inactive shard
/admin/collections?action=CREATEALIAS: create or modify an alias for a collection
/admin/collections?action=DELETEALIAS: delete an alias for a collection
/admin/collections?action=DELETEREPLICA: delete a replica of a shard
/admin/collections?action=ADDREPLICA: add a replica of a shard
/admin/collections?action=CLUSTERPROP: Add/edit/delete a cluster-wide property
/admin/collections?action=MIGRATE: Migrate documents to another collection
/admin/collections?action=ADDROLE: Add a specific role to a node in the cluster
/admin/collections?action=REMOVEROLE: Remove an assigned role
/admin/collections?action=OVERSEERSTATUS: Get status and statistics of the overseer
/admin/collections?action=CLUSTERSTATUS: Get cluster status
/admin/collections?action=REQUESTSTATUS: Get the status of a previous asynchronous request
/admin/collections?action=LIST: List all collections
图形界面操作
删除索引 xml下的
<delete><query>id:663463_b5NwvIrW8</query></delete>
<commit/>
查询
tags:40 AND tags:男 AND (tags:北京 OR tags:天津 OR tags:南京 OR tags:上海)