{"id":258,"date":"2014-08-20T10:09:42","date_gmt":"2014-08-20T09:09:42","guid":{"rendered":"http:\/\/www.francelabs.com\/blog\/?p=258"},"modified":"2020-11-03T11:49:40","modified_gmt":"2020-11-03T10:49:40","slug":"tutorial-solrcloud-amazon-ec2","status":"publish","type":"post","link":"https:\/\/www.francelabs.com\/blog\/tutorial-solrcloud-amazon-ec2\/","title":{"rendered":"Tutorial for setting up SolrCloud on Amazon EC2"},"content":{"rendered":"<p><strong>UPDATE: This tutorial is based on Solr 4. If you want to use Solr 8, we strongly recommend to use our recent blog entry to <a href=\"https:\/\/www.francelabs.com\/blog\/tutorial-deploying-solrcloud-8-on-amazon-ec2\/\">set up Solrcloud 8 on Amazon EC2<\/a><\/strong><\/p>\n<p>NOTE: There is French version to this tutorial, which you&#8217;ll find on the second half of this blog entry.<\/p>\n<p>In this tutorial, we&#8217;ll be installing a SolrCloud cluster on Amazon EC2.<br \/>\nWe&#8217;ll be using Solr 4.9, Tomcat 7 and Zookeeper 3.4.6 on Debian 7 instances.<br \/>\nThis tutorial will explain how to achieve this result.<br \/>\nWe&#8217;ll be installing a set of 3 machines with 3 shards and 2 replicas per shard, thus creating a set of 9 shards.<br \/>\nWe&#8217;ll also be installing a Zookeeper ensemble of 3 machines.<\/p>\n<p><!--more--><\/p>\n<p>This architecture will be flexible enough to allow for a fail-over of one or two machines, depending on the phase we&#8217;re at: indexing or querying.<\/p>\n<ul>\n<li>Indexing: a machine can fail without impacting the cluster (the zookeeper ensemble of 3 machines allows for one machine down). The updates will be broadcasted to the machines that are still up<\/li>\n<li>Querying : Two machines can fail without impacting the cluster. Each machine is hosting the 3 shards, thus the query can be done without problem, the only constraint is the potential slowdown on the query time.<\/li>\n<\/ul>\n<p>Here is a schema of what we want to achieve:<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-259\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi-300x263.png\" alt=\"high level architecture\" width=\"300\" height=\"263\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi-300x263.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi-341x300.png 341w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi.png 848w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To do that, we&#8217;ll be using Amazon EC2 instances.<br \/>\nThe steps are:<\/p>\n<ul>\n<li>Configuration of the EC2 instances<\/li>\n<li>Installation of the required software<\/li>\n<li>Configuration of Solr Home<\/li>\n<li>Configuration of Tomcat<\/li>\n<li>Configuration of Zookeeper<\/li>\n<li>Configuration of Tomcat for SolrCloud<\/li>\n<li>Configuration of SolrCloud<\/li>\n<\/ul>\n<blockquote><p><strong>Configuration des instances EC2:<\/strong><\/p><\/blockquote>\n<p>For this tutorial, we chose m3 medium intsances, with the following specs:<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-260\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs-300x70.png\" alt=\"amazon instances specs\" width=\"300\" height=\"70\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs-300x70.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs-500x118.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs.png 558w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This will be largely enough in our case.<\/p>\n<p>Once you&#8217;re connected to AWS, got to the EC2 page then create 3 instances of type m3 medium.<br \/>\nSelect the Debian 7 64 bits image, which is available on the AWS Store (free) :<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-261\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance-300x66.png\" alt=\"debian amazon instance\" width=\"300\" height=\"66\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance-300x66.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance-500x110.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance.png 694w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Create or use a security key that will be shared among the 3 instances.<\/p>\n<p>Once started, the 3 AWS instances are named solrcloud1, solrcloud2 et solrcloud3 :<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-262\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-300x25.png\" alt=\"amazon instances startup\" width=\"300\" height=\"25\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-300x25.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-1024x85.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-500x41.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup.png 1077w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>You need to set the security group associated to the instances, so that the instances can communicate with one another, and so that you can access to the Tomcat from the outside.<\/p>\n<p>The rules that need to be added are (in addition to the SSH connection):<br \/>\nTomcat : TCP 8080<br \/>\nZookeeper : TCP 2181, 2888, 3888<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-263\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules-300x76.png\" alt=\"tcp rules\" width=\"300\" height=\"76\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules-300x76.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules-500x127.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules.png 980w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>It is recommened to assign \u00ab elastic ip \u00bb to the instances, so that you can access them through a fixed public ip. This is the case in this screenshot.<br \/>\nIn addition, it allows for having one public dns so that instances can communicate with each other.<br \/>\nWithout \u00ab elastic ip \u00bb, we would be forced to put the private ip addresses of the instances in the Zookeeper configuration (ZK), and these IP addresses are changing every time a machine is restarted. The public dns takes care of finding out the private IP address of the instance.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-264\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-300x43.png\" alt=\"amazon instance ip\" width=\"300\" height=\"43\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-300x43.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-1000x147.png 1000w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-500x72.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip.png 1013w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Once the instances are ready, we can connect to them.<\/p>\n<p>For that, use Putty on Windows, or use the terminal on Linux\/Mac OS X, using the security key associated to the instances.<br \/>\nIn this tutorial, we&#8217;ll be using <a title=\"EC2box website\" href=\"http:\/\/ec2box.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">EC2Box <\/a> that allows to easily send grouped commands to several EC2 instances.<br \/>\nFor this purpose, download <a title=\"Repository of EC2Box\" href=\"https:\/\/github.com\/skavanagh\/EC2Box\/releases\" target=\"_blank\" rel=\"noopener noreferrer\">EC2box from its github<\/a> :<br \/>\nWe did this tutorial on Windows, and the version we installed is ec2box-jetty-v-0.15_00<br \/>\nOnce installed, launch <strong>startEC2Box.bat<\/strong>.<br \/>\nThen, connect to <a href=\"https:\/\/localhost:8443\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/localhost:8443\/<\/a><br \/>\nBy default, the login info are:<br \/>\n<strong> username:admin<\/strong><br \/>\n<strong> password:changeme<\/strong><\/p>\n<p>Then go to <strong>Set AWS Credentials<\/strong> and type in the <strong>access key<\/strong> of the AWS user.<br \/>\nThen in <strong>Set EC2 Keys<\/strong>, type in the <strong>private key<\/strong> of the security key associated to the EC2 instances.<br \/>\nLast, go to <strong>Secure Shell -&gt; Composite SSH Terms<\/strong> and select the 3 Solrcloud instances.<\/p>\n<p>Select the admin user admin in order to connect.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-266\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines-300x194.png\" alt=\"multi command lines\" width=\"300\" height=\"194\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines-300x194.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines-461x300.png 461w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines.png 848w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>So that our commands can be sent simultaneously on the 3 instances, you need to click on each window or chose &#8220;select all&#8221; on top of the screen.<\/p>\n<p>To be root :<br \/>\nsudo -i<\/p>\n<p>Our instances have been created and we&#8217;ve been able to connect to it. Now we can start the configuration work !<\/p>\n<blockquote><p><strong>Installing Java and the required software<\/strong><\/p><\/blockquote>\n<p>We will start with the install of Oracle Java JDK 7, and we&#8217;ll then download the latest versions of Solr, Tomcat and Zookeeper.<\/p>\n<blockquote><p><strong>Installing Java<\/strong><\/p><\/blockquote>\n<p>To install Java quickly, we can use the <a href=\"http:\/\/www.webupd8.org\/2012\/06\/how-to-install-oracle-java-7-in-debian.html\" target=\"_blank\" rel=\"noopener noreferrer\">repository hosted by webupd8team<\/a>.<\/p>\n<p>Here are the commands :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">echo &quot;deb http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu precise main&quot; | tee -a \/etc\/apt\/sources.list\necho &quot;deb-src http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu precise main&quot; | tee -a \/etc\/apt\/sources.list\napt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys EEA14886\napt-get update\napt-get install oracle-java7-installer<\/pre>\n<p>Accept the Oracle licence terms and wait for the install to end.<br \/>\nTo check that Java is correctly installed, enter:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">java \u2013version<\/pre>\n<p>You should get back:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">java version &quot;1.7.0_65&quot;\nJava(TM) SE Runtime Environment (build 1.7.0_65-b17)\nJava HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)<\/pre>\n<blockquote><p>Installing the required software<\/p><\/blockquote>\n<p>Create a <strong>downloads<\/strong> folder:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mkdir ~\/downloads\ncd ~\/downloads<\/pre>\n<p>Download Tomcat :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wget http:\/\/mirror.bbln.org\/apache\/tomcat\/tomcat-7\/v7.0.55\/bin\/apache-tomcat-7.0.55.tar.gz<\/pre>\n<p>Download Solr :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wget http:\/\/wwwftp.ciril.fr\/pub\/apache\/lucene\/solr\/4.9.0\/solr-4.9.0.tgz<\/pre>\n<p>Download Zookeeper :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wget http:\/\/mirrors.ircam.fr\/pub\/apache\/zookeeper\/stable\/zookeeper-3.4.6.tar.gz<\/pre>\n<p>Then unzip each archives:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tar xfvz apache-tomcat-7.0.55.tar.gz\ntar xfvz solr-4.9.0.tgz\ntar xfvz zookeeper-3.4.6.tar.gz<\/pre>\n<p>You&#8217;ll then move the folders towards <strong>\/opt<\/strong> :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mv apache-tomcat-7.0.55 \/opt\/tomcat\nmv solr-4.9.0 \/opt\/solr_install\nmv zookeeper-3.4.6 \/opt\/zookeeper<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-270\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI-300x185.png\" alt=\"Installs check CLI\" width=\"300\" height=\"185\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI-300x185.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI-485x300.png 485w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI.png 1008w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Java is now correctly installed as all the required software that are needed to correctly configure our SolrCloud cluster.<br \/>\nLet&#8217;s move on the Configuration part !<\/p>\n<blockquote><p>Configuring Solr Home<\/p><\/blockquote>\n<p>Go to <strong>\/opt<\/strong> to create a <strong>solr_home<\/strong> folder:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mkdir \/opt\/solr_home<\/pre>\n<p>We will be copying into ti, the configuration files of collection1<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\ncp \u2013r solr_install\/example\/solr\/* solr_home\/<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/solr_home<\/pre>\n<p>Edit the solr.xml file and replace the host with the public IP address of each EC2 instance.<br \/>\nAlso replace the hostPort with 8080.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-271\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1-300x175.png\" alt=\"Solr config screenshot 1\" width=\"300\" height=\"175\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1-300x175.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1-500x293.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1.png 906w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Delete collection1 that will not be used, since we&#8217;ll be sending to Zookeeper the Solr configuration to be used.<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">rm \u2013rf collection1<\/pre>\n<p>We now copy the Solr war in our <strong>solr_home<\/strong>:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mkdir \/opt\/solr_home\/war\ncp \/opt\/solr_install\/dist\/solr-*.war \/opt\/solr_home\/war\/solr.war\nmv \/opt\/solr\/war\/solr-*.war solr.war<\/pre>\n<p>Our <strong>solr_home<\/strong> is now configured.<br \/>\nLet&#8217;s move on to Tomcat.<\/p>\n<blockquote><p><strong>Configuration de Tomcat<\/strong><\/p><\/blockquote>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt<\/pre>\n<p>We first need to configure the Log4j logging framework for Tomcat.<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cp \u2013r solr_install\/example\/lib\/ext\/* tomcat\/lib\/\ncp \u2013r solr_install\/example\/resources\/log4j.properties tomcat\/lib\/<\/pre>\n<p>We now need to configure the context of Tomcat.<br \/>\nFor this purpose, we need to launch Tomcat a first time, so that it can create the relevant files in <strong>\/opt\/tomcat\/conf\/Catalina<\/strong>.<br \/>\nStart <strong>Tomcat<\/strong> :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>Then, 10 secondes later, shutdown your Tomcat:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/shutdown.sh<\/pre>\n<p>Then go to: \/opt\/tomcat\/conf\/Catalina\/localhost and create the context for solr.xml :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/tomcat\/conf\/Catalina\/locahost\nnano solr.xml<\/pre>\n<p>Then copy the following configuration inside this file:<\/p>\n<pre><pre class=\"brush: xml; title: ; notranslate\" title=\"\">&amp;amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;amp;gt;\n&amp;amp;lt;Context docBase=&quot;\/opt\/solr_home\/war\/solr.war&quot; crossContext=&quot;true&quot;&amp;amp;gt;\n  &amp;amp;lt;Environment name=&quot;solr\/home&quot; type=&quot;java.lang.String&quot;\nvalue=&quot;\/opt\/solr_home&quot; override=&quot;true&quot;\/&amp;amp;gt; &amp;amp;lt;\/Context&amp;amp;gt;<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-272\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1-300x188.png\" alt=\"Tomcat config screenshot 1\" width=\"300\" height=\"188\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1-300x188.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1.png 978w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Tomcat is now configured. Let&#8217;s start it to check that everything&#8217;s fine:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>Then, use a web browser and connect to one of the public ip addresses of the EC2 instances. For instance in our case 54.217.206.154 :<br \/>\n<a href=\"http:\/\/54.217.206.154:8080\/solr\">http:\/\/54.217.206.154:8080\/solr<\/a><\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-273\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check-300x118.png\" alt=\"Solr startup check\" width=\"300\" height=\"118\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check-300x118.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check-500x197.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check.png 958w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Solr and Tomcat are now working.<br \/>\nYou can read on the screen the following sentence: &#8220;<em>no cores available&#8221;<\/em>, which is normal since we have no collection currently configured in our solr_home.<br \/>\nYou&#8217;ll also notice that there is no Cloud tab, which is also normal since we have not started Solr in its SolrCloud mode, but rather in its standalone mode. Indeed, we have not mentionned for now the use of Zookeeper for the configuration steps.<\/p>\n<p>It&#8217;s time to work on that!<\/p>\n<p>Hint: is your Solr is unavailable, that may be du to the security group of the EC2 instance, which is being too restrictive. Check that port 8080 is accessible through TCP.<\/p>\n<blockquote><p><strong>Configuring Zookeeper<\/strong><\/p><\/blockquote>\n<p>Go to <strong>\/opt\/zookeeper<\/strong>:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/zookeeper<\/pre>\n<p>We&#8217;ll now be creating the configuration that allows to create the ZK ensemble of 3 machines.<br \/>\nCreate a folder where Zookeeper will put its data:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mkdir \/opt\/zookeeper\/tmp<\/pre>\n<p>Inside this folder, create a <strong>myid<\/strong> file:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">nano \/opt\/zookeeper\/tmp\/myid<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-274\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png\" alt=\"Zookeeper config screenshot 1\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png 841w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nChange the value for each instance:<br \/>\nFor solrcloud1, enter 1<br \/>\nFor solrcloud2, enter 2<br \/>\nFor solrcloud3, enter 3<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-274\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png\" alt=\"Zookeeper config screenshot 1\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png 841w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Let&#8217;s move on to the configuration per se, by creating the zoo.cfg file, in\u00a0 <strong>\/opt\/zookeeper\/conf<\/strong> :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">nano \/opt\/zookeeper\/conf\/zoo.cfg <\/pre>\n<p>Then enter this configuration:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tickTime=2000\ndataDir=\/opt\/zookeeper\/tmp\nclientPort=2181\ninitLimit=5\nsyncLimit=2\nserver.1=ec2-54-217-206-154.eu-west-1.compute.amazonaws.com:2888:3888\nserver.2=ec2-54-217-206-197.eu-west-1.compute.amazonaws.com:2888:3888\nserver.3=ec2-54-217-207-3.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-276\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2-300x187.png\" alt=\"Zookeeper config screenshot 2\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2-300x187.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2-479x300.png 479w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2.png 893w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Hint:<br \/>\n&#8211; Be careful to enter the public DNS, and NOT the public IP addresses, otherwise the machines won&#8217;t be able to communicate with each other.<br \/>\nYou can check that beforehand by pinging them from one to the other<br \/>\n&#8211; Pay attention to the security group of the instances. Check that the ports required for communicataion of the instances on Zookeeper are declared as open (2181, 2888 et 3888)<\/p>\n<p>Start ZK :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/zookeeper\/bin\/zkServer.sh start<\/pre>\n<p>Check the zookeeper logs to see if everything&#8217;s fine:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tail \u2013f \/opt\/zookeeper\/zookeeper.out<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-277\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3-300x188.png\" alt=\"Zookeeper config screenshot 3\" width=\"300\" height=\"188\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3-300x188.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3.png 856w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You can see here that everything&#8217;s going as planned, as the leader has been elected.<\/p>\n<p>Now that our Zookeeper ensemble is running, we need to configure the Tomcat so that Solr can direct to it in order to activate SolrCloud.<\/p>\n<blockquote><p><strong>Configuring Tomcat for SolrCloud<\/strong><\/p><\/blockquote>\n<p>We will now set the paramets to declare the availability of a Zookeeper ensemble at the launch of Solr. For this purpose, we&#8217;ll enter this configuration for the start phase of Tomcat, in <strong>\/opt\/tomcat\/bin\/startup.sh<\/strong><br \/>\n(note that it is cleaner to put the parameters in a variable named <strong>SOLR_OPTS<\/strong>, to be placed in a file <strong>\/opt\/tomcat\/bin\/setenv.sh<\/strong>)<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">nano \/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>Then add the following line at the beginning of the file:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">export CATALINA_OPTS=&quot;-Dport=8080 -DzkHost=ec2-54-217-206-154.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-206-197.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-207-3.eu-west-1.compute.amazonaws.com:2181 &quot;<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-278\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1-300x189.png\" alt=\"Tomcat Solrcloud config 1\" width=\"300\" height=\"189\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1-300x189.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1-475x300.png 475w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1.png 878w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>We can now stop and restart Tomcat:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/shutdown.sh<\/pre>\n<p>Then:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>Check the logs ot Tomcat and see if everything&#8217;s fine:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tail \u2013f \/opt\/tomcat\/logs\/catalina.out <\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-279\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2-300x192.png\" alt=\"Tomcat Solrcloud config 2\" width=\"300\" height=\"192\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2-300x192.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2-467x300.png 467w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2.png 769w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>It seems to be ok, since the context of Solr has been properly loaded by Tomcat, and the communcation between Solr and Zookeeper is also working.<br \/>\nWe can now connect to the web interface from any instance, and we can configure our SolrCloud cluster.<\/p>\n<blockquote><p>Configuring SolrCloud<\/p><\/blockquote>\n<p>Connect to the web interface, for instance solrcloud3 :<br \/>\n<a href=\"http:\/\/54.217.207.3:8080\/solr\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/54.217.207.3:8080\/solr<\/a><br \/>\nWe do have now a Cloud tab, which is a good thing.<br \/>\nClick on it, then on Tree, and you get&#8230; and empty screen. Nothing&#8217;s wrong as no collection has been configured yet.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-280\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1-300x89.png\" alt=\"SolrCloud admin screenshot 1\" width=\"300\" height=\"89\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1-300x89.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1-500x149.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1.png 902w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Therefore, we now add a collection that has 3 shards with 2 replicas each, on all 3 instances.<br \/>\nFor that, we use the <a title=\"Collections API documentation\" href=\"https:\/\/cwiki.apache.org\/confluence\/display\/solr\/Collections+API\" target=\"_blank\" rel=\"noopener noreferrer\">collections API of SolrCloud<\/a>.<br \/>\nThe syntax is as follows:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/admin\/collections?action=CREATE&amp;amp;amp;name=name&amp;amp;amp;numShards=number&amp;amp;amp;replicationFactor=number&amp;amp;amp;maxShardsPerNode=number&amp;amp;amp;createNodeSet=nodelist&amp;amp;amp;collection.configName=configname<\/pre>\n<p>In order to do that, we need to have a Solr configuration in Zookeeper (parameter <em>collection.configName=configname<\/em>).<br \/>\nThere are several options to do that: you can use the parameter <em>Dbootstrap_confdir<\/em> when starting the 1st instance of Tomcat, to send your configuration to ZK.<br \/>\nOr you can use the script <em>zkcli.sh<\/em> that is present in the Solr distro, in <em>example\/scripts\/cloud-scripts,<\/em> to upload our Solr config towards ZK. This is our option<\/p>\n<p>Be careful ! From now on, the commands must be targeted to only one instance, and not to the 3 of them simultaneously!<\/p>\n<p>For that, go to <em>\/opt\/solr_install<\/em> :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/solr_install\/example\/scripts\/cloud-scripts<\/pre>\n<p>Then enter:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">sh zkcli.sh -zkhost ec2-54-217-206-154.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-206-197.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-207-3.eu-west-1.compute.amazonaws.com:2181 -cmd upconfig -confdir \/opt\/solr_install\/example\/solr\/collection1\/conf -confname myconfig<\/pre>\n<p>zkhost is the ZK ensemble, -cmd upconfig is for the config containing the Solr config to be sent (here we have chosen collection1 provided by default with Solr), and eventually the name used for storing the configuration in ZK.<\/p>\n<p>Hint: the order of these arguments matters in the command<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-281\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution-300x107.png\" alt=\"cmd execution\" width=\"300\" height=\"107\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution-300x107.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution-500x178.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution.png 751w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>All that remains is for us to connect to the web interface, to check if the configuration does appear in the ZK:<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-282\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_config-184x300.png\" alt=\"Zookeeper admin config\" width=\"184\" height=\"300\" \/><\/a>We can now create the collection on all 3 instances. Let&#8217;s reuse the command we mentionned earlier, taken from the Collections API:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/admin\/collections?action=CREATE&amp;amp;amp;name=name&amp;amp;amp;numShards=number&amp;amp;amp;replicationFactor=number&amp;amp;amp;maxShardsPerNode=number&amp;amp;amp;createNodeSet=nodelist&amp;amp;amp;collection.configName=configname<\/pre>\n<p>Let&#8217;s adapt this command for our use case:<\/p>\n<p><a href=\"http:\/\/54.217.207.3:8080\/solr\/admin\/collections?action=CREATE&amp;name=francelabs&amp;numShards=3&amp;replicationFactor=3&amp;configName=myconfig&amp;maxShardsPerNode=3\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/54.217.207.3:8080\/solr\/admin\/collections?action=CREATE&amp;name=francelabs&amp;numShards=3&amp;replicationFactor=3&amp;collection.configName=myconfig&amp;maxShardsPerNode=3<\/a><\/p>\n<p>Some explanation on the parameters:<br \/>\n<strong>54.217.207.3:8080<\/strong> : public IP address of the solrcloud3 instance, but we could also have used solrcloud1 or solrcloud2<br \/>\n<strong>name=francelabs<\/strong> : the name of our collection<br \/>\n<strong>numShards=3<\/strong> : the number of shards on which the Solr index will be shared<br \/>\n<strong>replicationFactor=3<\/strong> : each shard is replicated 2 times (indeed, a replication factor of 1 means that the shard is alone)<br \/>\n<strong>maxShardsPerNode=3 <\/strong>: the max number of shards per instance: we have here 3 shards with a replication factor of 3, thus 3&#215;3 = 9 shards in total. We have 3 machines thus 9 \/ 3 = 3 shards per node, so we set the maxShardsPerNode to 3.<\/p>\n<p>This command will take some time to run. Once finished, check the state of the cloud:<br \/>\n<a href=\"http:\/\/54.217.206.154:8080\/solr\/#\/~cloud\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/54.217.206.154:8080\/solr\/#\/~cloud<\/a><\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-283\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph-300x77.png\" alt=\"Zookeeper admin nodes graph\" width=\"300\" height=\"77\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph-300x77.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph-500x128.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph.png 990w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>If we check the created files (for that, you can connect to any instance, here we use solrcloud1) :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/solr_home<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-284\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders-300x114.png\" alt=\"Created folders\" width=\"300\" height=\"114\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders-300x114.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders-500x190.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders.png 653w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>3 folders have been created, each containing one part of the index:<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-285\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder-300x57.png\" alt=\"Data folder\" width=\"300\" height=\"57\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder-300x57.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder-500x96.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder.png 673w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Only the data folder is present, since the Solr configuration is stored in Zookeeper.<\/p>\n<p>That&#8217;s it for this tutorial that allows to configure a SolrCloud cluster on Amazon EC2.<\/p>\n<p>In future blog entries &#8211; well, if we find the time!, we&#8217;ll see how to optimise the resources on the different machines, how to index on this cluster using with or without SolrJ, and how to run queries using SolrJ (load balancing int\u00e9gr\u00e9) and without SolrJ through an external load balancer.<\/p>\n<hr \/>\n<p><em><strong>VERSION FRANCAISE<\/strong><\/em><\/p>\n<p>Dans ce tutoriel, nous allons installer un cluster SolrCloud sur Amazon EC2.<br \/>\nNous nous servirons de Solr 4.9, de Tomcat 7 et de Zookeeper 3.4.6 sur des instances Debian 7.<br \/>\nLe tutoriel expliquera pas \u00e0 pas comment arriver \u00e0 ce r\u00e9sultat.<br \/>\nNous allons installer un ensemble de 3 machines avec 3 shards et 2 r\u00e9plicas par shard, soit un ensemble de 9 shards.<br \/>\nNous installerons \u00e9galement un ensemble Zookeeper de 3 machines.<\/p>\n<p>Cette architecture sera assez flexible pour permettre un fail-over d\u2019une ou deux machines suivant que l\u2019on soit \u00e0 l\u2019indexation ou au requ\u00eatage :<\/p>\n<ul>\n<li>Indexation : une machine peut tomber sans impacter le cluster (l\u2019ensemble Zookeeper de 3 machines permet d\u2019avoir une machine down). Les updates seront bien diffus\u00e9es sur les machines up<\/li>\n<li>Requ\u00eatage : on peut perdre 2 machines sans impacter le cluster. En effet chaque machine h\u00e9bergeant les 3 shards, la recherche pourra \u00eatre effectu\u00e9e sans probl\u00e8me avec comme seule contrainte la ralentissement du temps de requ\u00eatage.<\/li>\n<\/ul>\n<p>Voici sch\u00e9matiquement ce que l\u2019on souhaite obtenir :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-259\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi-300x263.png\" alt=\"high level architecture\" width=\"300\" height=\"263\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi-300x263.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi-341x300.png 341w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/high_level_archi.png 848w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Pour r\u00e9aliser cela, nous allons nous servir d\u2019instances Amazon EC2.<br \/>\nLes diff\u00e9rentes \u00e9tapes vont \u00eatre :<\/p>\n<ul>\n<li>Configuration des instances EC2<\/li>\n<li>Installation des briques logicielles<\/li>\n<li>Configuration du Solr Home<\/li>\n<li>Configuration du Tomcat<\/li>\n<li>Configuration de Zookeeper<\/li>\n<li>Configuration de Tomcat pour SolrCloud<\/li>\n<li>Configuration de SolrCloud<\/li>\n<\/ul>\n<blockquote><p><strong>Configuration des instances EC2:<\/strong><\/p><\/blockquote>\n<p>Dans le cadre de ce tutoriel, les instances choisies sont de type m3 medium avec les caract\u00e9ristiques suivantes :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-260\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs-300x70.png\" alt=\"amazon instances specs\" width=\"300\" height=\"70\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs-300x70.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs-500x118.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_specs.png 558w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Ce qui sera amplement suffisant dans le cadre de ce tutoriel.<\/p>\n<p>Apr\u00e8s s\u2019\u00eatre connect\u00e9 sur AWS, aller sur la page EC2 puis cr\u00e9er 3 instances de type m3 medium.<br \/>\nChoisir l\u2019image Debian 7 64 bits disponible sur le AWS Store (gratuit) :<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-261\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance-300x66.png\" alt=\"debian amazon instance\" width=\"300\" height=\"66\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance-300x66.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance-500x110.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/debian_amazon_instance.png 694w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Cr\u00e9er ou utiliser une cl\u00e9 de s\u00e9curit\u00e9 commune aux 3 instances.<\/p>\n<p>Les 3 instances AWS une fois d\u00e9marr\u00e9es nomm\u00e9es respectivement solrcloud1, solrcloud2 et solrcloud3 :<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-262\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-300x25.png\" alt=\"amazon instances startup\" width=\"300\" height=\"25\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-300x25.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-1024x85.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup-500x41.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instances_startup.png 1077w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Il faut r\u00e9gler le groupe de s\u00e9curit\u00e9 associ\u00e9 aux instances pour que les instances puissent communiquer entre elles et que l\u2019on puisse acc\u00e9der au Tomcat de l\u2019ext\u00e9rieur.<\/p>\n<p>Les r\u00e8gles \u00e0 ajouter sont les suivantes (en plus de la connexion SSH) :<br \/>\nTomcat : TCP 8080<br \/>\nZookeeper : TCP 2181, 2888, 3888<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-263\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules-300x76.png\" alt=\"tcp rules\" width=\"300\" height=\"76\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules-300x76.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules-500x127.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/tcp_rules.png 980w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Il est conseill\u00e9 d\u2019associer des \u00ab elastic ip \u00bb aux instances pour pouvoir y acc\u00e9der via une ip publique fixe, c\u2019est ce qui a \u00e9t\u00e9 fait ici.<br \/>\nDe plus cela permet d\u2019avoir le m\u00eame public dns pour que les instances puissent communiquer entre elles.<br \/>\nEn effet, sans elastic ip, nous serions oblig\u00e9s d\u2019indiquer les ip priv\u00e9es des instances dans la configuration de Zookeeper (ZK) et celles-ci changent \u00e0 chaque fois que la machine est stopp\u00e9e puis d\u00e9mar\u00e9e. Alors que le public dns permet de faire la r\u00e9solution de l\u2019ip priv\u00e9e de l\u2019instance.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-264\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-300x43.png\" alt=\"amazon instance ip\" width=\"300\" height=\"43\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-300x43.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-1000x147.png 1000w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip-500x72.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/amazon_instance_ip.png 1013w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Une fois les instances pr\u00eates, nous pouvons nous connecter dessus.<\/p>\n<p>Pour cela, se connecter via Putty sur Windows ou le terminal sur Linux\/Mac OS X avec la cl\u00e9 de s\u00e9curit\u00e9 associ\u00e9e aux instances.<br \/>\nDans ce tutoriel nous utiliserons <a title=\"EC2box website\" href=\"http:\/\/ec2box.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">EC2Box <\/a> qui permet d\u2019envoyer des commandes group\u00e9es \u00e0 plusieurs instances EC2 facilement.<br \/>\nPour cela, t\u00e9l\u00e9charger <a title=\"Repository of EC2Box\" href=\"https:\/\/github.com\/skavanagh\/EC2Box\/releases\" target=\"_blank\" rel=\"noopener noreferrer\">EC2box sur son github<\/a> :<br \/>\nEtant sur Windows, la version install\u00e9e ici est la ec2box-jetty-v-0.15_00<br \/>\nUne fois install\u00e9, lancer startEC2Box.bat.<br \/>\nPuis se connecter sur <a href=\"https:\/\/localhost:8443\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/localhost:8443\/<\/a><br \/>\nLes infos de login par d\u00e9faut sont :<br \/>\nusername:admin<br \/>\npassword:changeme<\/p>\n<p>Puis aller dans Set AWS Credentials et rentrer l\u2019access key de l\u2019utilisateur AWS.<br \/>\nPuis dans Set EC2 Keys, entrer la private key de la cl\u00e9 de s\u00e9curit\u00e9 associ\u00e9e aux instances EC2.<br \/>\nEnfin aller dans Secure Shell -&gt; Composite SSH Terms et choisir les 3 instances solrcloud.<\/p>\n<p>Choisir comme user admin pour pouvoir se connecter.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-266\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines-300x194.png\" alt=\"multi command lines\" width=\"300\" height=\"194\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines-300x194.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines-461x300.png 461w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/multi_command_lines.png 848w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>Pour que les commandes puissent \u00eatre envoy\u00e9es en simultan\u00e9 sur les 3 instances il faut cliquer sur chacune des fen\u00eatres ou choisir select all en haut de l\u2019\u00e9cran.<\/p>\n<p>Pour \u00eatre en root :<br \/>\nsudo -i<\/p>\n<p>Nos instances ont bien \u00e9t\u00e9 cr\u00e9\u00e9es et nous avons pu nous connecter dessus, nous pouvons maintenant commencer le travail !<\/p>\n<blockquote><p><strong>Installation de Java et des briques logicielles<\/strong><\/p><\/blockquote>\n<p>Nous allons commencer par installer Oracle Java JDK 7 puis nous allons t\u00e9l\u00e9charger les derni\u00e8res versions de Solr, Tomcat et Zookeeper.<\/p>\n<blockquote><p><strong>Installation de Java<\/strong><\/p><\/blockquote>\n<p>Pour installer Java rapidement, nous allons nous servir d\u2019un <a href=\"http:\/\/www.webupd8.org\/2012\/06\/how-to-install-oracle-java-7-in-debian.html\" target=\"_blank\" rel=\"noopener noreferrer\">repository host\u00e9 par webupd8team<\/a>.<\/p>\n<p>Voici les commandes :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">echo &quot;deb http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu precise main&quot; | tee -a \/etc\/apt\/sources.list\necho &quot;deb-src http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu precise main&quot; | tee -a \/etc\/apt\/sources.list\napt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys EEA14886\napt-get update\napt-get install oracle-java7-installer<\/pre>\n<p>Confirmer l\u2019acceptation des termes de la licence Oracle et attendre que l\u2019installation se termine.<br \/>\nPour v\u00e9rifier si java a bien \u00e9t\u00e9 install\u00e9, taper :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">java \u2013version<\/pre>\n<p>Et on obtient bien :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">java version &quot;1.7.0_65&quot;\nJava(TM) SE Runtime Environment (build 1.7.0_65-b17)\nJava HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)<\/pre>\n<blockquote><p>Installation des briques logicielles<\/p><\/blockquote>\n<p>Cr\u00e9er un r\u00e9pertoire downloads :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Mkdir ~\/downloads\nCd ~\/downloads<\/pre>\n<p>T\u00e9l\u00e9charger Tomcat :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wget http:\/\/mirror.bbln.org\/apache\/tomcat\/tomcat-7\/v7.0.55\/bin\/apache-tomcat-7.0.55.tar.gz<\/pre>\n<p>T\u00e9l\u00e9charger Solr :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wget http:\/\/wwwftp.ciril.fr\/pub\/apache\/lucene\/solr\/4.9.0\/solr-4.9.0.tgz<\/pre>\n<p>T\u00e9l\u00e9charger Zookeeper :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wget http:\/\/mirrors.ircam.fr\/pub\/apache\/zookeeper\/stable\/zookeeper-3.4.6.tar.gz<\/pre>\n<p>Puis d\u00e9compresser chacune des archives :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Tar xfvz apache-tomcat-7.0.55.tar.gz\ntar xfvz solr-4.9.0.tgz\ntar xfvz zookeeper-3.4.6.tar.gz<\/pre>\n<p>On d\u00e9place ensuite les r\u00e9pertoires dans \/opt :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mv apache-tomcat-7.0.55 \/opt\/tomcat\nmv solr-4.9.0 \/opt\/solr_install\nmv zookeeper-3.4.6 \/opt\/zookeeper<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-270\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI-300x185.png\" alt=\"Installs check CLI\" width=\"300\" height=\"185\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI-300x185.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI-485x300.png 485w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Installs_check_CLI.png 1008w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Java est bien install\u00e9 ainsi que toutes les briques logicielles dont nous avons besoin pour configurer notre cluster SolrCloud.<br \/>\nPassons maintenant \u00e0 la partie Configuration !<\/p>\n<blockquote><p>Configuration du Solr Home<\/p><\/blockquote>\n<p>Aller dans \/opt puis cr\u00e9er un r\u00e9pertoire solr_home :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mkdir \/opt\/solr_home<\/pre>\n<p>Nous allons copier \u00e0 l\u2019int\u00e9rieur les fichiers de configuration de la collection1<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\ncp \u2013r solr_install\/example\/solr\/* solr_home\/<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Cd \/opt\/solr_home<\/pre>\n<p>Editer le fichier solr.xml en rempla\u00e7ant le host par l\u2019ip publique de chaque instance ec2.<br \/>\nEt remplacer le hostPort par 8080.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-271\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1-300x175.png\" alt=\"Solr config screenshot 1\" width=\"300\" height=\"175\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1-300x175.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1-500x293.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_config_screenshot1.png 906w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Supprimer la collection1 qui ne servira pas puisqu\u2019on enverra \u00e0 Zookeeper la configuration de Solr \u00e0 utiliser.<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">rm \u2013rf collection1<\/pre>\n<p>Nous allons maintenant copier le war de solr dans notre solr_home :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mkdir \/opt\/solr_home\/war\ncp \/opt\/solr_install\/dist\/solr-*.war \/opt\/solr_home\/war\/solr.war\nmv \/opt\/solr\/war\/solr-*.war solr.war<\/pre>\n<p>Notre solr_home est maintenant configur\u00e9.<br \/>\nPassons maintenant \u00e0 Tomcat.<\/p>\n<blockquote><p>Configuration de Tomcat<\/p><\/blockquote>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt<\/pre>\n<p>Il faut d\u2019abord configurer le logging avec Log4j pour Tomcat.<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cp \u2013r solr_install\/example\/lib\/ext\/* tomcat\/lib\/\ncp \u2013r solr_install\/example\/resources\/log4j.properties tomcat\/lib\/<\/pre>\n<p>Il faut maintenant configure le contexte Tomcat.<br \/>\nPour cela nous avons besoin de lancer Tomcat une 1\u00e8re fois pour que celui-ci cr\u00e9e les fichiers n\u00e9cessaires dans \/opt\/tomcat\/conf\/Catalina.<br \/>\nLancer Tomcat :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>Puis \u00e9teindre Tomcat une dizaine de secondes plus tard :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/shutdown.sh<\/pre>\n<p>Puis aller dans : \/opt\/tomcat\/conf\/Catalina\/localhost et cr\u00e9er le context solr.xml :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/tomcat\/conf\/Catalina\/locahost\nnano solr.xml<\/pre>\n<p>Et copier cette configuration \u00e0 l\u2019int\u00e9rieur du fichier :<\/p>\n<pre><pre class=\"brush: xml; title: ; notranslate\" title=\"\">&amp;amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;amp;gt;\n&amp;amp;lt;Context docBase=&quot;\/opt\/solr_home\/war\/solr.war&quot; crossContext=&quot;true&quot;&amp;amp;gt;\n  &amp;amp;lt;Environment name=&quot;solr\/home&quot; type=&quot;java.lang.String&quot;\nvalue=&quot;\/opt\/solr_home&quot; override=&quot;true&quot;\/&amp;amp;gt; &amp;amp;lt;\/Context&amp;amp;gt;<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-272\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1-300x188.png\" alt=\"Tomcat config screenshot 1\" width=\"300\" height=\"188\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1-300x188.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_config_screenshot1.png 978w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Tomcat est maintenant configur\u00e9. Nous pouvons le lancer pour v\u00e9rifier que tout marche bien :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>Puis se connecter avec un browser web sur une des ip publiques des instances ec2 par exemple 54.217.206.154 :<br \/>\nhttp:\/\/54.217.206.154:8080\/solr<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-273\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check-300x118.png\" alt=\"Solr startup check\" width=\"300\" height=\"118\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check-300x118.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check-500x197.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Solr_startup_check.png 958w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Solr et Tomcat sont bien fonctionnels.<br \/>\nOn remarque qu\u2019il y a \u00e9crit <em>no cores available<\/em> ce qui est normal puisque nous n\u2019avons pas de collection de configur\u00e9e dans notre solr_home.<br \/>\nOn remarque \u00e9galement qu\u2019il n\u2019y a pas d\u2019onglet Cloud ce qui est \u00e9galement normal puisque nous n\u2019avons pas lanc\u00e9 Solr en SolrCloud mais en standalone puisqu\u2019\u00e0 aucun moment dans la configuration nous n\u2019avons parl\u00e9 de Zookeeper.<br \/>\nIl est temps de s\u2019en occuper !<\/p>\n<p>Astuce : si le Solr est inaccessible c\u2019est tr\u00e8s certainement d\u00fb au security group de l\u2019instance ec2 qui est trop restrictif. Bien v\u00e9rifier que le port 8080 est bien accessible en TCP.<\/p>\n<blockquote><p>Configuration de Zookeeper<\/p><\/blockquote>\n<p>Aller dans \/opt\/zookeeper :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Cd \/opt\/zookeeper<\/pre>\n<p>Nous allons cr\u00e9er la configuration permettant de cr\u00e9er un ensemble ZK de 3 machines.<br \/>\nCr\u00e9er un r\u00e9pertoire pour permettre \u00e0 zookeeper de placer ses donn\u00e9es :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mkdir \/opt\/zookeeper\/tmp<\/pre>\n<p>Et \u00e0 l\u2019int\u00e9rieur de celui-ci cr\u00e9er un fichier myid :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Nano \/opt\/zookeeper\/tmp\/myid<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-274\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png\" alt=\"Zookeeper config screenshot 1\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png 841w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nChanger la valeur pour chacune des instances :<br \/>\nPour solrcloud1, entrer 1<br \/>\nPour solrcloud2, entrer 2<br \/>\nPour solrcloud3, entrer 3<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-274\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png\" alt=\"Zookeeper config screenshot 1\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-300x187.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot1.png 841w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Passons maintenant \u00e0 la configuration proprement dite en cr\u00e9ant le fichier zoo.cfg dans \/opt\/zookeeper\/conf :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">nano \/opt\/zookeeper\/conf\/zoo.cfg <\/pre>\n<p>Puis entrer cette configuration :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tickTime=2000\ndataDir=\/opt\/zookeeper\/tmp\nclientPort=2181\ninitLimit=5\nsyncLimit=2\nserver.1=ec2-54-217-206-154.eu-west-1.compute.amazonaws.com:2888:3888\nserver.2=ec2-54-217-206-197.eu-west-1.compute.amazonaws.com:2888:3888\nserver.3=ec2-54-217-207-3.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-276\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2-300x187.png\" alt=\"Zookeeper config screenshot 2\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2-300x187.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2-479x300.png 479w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot2.png 893w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Astuces :<br \/>\n&#8211; attention \u00e0 bien entrer les public dns et non pas les ip publiques sinon les machines ne pourront pas se joindre entre elles.<br \/>\nV\u00e9rifier au pr\u00e9alable en essayant de les pinguer entre elles<br \/>\n&#8211; attention \u00e9galement au groupe de s\u00e9curit\u00e9 des instances. Bien v\u00e9rifier que les ports n\u00e9cessaires \u00e0 la communication des instances sur Zookeeper soient bien ouverts (2181, 2888 et 3888)<\/p>\n<p>Lancer ZK :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/zookeeper\/bin\/zkServer.sh start<\/pre>\n<p>Regarder les logs de zookeeper pour voir si tout se passe bien :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tail \u2013f \/opt\/zookeeper\/zookeeper.out<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-277\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3-300x188.png\" alt=\"Zookeeper config screenshot 3\" width=\"300\" height=\"188\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3-300x188.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3-478x300.png 478w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_config_screenshot3.png 856w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>On voit qu\u2019ici tout se passe bien puisque le leader a \u00e9t\u00e9 \u00e9lu.<\/p>\n<p>Maintenant que notre ensemble Zookeeper est op\u00e9rationnel, il ne reste plus qu\u2019\u00e0 configurer Tomcat pour que Solr pointe dessus afin d\u2019activer SolrCloud.<\/p>\n<blockquote><p>Configuration de Tomcat pour SolrCloud<\/p><\/blockquote>\n<p>Nous allons passer les param\u00e8tres pour indiquer qu\u2019un ensemble Zookeeper est disponible au lancement de Solr. Pour cela nous allons entrer la configuration au d\u00e9marrage du Tomcat dans \/opt\/tomcat\/bin\/startup.sh<br \/>\n(\u00e0 noter qu\u2019il est plus propre de placer les param\u00e8tres dans une variable SOLR_OPTS \u00e0 placer dans un fichier \/opt\/tomcat\/bin\/setenv.sh)<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">nano \/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>Puis rajouter cette ligne au d\u00e9but du fichier :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">export CATALINA_OPTS=&quot;-Dport=8080 -DzkHost=ec2-54-217-206-154.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-206-197.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-207-3.eu-west-1.compute.amazonaws.com:2181 &quot;<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-278\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1-300x189.png\" alt=\"Tomcat Solrcloud config 1\" width=\"300\" height=\"189\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1-300x189.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1-475x300.png 475w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config1.png 878w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Nous pouvons maintenant \u00e9teindre Tomcat et le relancer :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/shutdown.sh<\/pre>\n<p>Puis :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/opt\/tomcat\/bin\/startup.sh<\/pre>\n<p>V\u00e9rifier les logs de Tomcat pour voir si tout se passe bien :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tail \u2013f \/opt\/tomcat\/logs\/catalina.out <\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-279\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2-300x192.png\" alt=\"Tomcat Solrcloud config 2\" width=\"300\" height=\"192\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2-300x192.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2-467x300.png 467w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Tomcat_Solrcloud_config2.png 769w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Ici tout semble OK puisque le contexte de solr a bien \u00e9t\u00e9 charg\u00e9 par Tomcat et la communication entre Solr et Zookeeper est \u00e9galement fonctionnelle.<br \/>\nNous pouvons maintenant nous connecter \u00e0 l\u2019interface web par n\u2019importe quelle instance et maintenant configurer notre cluster SolrCloud.<\/p>\n<blockquote><p>Configuration de SolrCloud<\/p><\/blockquote>\n<p>Se connecter \u00e0 l\u2019interface web, par exemple solrcloud3 :<br \/>\n<a href=\"http:\/\/54.217.207.3:8080\/solr\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/54.217.207.3:8080\/solr<\/a><br \/>\nOn a bien un onglet Cloud ce qui est bon signe<br \/>\nCliquer dessus puis sur Tree et on obtient\u2026 un \u00e9cran vide ce qui est normal puisqu\u2019aucune collection n\u2019a encore \u00e9t\u00e9 configur\u00e9e.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-280\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1-300x89.png\" alt=\"SolrCloud admin screenshot 1\" width=\"300\" height=\"89\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1-300x89.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1-500x149.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/SolrCloud_admin_screenshot1.png 902w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Donc ajoutons maintenant une collection qui aura 3 shards avec 2 replicas chacun sur l\u2019ensemble de nos 3 instances.<br \/>\nPour cela nous allons utiliser la <a title=\"Collections API documentation\" href=\"https:\/\/cwiki.apache.org\/confluence\/display\/solr\/Collections+API\" target=\"_blank\" rel=\"noopener noreferrer\">collections API de SolrCloud<\/a>.<br \/>\nLa syntaxe sera de cette forme :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/admin\/collections?action=CREATE&amp;amp;amp;name=name&amp;amp;amp;numShards=number&amp;amp;amp;replicationFactor=number&amp;amp;amp;maxShardsPerNode=number&amp;amp;amp;createNodeSet=nodelist&amp;amp;amp;collection.configName=configname<\/pre>\n<p>Mais pour pouvoir faire cela il faut au pr\u00e9alable avoir une configuration de Solr dans Zookeeper (param\u00e8tre <em>collection.configName=configname<\/em>).<br \/>\nIl existe plusieurs moyens de pouvoir faire \u00e7a : on aurait pu utiliser le param\u00e8tre <em>Dbootstrap_confdir<\/em> au d\u00e9marrage de la 1ere instance de Tomcat pour envoyer \u00e0 ZK notre configuration.<br \/>\nNous allons put\u00f4t utiliser ici le script zkcli.sh qui est pr\u00e9sent dans la distribution de solr dans <em>example\/scripts\/cloud-scripts<\/em> pour uploader notre config Solr \u00e0 ZK.<\/p>\n<p>Attention ! A partir d\u2019ici les commandes ne sont \u00e0 entrer que sur une seule instance et non plus sur les trois en simultan\u00e9 !<\/p>\n<p>Pour cela aller dans <em>\/opt\/solr_install<\/em> :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/solr_install\/example\/scripts\/cloud-scripts<\/pre>\n<p>Puis taper :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">sh zkcli.sh -zkhost ec2-54-217-206-154.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-206-197.eu-west-1.compute.amazonaws.com:2181,ec2-54-217-207-3.eu-west-1.compute.amazonaws.com:2181 -cmd upconfig -confdir \/opt\/solr_install\/example\/solr\/collection1\/conf -confname myconfig<\/pre>\n<p>zkhost indique l\u2019ensemble ZK, -cmd upconfig indique le r\u00e9pertoire dans lequel se trouve la configuration Solr \u00e0 envoyer (ici on a pris la collection1 fournie par d\u00e9faut avec Solr et enfin le nom sous lequel la configuration va \u00eatre stock\u00e9e dans ZK.<\/p>\n<p>Astuce : l\u2019ordre des arguments est important dans la commande<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-281\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution-300x107.png\" alt=\"cmd execution\" width=\"300\" height=\"107\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution-300x107.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution-500x178.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/cmd_execution.png 751w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Il ne nous reste plus qu\u2019\u00e0 nous connecter sur l\u2019interface web pour voir si la configuration apparait bien dans ZK :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-282\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_config-184x300.png\" alt=\"Zookeeper admin config\" width=\"184\" height=\"300\" \/><\/a><\/p>\n<p>Nous pouvons enfin cr\u00e9er la collection sur nos 3 instances, reprenons la commande \u00e9voqu\u00e9e pr\u00e9c\u00e9demment extraite de la collections api :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\/admin\/collections?action=CREATE&amp;amp;amp;name=name&amp;amp;amp;numShards=number&amp;amp;amp;replicationFactor=number&amp;amp;amp;maxShardsPerNode=number&amp;amp;amp;createNodeSet=nodelist&amp;amp;amp;collection.configName=configname<\/pre>\n<p>Adaptons la commande pour notre cas \u00e0 entrer dans le browser web :<\/p>\n<p><a href=\"http:\/\/54.217.207.3:8080\/solr\/admin\/collections?action=CREATE&amp;name=francelabs&amp;numShards=3&amp;replicationFactor=3&amp;configName=myconfig&amp;maxShardsPerNode=3\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/54.217.207.3:8080\/solr\/admin\/collections?action=CREATE&amp;name=francelabs&amp;numShards=3&amp;replicationFactor=3&amp;collection.configName=myconfig&amp;maxShardsPerNode=3<\/a><\/p>\n<p>les param\u00e8tres expliqu\u00e9s :<br \/>\n<strong>54.217.207.3:8080<\/strong> : ip publique de l\u2019instance solrcloud3, on aurait pu prendre indiff\u00e9remment celles de solrcloud1 ou solrcloud2<br \/>\n<strong>name=francelabs<\/strong> : le nom de notre collection<br \/>\n<strong>numShards=3<\/strong> : le nombre de shards qui vont se partager l\u2019index Solr<br \/>\n<strong>replicationFactor=3<\/strong> : chaque shard est r\u00e9pliqu\u00e9 2 fois (en effet un replication factor de 1 veut dire que le shard est tout seul)<br \/>\n<strong>maxShardsPerNode <\/strong>: le nombre maximum de shards par instance : ici on a 3 shards avec un replication factor de 3 soit 3&#215;3 = 9 shards au total. On a 3 machines donc 9 \/ 3 = 3 shards par node, on r\u00e8gle donc le maxShardsPerNode \u00e0 3.<\/p>\n<p>La commande va mettre un peu de temps \u00e0 s\u2019ex\u00e9cuter. Une fois celle-ci termin\u00e9e, v\u00e9rifier l\u2019\u00e9tat du cloud :<br \/>\n<a href=\"http:\/\/54.217.206.154:8080\/solr\/#\/~cloud\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/54.217.206.154:8080\/solr\/#\/~cloud<\/a><\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-283\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph-300x77.png\" alt=\"Zookeeper admin nodes graph\" width=\"300\" height=\"77\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph-300x77.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph-500x128.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Zookeeper_admin_nodes_graph.png 990w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Et si on regarde du c\u00f4t\u00e9 des fichiers cr\u00e9\u00e9s (se connecter sur n\u2019importe quelle instance, ici sur solrcloud1) :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/solr_home<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-284\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders-300x114.png\" alt=\"Created folders\" width=\"300\" height=\"114\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders-300x114.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders-500x190.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Created_folders.png 653w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>On a 3 r\u00e9pertoires qui ont \u00e9t\u00e9 cr\u00e9\u00e9s chacun contenant une partie de l\u2019index :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-285\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder-300x57.png\" alt=\"Data folder\" width=\"300\" height=\"57\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder-300x57.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder-500x96.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2014\/08\/Data_folder.png 673w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Seul le dossier data est pr\u00e9sent car la configuration de Solr est stock\u00e9e dans Zookeeper.<\/p>\n<p>C\u2019est la fin de ce tutorial permettant de configurer un cluster SolrCloud sur Amazon EC2.<\/p>\n<p>Dans d\u2019autres billets &#8211; si nous avons le temps!, nous verrons comment optimiser les ressources des diff\u00e9rentes machines, indexer sur ce cluster avec SolrJ et sans SolrJ ainsi qu\u2019effectuer des requ\u00eates avec SolrJ (load balancing int\u00e9gr\u00e9) ou sans SolrJ avec un load balancer externe.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE: This tutorial is based on Solr 4. If you want to use Solr 8, we strongly recommend to use our recent blog entry to set up Solrcloud 8 on Amazon EC2 NOTE: There is French version to this tutorial, &hellip; <a href=\"https:\/\/www.francelabs.com\/blog\/tutorial-solrcloud-amazon-ec2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,12],"tags":[42,44,43,45,41,40],"class_list":["post-258","post","type-post","status-publish","format-standard","hentry","category-search","category-solr","tag-amazon-ec2","tag-big-data","tag-cloud","tag-debian","tag-solrcloud","tag-zookeeper"],"_links":{"self":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":15,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":588,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/258\/revisions\/588"}],"wp:attachment":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}