记一次SolrCloud某一服务器硬盘故障

今天SolrCloud的1号服务器挂了,管理员跟我说应该是硬盘坏了,数据可能保不住。虽然5台服务器,每个分片都有3个备份,也就是说有3台服务器运行,整个SolrCloud服务器就能正常运行。但是1号服务器挂了还是造成一些影响。

首先,前端网站和SolrCloud是用RESTful API连接的,而且,是用一个固定ip地址,刚刚好就是1号服务器。所以,需要前端工程师把所有的ip切换到2号上。

还有一个就是所有的索引配置文件都是放在1号服务器上的。这个时候就很庆幸使用的Solr版本已经升级到了5.5.4。 Solr-5.5.4脚本有控制ZooKeeper的相关命令,可以上传或下载配置文件。

-bash-3.2$ bash ./bin/solr zk
Zookeeper operation (one of '-upconfig' or  '-downconfig') is required!
Usage: solr zk [-upconfig|-downconfig] [-d confdir] [-n configName] [-z zkHost]

     -upconfig to move a configset from the local machine to Zookeeper.

     -downconfig to move a configset from Zookeeper to the local machine.

     -n configName    Name of the configset in Zookeeper that will be the destinatino of
                       'upconfig' and the source for 'downconfig'.

     -d confdir       The local directory the configuration will be uploaded from for
                      'upconfig' or downloaded to for 'downconfig'. For 'upconfig', this
                      can be one of the example configsets, basic_configs, data_driven_schema_configs or
                      sample_techproducts_configs or an arbitrary directory.

     -z zkHost        Zookeeper connection string.

  NOTE: Solr must have been started least once (or have it running) before using this command.
        This initialized Zookeeper for Solr
-bash-3.2$ bash ./bin/solr zk -downconfig -d server/solr/configsets/my_configs -n my_configs -z 192.168.0.2:2181

zk 表示ZooKeeper操作;
<-downconfig 下载配置文件>
<-d 保存路径> (这里要注意不能只写配置文件夹名,而是要加上server/solr/configsets/)
<-n 配置文件名>
<-z ZooKeeper地址> (zkHost:2181)

现在,就等换了硬盘修复数据了。


终于换了硬盘,服务器可以使用,不过全部数据没有备份,只能一步步来了。
先配置Java环境;复制solr-5.5.4和zookeeper-3.4.6两个文件夹过来;修改zookeeper的配置;创建solr home文件夹,复制solr.xml和zoo.cfg进去;启动zookeeper;
这里遇到了问题,zookeeper启动不起来,查看zookeeper.out文件,有一堆Have smaller server identifier, so dropping the connection: (2, 1)这样的log。telnet一下,发现端口不通。后来发现是防火墙没有关。关掉后zookeeper就连接成功了。

然后启动solr。
由于solr home里面空空如也,原来的索引文件和配置都没了,所以在Admin UI上看几个Collection上1号服务器的状态都是down,无法恢复备份。这时需要手动删除原来1号服务器的replica,再添加replica,就可以了。
先切换到new UI, 点击左侧Collection项,点击某一个Collection,在右侧shard中选择状态为down的1号服务器节点,点击“红×”,点击“Delete Replica”按钮。成功后按钮会变绿色。这时再点击“add replica”,选择服务器地址,添加备份。索引比较多,需要一个个去点击。全部成功后在Cloud可以看到颜色回复绿色或浅黄色(正在备份)。
这里写图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值