solr上线下线core

1         solr上线下线core

有时候咱们须要shard不存在replica的时候作测试。好比下面的状况。node

如今咱们每一个shard保留一个副本。async

 

咱们能够用unloud命令测试

 

下线spa

http://slave3:8983/solr/admin/cores?action=UNLOAD&core=ZGCPWSWCORE2_shard1_replica2.net

 

重启blog

http://slave3:8983/solr/admin/cores?action=RELOAD&core=ZGCPWSWCORE2_shard1_replica2索引

 

发现此时重启,不能发现这个core,这里注意,unload并非下线,而是卸载。说明这个索引已经被卸载了,删除了,好比用下面的方法:rem

 

建立同步

http://slave3:8983/solr/admin/cores?action=CREATE&name=ZGCPWSWCORE2_shard1_replica2&collection=ZGCPWSWCORE2&shard=shard1it

 

此时他会自动同步索引。

 

问题:咱们需求是暂时下线core,等会又上线。并非删除,查看core的操做。参考:

http://blog.csdn.net/a925907195/article/details/45421529

里面有下线core

6.下线core

官方示例:http://localhost:8983/solr/admin/cores?action=UNLOAD&core=core0

可选参数:

                

1.    deleteIndex: if true, will remove the index when unloading the core.

·         deleteDataDir: if true, removes the data directory and all sub-directories.

·         deleteInstanceDir: if true, removes everything related to the core, including the index directory, configuration files, and other related files.

·            async: if set to a value, makes the call asynchronous. This call can then be tracked using the REQUESTSTATUS API.

 

因此,只有加上参数,才会删除数据。咱们用

http://slave3:8983/solr/admin/cores?action=UNLOAD&core=ZGCPWSWCORE2_shard1_replica2

并无删除数据,必定是作了一个标志,进入管理界面。

 

右上角:Instance:/var/lib/solr/ZGCPWSWCORE2_shard2_replica2

 

当此节点没下线的时候,进入这个文件夹:输入ll

 

drwxr-xr-x  2 solr solr 4096 May 16 15:51 ./

drwxr-xr-x 15 solr solr 4096 May 16 15:52 ../

-rw-r--r--  1 solr solr  171 Mar 28 09:57 core.properties

 

打开core.properties

#Written by CorePropertiesLocator

#Mon Mar 28 09:57:27 CST 2016

numShards=5

name=ZGCPWSWCORE2_shard2_replica2

shard=shard2

collection=ZGCPWSWCORE2

coreNodeName=core_node2

 

这个core的信息。如今把这个core下线:

http://master:8983/solr/admin/cores?action=UNLOAD&core=ZGCPWSWCORE2_shard2_replica2

 

进入/var/lib/solr/ZGCPWSWCORE2_shard2_replica2

会发现

drwxr-xr-x  2 solr solr 4096 May 16 15:50 ./

drwxr-xr-x 15 solr solr 4096 Mar 30 16:19 ../

-rw-r--r--  1 solr solr  171 Mar 28 09:57 core.properties.unloaded

 

这里作了一个标记,用 mv   core.properties.unloaded    core.properties

从新启动solr服务,就会找到这个core了。

相关文章
相关标签/搜索