{"id":123,"date":"2024-04-29T19:15:30","date_gmt":"2024-04-29T19:15:30","guid":{"rendered":"https:\/\/www.rajeshkumar.xyz\/blog\/?p=123"},"modified":"2024-05-01T19:36:00","modified_gmt":"2024-05-01T19:36:00","slug":"apache-solr-commands-line-options","status":"publish","type":"post","link":"https:\/\/www.rajeshkumar.xyz\/blog\/apache-solr-commands-line-options\/","title":{"rendered":"Apache Solr Commands line Options"},"content":{"rendered":"\n<p>Here&#8217;s a table summarizing some common Solr command-line options along with their descriptions:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>start<\/code><\/td><td>Starts Solr. Can include options for port, memory, etc.<\/td><\/tr><tr><td><code>stop<\/code><\/td><td>Stops a running Solr server.<\/td><\/tr><tr><td><code>restart<\/code><\/td><td>Restarts Solr. Useful for applying new configurations.<\/td><\/tr><tr><td><code>status<\/code><\/td><td>Checks the current status of Solr instances.<\/td><\/tr><tr><td><code>create<\/code><\/td><td>Creates a new Solr core or collection.<\/td><\/tr><tr><td><code>delete<\/code><\/td><td>Deletes an existing Solr core or collection.<\/td><\/tr><tr><td><code>version<\/code><\/td><td>Displays the current version of Solr.<\/td><\/tr><tr><td><code>-f<\/code><\/td><td>Runs Solr in the foreground, useful for monitoring logs directly.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>These commands are typically executed from within the <code>bin<\/code> directory of your Solr installation. Each command might have additional options and flags to control its behavior more precisely.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">.\/solr -h\n\n<span class=\"hljs-attr\">Usage<\/span>: solr COMMAND OPTIONS\n       where COMMAND is one <span class=\"hljs-keyword\">of<\/span>: start, stop, restart, status, healthcheck, create, create_core, create_collection, <span class=\"hljs-keyword\">delete<\/span>, version, zk, auth, assert, config, <span class=\"hljs-keyword\">export<\/span>, api, package, post, postlogs\n\n  Standalone server example (start Solr running <span class=\"hljs-keyword\">in<\/span> the background on port <span class=\"hljs-number\">8984<\/span>):\n\n    .\/solr start -p <span class=\"hljs-number\">8984<\/span>\n\n  SolrCloud example (start Solr running <span class=\"hljs-keyword\">in<\/span> SolrCloud mode using localhost:<span class=\"hljs-number\">2181<\/span> to connect to Zookeeper, <span class=\"hljs-keyword\">with<\/span> <span class=\"hljs-number\">1<\/span>g max heap size and remote Java debug options enabled):\n\n    .\/solr start -c -m <span class=\"hljs-number\">1<\/span>g -z localhost:<span class=\"hljs-number\">2181<\/span> -a <span class=\"hljs-string\">\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044\"<\/span>\n\n  Omit <span class=\"hljs-string\">'-z localhost:2181'<\/span> <span class=\"hljs-keyword\">from<\/span> the above command <span class=\"hljs-keyword\">if<\/span> you have defined ZK_HOST <span class=\"hljs-keyword\">in<\/span> solr.in.sh.\n\nPass -help or -h after any COMMAND to see command-specific usage information,\n  such <span class=\"hljs-keyword\">as<\/span>:    .\/solr start -help or .\/solr stop -h\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Apache Solr can be started with several different commands and options<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># Basic Start<\/span>\n<span class=\"hljs-comment\"># This command starts Solr on the default port 8983 with the default settings.<\/span>\nsolr start\n\n<span class=\"hljs-comment\"># Specifying the Port<\/span>\n<span class=\"hljs-comment\"># This command starts Solr on a specified port, in this case, 8984.<\/span>\nsolr start -p <span class=\"hljs-number\">8984<\/span>\n\n<span class=\"hljs-comment\"># Running Solr in Cloud Mode<\/span>\n<span class=\"hljs-comment\"># This starts Solr in cloud mode, which enables running Solr with distributed clustering using<\/span>\nsolr start -c\n\n<span class=\"hljs-comment\"># Specifying ZooKeeper Connection for Cloud Mode<\/span>\n<span class=\"hljs-comment\"># This starts Solr in cloud mode and specifies the ZooKeeper connection string (here, ZooKeeper running on localhost at port 2181).<\/span>\nsolr start -c -z localhost:<span class=\"hljs-number\">2181<\/span>\n\n<span class=\"hljs-comment\"># Using a Specific Solr Home Directory<\/span>\n<span class=\"hljs-comment\"># This command starts Solr with a specified SOLR_HOME directory.<\/span>\nsolr start -s \/path\/to\/solr\/home\n\n<span class=\"hljs-comment\"># Running Solr on a Specific Java Virtual Machine<\/span>\n<span class=\"hljs-comment\"># This sets the Java home before starting Solr, useful if you have multiple Java installations.<\/span>\nSOLR_JAVA_HOME=\/path\/to\/java\/home solr start\n\n<span class=\"hljs-comment\"># Increasing Java Memory<\/span>\n<span class=\"hljs-comment\"># This starts Solr with increased Java heap space, here setting the heap size to 4 gigabytes.<\/span>\nsolr start -m <span class=\"hljs-number\">4<\/span>g\n\n<span class=\"hljs-comment\"># Starting with Custom Solr Configuration<\/span>\n<span class=\"hljs-comment\"># This allows you to pass custom Java system properties to Solr at startup.<\/span>\nsolr start -a <span class=\"hljs-string\">\"-Dsolr.someConfig=someValue\"<\/span>\n\n<span class=\"hljs-comment\"># Starting Solr with Debugging Options<\/span>\n<span class=\"hljs-comment\"># This command starts Solr with Java debugging enabled, allowing a debugger to attach on port 1044.<\/span>\nsolr start -a <span class=\"hljs-string\">\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044\"<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">What is Running Solr in Cloud Mode?<\/h2>\n\n\n\n<p>Running Apache Solr in Cloud Mode refers to operating Solr in a distributed, scalable, and fault-tolerant configuration using SolrCloud. This mode is designed to provide enhanced capabilities that are crucial for managing large datasets across multiple servers, ensuring high availability and resilience in production environments. Here are some key aspects of running Solr in Cloud Mode:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Distributed Indexing and Search<\/strong>: SolrCloud allows data to be indexed and searched across multiple Solr instances (nodes). This distribution helps in handling large volumes of data more efficiently than a single instance could manage.<\/li>\n\n\n\n<li><strong>Automatic Load Balancing and Failover<\/strong>: SolrCloud automatically balances query load across different nodes and can reroute traffic in the event of node failure, improving both performance and reliability.<\/li>\n\n\n\n<li><strong>Central Configuration Management<\/strong>: SolrCloud uses Apache ZooKeeper, a centralized service for maintaining configuration information and providing distributed synchronization. ZooKeeper keeps track of the status of the Solr cluster nodes and their configurations, making it easier to manage cluster-wide settings and consistently apply changes.<\/li>\n\n\n\n<li><strong>Scalability<\/strong>: You can add or remove nodes from the SolrCloud cluster as needed. ZooKeeper updates its records accordingly, and Solr ensures that the data is rebalanced across the available nodes. This makes scaling up to handle more data or scaling down to conserve resources relatively straightforward.<\/li>\n\n\n\n<li><strong>Real-time Replication<\/strong>: Data added to one node can be automatically replicated to other nodes, ensuring that copies of the data are available for redundancy and that the load is distributed for faster search performance.<\/li>\n\n\n\n<li><strong>Sharding Support<\/strong>: SolrCloud supports sharding, which divides the data into subsets (shards) that can be hosted on different nodes. This is useful for managing very large datasets by distributing the data across the cluster.<\/li>\n\n\n\n<li><strong>High Availability<\/strong>: The combination of automatic failover and data replication helps ensure that the Solr service remains available even if some of the nodes fail.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a table summarizing some common Solr command-line options along with their descriptions: Command Description start Starts Solr. Can include [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-apache-solr"],"_links":{"self":[{"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/comments?post=123"}],"version-history":[{"count":3,"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/posts\/123\/revisions\/138"}],"wp:attachment":[{"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rajeshkumar.xyz\/blog\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}