<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Restart Solr from command line in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50033#M52654</link>
    <description>&lt;P&gt;Thank you that gives me exactly what I needed. Why would you say that management would be difficult?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2017 22:11:39 GMT</pubDate>
    <dc:creator>cpuengr</dc:creator>
    <dc:date>2017-01-26T22:11:39Z</dc:date>
    <item>
      <title>Restart Solr from command line</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50017#M52652</link>
      <description>&lt;P&gt;I am wondering if there is a way to restart Solr from the command line? I would like to script a restart of solr every night so that I dont have to do it manually.&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:58:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50017#M52652</guid>
      <dc:creator>cpuengr</dc:creator>
      <dc:date>2022-09-16T10:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Restart Solr from command line</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50031#M52653</link>
      <description>&lt;P&gt;If you are using Cloudera Manager, you can use the API present to do that.&lt;/P&gt;&lt;P&gt;The end point you will like to use will be : /&lt;A href="https://cloudera.github.io/cm_api/apidocs/v12/path__cm_service_roleCommands_restart.html" target="_blank"&gt;cm/service/roleCommands/restart&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I would not recommend to do restart outside of the CM cause the management will be difficult.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doc Link :&amp;nbsp;&lt;A href="https://cloudera.github.io/cm_api/apidocs/v12/" target="_blank"&gt;https://cloudera.github.io/cm_api/apidocs/v12/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 22:05:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50031#M52653</guid>
      <dc:creator>surajacharya</dc:creator>
      <dc:date>2017-01-26T22:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Restart Solr from command line</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50033#M52654</link>
      <description>&lt;P&gt;Thank you that gives me exactly what I needed. Why would you say that management would be difficult?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 22:11:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50033#M52654</guid>
      <dc:creator>cpuengr</dc:creator>
      <dc:date>2017-01-26T22:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Restart Solr from command line</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50039#M52655</link>
      <description>If a node dies, it will be difficult to track which one died and which ones are running.&lt;BR /&gt;If you have installed it completely outside of CM and are using an external Management tool, then you might have to deal with how other services interact with each other .&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Thu, 26 Jan 2017 23:35:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/50039#M52655</guid>
      <dc:creator>surajacharya</dc:creator>
      <dc:date>2017-01-26T23:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Restart Solr from command line</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/65616#M52656</link>
      <description>&lt;P&gt;#!/usr/bin/env python&lt;BR /&gt;import ssl,sys,time&lt;BR /&gt;from cm_api.api_client import ApiResource&lt;BR /&gt;from cm_api.endpoints.types import ApiClusterTemplate&lt;BR /&gt;from cm_api.endpoints.cms import ClouderaManager&lt;BR /&gt;from cm_api.endpoints import clusters, events, hosts, external_accounts, tools&lt;BR /&gt;from cm_api.endpoints import types, users, timeseries, roles, services&lt;/P&gt;&lt;P&gt;ssl._create_default_https_context = ssl._create_unverified_context&lt;BR /&gt;try:&lt;BR /&gt;&amp;nbsp; cm = ApiResource("CM_SERVER","7183","admin","CM_PASS","true","15")&lt;BR /&gt;&amp;nbsp; cluster = cm.get_cluster("CLUSTER_NAME")&lt;BR /&gt;except:&lt;BR /&gt;&amp;nbsp; print "Failed log into cluster %s" % ("&lt;SPAN&gt;CLUSTER_NAME&lt;/SPAN&gt;")&lt;BR /&gt;&amp;nbsp; sys.exit(0)&lt;/P&gt;&lt;P&gt;servers = [&lt;BR /&gt;"server1.company.com",&lt;BR /&gt;"&lt;SPAN&gt;server2.&lt;/SPAN&gt;&lt;SPAN&gt;company&lt;/SPAN&gt;.com",&lt;BR /&gt;"&lt;SPAN&gt;server3.&lt;/SPAN&gt;&lt;SPAN&gt;company&lt;/SPAN&gt;.com"]&lt;/P&gt;&lt;P&gt;s = cluster.get_service("solr")&lt;BR /&gt;ra = []&lt;BR /&gt;for r in s.get_roles_by_type("SOLR_SERVER"):&lt;BR /&gt;&amp;nbsp; hostname = cm.get_host(r.hostRef.hostId).hostname&lt;BR /&gt;&amp;nbsp; if hostname in servers:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ra.append([hostname,r])&lt;BR /&gt;ra.sort()&lt;BR /&gt;print "\nWill restart %s SOLR instances" % len(ra)&lt;BR /&gt;for hostname,r in ra:&lt;BR /&gt;&amp;nbsp; print "\nRestarting SOLR on %s" % (hostname)&lt;BR /&gt;&amp;nbsp; s.restart_roles(r.name)&lt;BR /&gt;&amp;nbsp; r = s.get_role(r.name)&lt;BR /&gt;&amp;nbsp; wait = time.time() + 180 # three minutes&lt;BR /&gt;&amp;nbsp; while r.roleState != "STARTED":&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print "Role State = %s" % (r.roleState)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print "Waiting for role state to be STARTED"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print time.strftime("%H:%M:%S")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if time.time() &amp;gt; wait:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; print "SOLR failed to restart on %s" % (hostname)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sys.exit(1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; time.sleep(10)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; r = s.get_role(r.name)&lt;BR /&gt;&amp;nbsp; print "SOLR restarted on %s" % (hostname)&lt;/P&gt;&lt;P&gt;print "\nAll SOLR roles restarted"&lt;BR /&gt;sys.exit(0)&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 21:45:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Restart-Solr-from-command-line/m-p/65616#M52656</guid>
      <dc:creator>regeamor</dc:creator>
      <dc:date>2018-03-20T21:45:25Z</dc:date>
    </item>
  </channel>
</rss>

