网站建设资讯

NEWS

网站建设资讯

solr上线下线core的方法是什么

本篇内容介绍了“solr上线下线core的方法是什么”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

创新互联主要从事网站制作、成都网站设计、网页设计、企业做网站、公司建网站等业务。立足成都服务船山,10多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220

solr上线下线core

有时候我们需要shard不存在replica的时候做测试。比如下面的情况。

solr上线下线core的方法是什么

现在我们每个shard保留一个副本。

我们可以用unloud命令

下线

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

重启

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

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

创建

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

此时他会自动同步索引。

问题:我们需求是暂时下线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

并没有删除数据,一定是做了一个标志,进入管理界面。

solr上线下线core的方法是什么

右上角: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了。

“solr上线下线core的方法是什么”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


名称栏目:solr上线下线core的方法是什么
分享地址:http://cdweb.net/article/pegogi.html