SolrCloud应用

devefx 2014-09-25

SolrCloud:

1:Down掉节点处理:

如果是 复制备份节点,则使用http命令直接删除再加上即可

恢复时间很长的复制/备份节点也可采取上述解决方案

2:对于某一个shards主节点和全部复制节点都down的情况,

使用http命令删除其中的某个节点,然后再加上去,这是发现全部正常.

但是再加上的节点数据确是空的,这是再次使用http命令删除刚才删除的那个节点,然后再加上去即可,等待一会,再次加上的那个节点会从 Recovering 模式转为正常模式

3:

对于zookeeper如果说它已经在某个进程号中起来了,但是实际没有那个进程,则把 Zookeeper 数据文件夹中的 zookeeper_server.pid 文件删除,再次启动即可

如果再次启动后因报错说IOException,则 吧Zookeeper中的数据文件夹和交易日志文件夹中的除配置文件以外的全部文件删除,再次启动即可,它会自动从 其它集群节点中获取数据,

这种只适用于 Zookeeper 集群模式

4:有时SolrCloud起不来,重启下SolrCloud然后等待有时是比较稳妥的办法.

-------------------------------------------------

 Distributed Requests:

Querying all shards for a collection should look familiar; it's as though SolrCloud didn't even come into play:

http://localhost:8983/solr/collection1/select?q=*:*

If, on the other hand, you wanted to search just one shard, you can specify that shard, as in:

http://localhost:8983/solr/collection1/select?q=*:*&shards=localhost:7574/solr

If you want to search a group of shards, you can specify them together:

http://localhost:8983/solr/collection1/select?q=*:*&shards=localhost:7574/solr,localho

st:8983/solr

Or you can specify a list of servers to choose from for load balancing purposes by using the pipe symbol (|):

http://localhost:8983/solr/collection1/select?q=*:*&shards=localhost:7574/solr|localho

st:7500/solr

(If you have explicitly created your shards using ZooKeeper and have shard IDs, you can use those IDs rather than

server addresses.)

You also have the option of searching multiple collections. For example:

http://localhost:8983/solr/collection1/select?collection=collection1,collection2,colle

ction3

SolrCollectionAPI:

/admin/collections?action=CREATEcreate a collection
/admin/collections?action=RELOADreload a collection
/admin/collections?action=SPLITSHARDsplit a shard into two new shards
/admin/collections?action=CREATESHARDcreate a new shard
/admin/collections?action=DELETESHARDdelete an inactive shard
/admin/collections?action=CREATEALIAScreate or modify an alias for a collection
/admin/collections?action=DELETEALIASdelete an alias for a collection
/admin/collections?action=DELETEdelete a collection
/admin/collections?action=DELETEREPLICAdelete a replica of a shard
/admin/collections?action=ADDREPLICAadd a replica of a shard
/admin/collections?action=CLUSTERPROPAdd/edit/delete a cluster-wide property <br />/admin/collections?action=MIGRATE: Migrate documents to another collection <br />/admin/collections?action=ADDROLE: Add a specific role to a node in the cluster <br />/admin/collections?action=REMOVEROLE: Remove an assigned role <br />/admin/collections?action=OVERSEERSTATUS: Get status and statistics of the overseer <br />/admin/collections?action=CLUSTERSTATUS:  Get cluster status
/admin/collections?action=REQUESTSTATUSGet the status of a previous asynchronous request
/admin/collections?action=LIST: List all collections 

ZK-CLI工具集:

zkcli.sh -zkhost localhost:9983 -cmd bootstrap -solrhome /opt/solr

根据[配置名称] 和 [本地配置路径] 上传本地Solr配置到ZooKeeper服务器:

zkcli.sh -zkhost localhost:9983 -cmd upconfig -confdir /opt/solr/collection1/conf -confname myconf

根据[配置名称] 下载ZooKeeper服务器配置到 [本地]

zkcli.sh -zkhost localhost:9983 -cmd downconfig -confdir /opt/solr/collection1/conf -confname myconf

连接Solr中的 [集合名称] 和 [配置名称] 的配置

zkcli.sh -zkhost localhost:9983 -cmd linkconfig -collection collection1 -confname myconf

....创建路径

zkcli.sh -zkhost localhost:9983 -cmd makepath /apache/solr

....将内容写到服务器上的某个文件

zkcli.sh -zkhost localhost:9983 -cmd put /solr.conf 'conf data'

....将本地文件写到服务器上的某个文件

zkcli.sh -zkhost localhost:9983 -cmd putfile /solr.xml /User/myuser/solr/solr.xml

....从服务器上查看某个文件的内容

zkcli.sh -zkhost localhost:9983 -cmd get /solr.xml

....从服务器上下载某个文件的内容

zkcli.sh -zkhost localhost:9983 -cmd getfile /solr.xml solr.xml.file

....

zkcli.sh -zkhost localhost:9983 -cmd clear /solr

zkcli.sh -zkhost localhost:9983 -cmd list

相关推荐