Saturday, August 24, 2013

Manually editing Solr's clusterstate.json on Zookeeper

There will probably come a time when you want to do something not readily covered in Solr's APIs.  Manually editing the clusterstate.json is easy to do but should be approached with caution.

I wanted to drop all shards from a single host from my Solr cluster (didn't care about losing the data) and do a little spring cleaning.  To open a command-line interface with ZK:

/path/to/zookeeper/bin/zkCli.sh -server 127.0.0.1:2181

Then simply:

get /clusterstate.json

Place that content into a local file.  After backing up the original content, make your edits.  For instance, to drop the dead nodes, delete JSON elements with "down" states:


To upload your new clusterstate.json (no need to halt services):

/path/to/zookeeper/bin/zkCli.sh -server 127.0.0.1:2181 set /clusterstate.json "`cat /local/path/to/clusterstate.json`"

35 comments:

  1. Thank you, this helped a lot.
    If we change zookeeper settings like above, do we need to change Solr settings manually? If so how can we do it.
    Currently I changed leader settings in Zookeeper but Solr is reporting its not the Leader.

    ReplyDelete
    Replies
    1. Sorry, never tried to change the leader manually so I don't know. I used to worry about who was the leader or the replica but then realized it didn't matter (at least for me).

      Delete
  2. Uploading new clusterstate.json with

    /path/to/zookeeper/bin/zkCli.sh -server 127.0.0.1:2181 set /clusterstate.json "`cat /local/path/to/clusterstate.json`"

    did not work, but

    /path/to/zookeeper/bin/zkCli.sh -server 127.0.0.1:2181 set /clusterstate.json "$(< /local/path/to/clusterstate.json)"

    worked.

    ReplyDelete
  3. 谢谢,我们集群中有个分片莫名奇妙就处于recovring状态,重启之后也没有用,但是日志中并不能发现什么显著错误,按照你的方法,我们手动更新了zookeeper中clusterstate.json,好使了.

    再次感谢

    ReplyDelete
  4. VoIP is an emerging technology with much more to come in the future. Why not enjoy free international and peer 800 in the meantime.

    ReplyDelete
  5. This list of ten of the most popular free Android apps is intended as a starting point for new Android phone users. Basically, these are the most popular because they are some of the best Android apps and really, in my opinion, everyone should have them downloaded on their Android phone. check my blog

    ReplyDelete
  6. As I website possessor I think the subject matter here is real wonderful, appreciate it for your efforts. Mega888 game client download

    ReplyDelete
  7. When selling new, disruptive technology, you're up against a number of challenges, even though what you offer upsets the game. Many entrepreneurial companies have brought extraordinary, world-changing technology to market yet failed because they ignored these five secrets. Read on to learn how you can successfully sell your new, disruptive technology. best app to spy the camera

    ReplyDelete
  8. Thank you for your very good information and respond to you. used car in san jose 토토사이트

    ReplyDelete
  9. Perhaps you have heard of a friend or coworker that has installed fake security cameras in their home or place of business. Will they actually stop a crime from occurring or are they just a waste of time and money? diy hidden camera with audio

    ReplyDelete
  10. Howdy! I know this is kinda off topic but I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog post or vice-versa? My site covers a lot of the same topics as yours and I believe we could greatly benefit from each other. If you’re interested feel free to send me an e-mail. I look forward to hearing from you! Terrific blog by the way! 188betlive

    ReplyDelete
  11. Hello my loved one! I wish to say that this article is amazing, nice written and include almost all vital infos. I would like to look more posts like this . mot88bet

    ReplyDelete
  12. I would like to thnkx for the efforts you have put in writing this blog. I’m hoping the same high-grade website post from you in the upcoming also. Actually your creative writing skills has inspired me to get my own site now. Actually the blogging is spreading its wings rapidly. Your write up is a good example of it. buy steroids

    ReplyDelete
  13. I just could not go away your website before suggesting that I extremely enjoyed the usual info a person supply to your guests? Is going to be back ceaselessly in order to inspect new posts. Buy HGH

    ReplyDelete
  14. After study several of the blogs for your site now, and i genuinely appreciate your way of blogging. I bookmarked it to my bookmark internet site list and will also be checking back soon. Pls look at my web page as well and figure out what you believe. parrots for sale

    ReplyDelete
  15. I just could not go away your site prior to suggesting that I really loved the usual info an individual supply in your visitors? Is gonna be again incessantly to check up on new posts. we will ship your bird

    ReplyDelete
  16. Simply wanna input on few general things, The website layout is perfect, the articles is really good : D. Rad platform

    ReplyDelete
  17. Hi, you have post here a very useful information for everyone who looking to learn more information on this topic. I read it with most enjoyment and believe that everyone can apply it for their own use. Thank you for useful post. Looking to read more from you. rapid development methodology

    ReplyDelete
  18. This is great! I think reading this, I loved every word. Seriously, keep posting the good information, bloggers like myself need it. search engine optimization

    ReplyDelete
  19. I must find the potential for to thank anyone for impressive pointers There are at all times appreciated possibilities a web page. We’re anxious about any graduation to do with your college explore along with the uncut groundwork could not have already been conclude without the need of arriving in your web blog. Household . instead , may well be from a assistance other individuals, Keep away from companies enjoy it to further in what I had learned at this point. hard wax hair removal

    ReplyDelete
  20. I must find the potential for to thank anyone for impressive pointers There are at all times appreciated possibilities a web page. We’re anxious about any graduation to do with your college explore along with the uncut groundwork could not have already been conclude without the need of arriving in your web blog. Household . instead , may well be from a assistance other individuals, Keep away from companies enjoy it to further in what I had learned at this point. ผู้สร้างลิงก์ย้อนกลับ

    ReplyDelete
  21. How can you write on this topic so effortlessly. Great piece of work dear! buy steroids online

    ReplyDelete
  22. I merely picked up your blog post a couple weeks ago i have actually been perusing this tool always. An individual has a lot of helpful tips at this point we absolutely love your lifestyle of a internet sites actually. Stick to the nice perform! buy steroids online

    ReplyDelete
  23. Yes, congratulations for this practical post. I will be preserving this post for future reference with the great lessons inside. I had always believed the best way to learn this topic is subscribing to those webinars and videos offered by professionals. Those videos proceed step by step into ways to help those considering the issue. Your blog post does the same thing. It is also a timesaver unlike all of the videos and webimars. buy hgh

    ReplyDelete
  24. Hello! I just want to give a enormous thumbs up for any wonderful information you have here during this post. I’ll be returning to your blog site for much more soon. buy hgh

    ReplyDelete
  25. Once I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a remark is added I get four emails with the identical comment. Is there any way you can take away me from that service? Thanks! buy clenbuterol

    ReplyDelete
  26. you possess a excellent weblog here! want to have invite posts on my weblog? clenbuterol for sale

    ReplyDelete
  27. Spot lets start work on this write-up, I honestly feel this web site needs considerably more consideration. I’ll probably be again to see considerably more, thank you that info. waxing

    ReplyDelete
  28. Once I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a remark is added I get four emails with the identical comment. Is there any way you can take away me from that service? Thanks! Denver

    ReplyDelete
  29. you possess a excellent weblog here! want to have invite posts on my weblog? Individual therapy

    ReplyDelete
  30. Nice post. I understand some thing tougher on different blogs everyday. It will always be stimulating to see content from other writers and practice something at their store. I’d prefer to use some with the content in my blog regardless of whether you don’t mind. Natually I’ll provide link on your web weblog. Thank you for sharing. harley quinn birds of prey merchandise

    ReplyDelete
  31. I just additional this particular feed to be able to my book marks. I need to say, I seriously take pleasure in reading your own sites. Keep it up! sophie dumond

    ReplyDelete
  32. I do agree with all of the ideas you have presented in your post. Theyre really convincing and will definitely work. Still, the posts are too short for beginners. Could you please extend them a bit from next time? Thanks for the post. silk sheets

    ReplyDelete
  33. I would like to thnkx for the efforts you’ve put in writing this web site. I’m hoping the same high-grade web site post from you in the upcoming also. Actually your creative writing skills has inspired me to get my own website now. Actually the blogging is spreading its wings fast. Your write up is a good example of it. silk robes for women

    ReplyDelete
  34. Today, enterprises around the globe understand the rising need for mobilizing their workforce to empower their businesses. Allowing employees to bring their personal mobile devices to work, namely, BYOD and providing Corporate Owned Personally Enabled (COPE) mobile devices to employees are becoming widely adopted mobile strategies in enterprises. best mobile app developer ins ingapore

    ReplyDelete