{"id":325,"date":"2015-05-26T08:55:44","date_gmt":"2015-05-26T07:55:44","guid":{"rendered":"http:\/\/www.francelabs.com\/blog\/?p=325"},"modified":"2020-11-03T11:52:09","modified_gmt":"2020-11-03T10:52:09","slug":"tutorial-solrcloud-5-amazon-ec2","status":"publish","type":"post","link":"https:\/\/www.francelabs.com\/blog\/tutorial-solrcloud-5-amazon-ec2\/","title":{"rendered":"Tutorial &#8211; Deploying Solrcloud 5 on Amazon EC2"},"content":{"rendered":"<p><strong>UPDATE: This tutorial is based on Solr 5. 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 a 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\u2019ll be setting up a Solrcloud cluster on Amazon EC2.<br \/>\nWe\u2019ll be using Solr 5.1, the embedded Jetty, Zookeeper 3.4.6 on Debian 7 instances.<br \/>\nThis tutorial explains step by step how to reach this objective.<\/p>\n<p>We\u2019ll be installing a set of 3 machines, with 3 shares and 2 replicas per shard, which gives us a total of 9 shards.<br \/>\nWe\u2019ll also be installing a Zookeeper ensemble of 3 machines.<\/p>\n<p>This architecture will be flexible enough to allow for a fail-over of one or two machines, depending on whether we\u2019re at the indexing phase or at the querying phase:<\/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 are successfully broadcasted to the machines still running.<\/li>\n<li>Querying: two machines can fail without impacting the cluster. Since each machine hosts 3 shards, a search query can be processed without problems, the only constraints being a slower response time due to the higher load on the remaining machine.<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p>Here is the architecture of what we want to achieve :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-328\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi-300x251.png\" alt=\"Solrcloud 5 archi EC2\" width=\"300\" height=\"251\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi-300x251.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi-358x300.png 358w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi.png 772w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To achieve this, we\u2019ll 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 software components<\/li>\n<li>Configuration of Solr Home<\/li>\n<li>Configuration of Zookeeper<\/li>\n<li>Configuration of Solrcloud<\/li>\n<\/ul>\n<blockquote><p><strong>Configuration of EC2 instances:<\/strong><\/p><\/blockquote>\n<p>In this tutorial, the chosen instances are of type m3 medium with the following specs :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-329\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi-300x68.png\" alt=\"Sorlcloud EC2 machines specs\" width=\"300\" height=\"68\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi-300x68.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi-500x113.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi.png 556w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This will be more than enough for our tutorial.<\/p>\n<p>Once connected to AWS, go to the EC2 page and create 3 instances of type m3 medium. Chose the Debian8 image (Jessy) 64 bits, which is available for free on the AWS Store:<\/p>\n<p>Create or use a security key common to the 3 instances.<\/p>\n<p>Once started, you should have the following 3 AWS instances, named respectively solrcloud1, solrcloud2 and solrcloud3:<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-330\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-300x16.png\" alt=\"EC2 machines running\" width=\"300\" height=\"16\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-300x16.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-1024x54.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-500x26.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines.png 1439w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You need to set the group security associated to the instances so that the instances can communicate with each other, and so that we can access to the Jetty from outside.<\/p>\n<p>The rules to added are (in addition of the SSH connection):<br \/>\nJetty: TCP 8983<br \/>\nZookeeper: TCP 2181, 2888, 3888<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-331\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-300x94.png\" alt=\"The ports for the tutorial\" width=\"300\" height=\"94\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-300x94.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-1024x322.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-500x157.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports.png 1217w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We advise to assign \u00ab elastic ip \u00bb addresses to the instances, in order to connect to it using a fix public ip address.<br \/>\nWithout elastic ip addresses, you\u2019d be forced to declare the private ip addresses of the instances within the Zookeeper (ZK) configuration, and these IPs change everytime you restart your machines, meaning you\u2019d need to reconfigure your ZK after every restart. Using elastic ips, you benefit from the public dns which takes care of mapping the private ip addresses.<\/p>\n<p>Once the instances are ready, we can connect to it.<\/p>\n<p>For this, use either Putty on Windows, or the terminal on Linux\/Mac OS X, with the security key bound to the instances.<br \/>\nIn this tutorial, we\u2019ll be using EC2Box (http:\/\/ec2box.com) which can easily send grouped commands to several EC2 instances.<br \/>\nFor this, download EC2Box: https:\/\/github.com\/skavanagh\/EC2Box\/releases<br \/>\nAs a windows user in this tutorial screenshots, the version installed is ec2box-jetty-v-0.26.00<br \/>\nOnce installed, launch startEC2Box.bat<br \/>\nThen connect to https:\/\/localhost:8443<br \/>\nThe default credentials are:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">username:admin<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">password:changeme<\/pre>\n<p>Then go to Set AWS Credentials and enter the access key of the AWS user.<br \/>\nNext, go to Set EC2 Keys, enter the private key of the security key bound to the EC2 instances.<br \/>\nLast, go to Secure Shell -&gt; Composite SSH Terms and pick the 3 solrcloud instances.<\/p>\n<p>Pick the admin user in order to connect properly.<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-333\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-300x142.png\" alt=\"Solrcloud5_EC2_05_instancescmds\" width=\"300\" height=\"142\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-300x142.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-1024x483.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-500x236.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds.png 1454w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To send each command simultaneously to the 3 instances, you must click on each window or click on select all on top of the screen.<br \/>\nTo be root:<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">sudo -i<\/pre>\n<p>Our instances are successfully created and we successfully connected to it, so now let\u2019s now the real work!<\/p>\n<blockquote><p><strong>Installing Java and the software components:<\/strong><\/p><\/blockquote>\n<p>We will start with installing Oracle Java JDK 8, then we\u2019ll download the latest versions of Solr and Zookeeper.<\/p>\n<blockquote><p><strong>Installing Java:<\/strong><\/p><\/blockquote>\n<p>To quickly setup Java, we\u2019ll be using a repository hosted by webupd8team :<br \/>\nhttp:\/\/www.webupd8.org\/2014\/03\/how-to-install-oracle-java-8-in-debian.html<br \/>\nHere are the commands :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">echo &quot;deb http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu trusty main&quot; | tee \/etc\/apt\/sources.list.d\/webupd8team-java.list<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">echo &quot;deb-src http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu trusty main&quot; | tee -a \/etc\/apt\/sources.list.d\/webupd8team-java.list<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys EEA14886<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">apt-get update<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">apt-get install oracle-java8-installer<\/pre>\n<p>Accept the licence terms of Oracle and wait for install to complete.<br \/>\nTo check that Java is properly installed, enter :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">java \u2013version<\/pre>\n<p>And you should be getting :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">java version<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">&quot;1.8.0_45&quot;<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Java(TM) SE Runtime Environment (build 1.8.0_45-b14)<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-345\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-300x181.png\" alt=\"Solrcloud5_EC2_15_java_success\" width=\"300\" height=\"181\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-300x181.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-1024x616.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-498x300.png 498w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success.png 1367w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<blockquote><p><strong>Installing the software components:<\/strong><\/p><\/blockquote>\n<p>Go to \/home\/admin :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/home\/admin<\/pre>\n<p>Download Solr :<br \/>\nhttp:\/\/apache.mirrors.ovh.net\/ftp.apache.org\/dist\/lucene\/solr\/5.1.0<\/p>\n<p>Download Zookeeper :<br \/>\nhttp:\/\/mirrors.ircam.fr\/pub\/apache\/zookeeper\/stable\/zookeeper-3.4.6.tar.gz<\/p>\n<p>Then unzip these archives :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Tar xfvz solr*.tar.gz<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Tar xfvz zookeeper-3.4.6.tar.gz<\/pre>\n<p>Solr is installed as a service using the provided script :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/home\/admin\/solr-5.1.0\/solr\/bin<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">.\/install_solr_service.sh \/home\/admin\/solr-5.1.0.zip<\/pre>\n<p>You can leave the default parameters of the script.<br \/>\nAll the install files are in \/opt\/solr (do not modify them) and all the files to be modified are located in \/var\/solr (solr home, logs)<br \/>\nSolr is installed by defaults in \/opt\/solr-5.1.0 with a symbolic link towards \/opt\/solr.<br \/>\nThe RAM is also configured by default. To change these values, you need to modify SOLR_JAVA_MEM in \/var\/solr\/solr.in.sh :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_JAVA_MEM=&quot;-Xms512m -Xmx512m&quot;<\/pre>\n<p>Next, move the zookeeper folder into \/opt :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mv zookeeper-3.4.6 \/opt\/zookeeper<\/pre>\n<p>Java is correctly installed, as well as all the software components required to configure our SolrCloud cluster.<br \/>\nLet\u2019s move on to the configuration aspects !<\/p>\n<blockquote><p><strong>Configuring Solr Home:<\/strong><\/p><\/blockquote>\n<p>Let&#8217;s go into the solr home folder :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/var\/solr\/data<\/pre>\n<p>Open the solr.xml file, and replace the the host param with the public ip address of each ec2 instance.<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-334\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-300x126.png\" alt=\"EC2 config Solrcloud\" width=\"300\" height=\"126\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-300x126.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-1024x430.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-500x210.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config.png 1454w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You also need to modify the Solr start script, to notify that we want to start Solr in SolrCloud mode.<\/p>\n<p>Nano \/var\/solr\/solr.in.sh :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">ZK_HOST=ec2-54-216-117-22.eu-west-1.compute.amazonaws.com:2181,ec2-54-74-44-196.eu-west-1.compute.amazonaws.com:2181,ec2-54-74-32-181.eu-west-1.compute.amazonaws.com:2181<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_PID_DIR=\/var\/solr<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_HOME=\/var\/solr\/data<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">LOG4J_PROPS=\/var\/solr\/log4j.properties<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_LOGS_DIR=var\/solr\/logs<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_PORT=8983<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_MODE=solrcloud<\/pre>\n<p>The most important parameters are ZK_HOST where one needs to specify the IP addresses of our ZK ensemble, and SOLR_MODE=solrcloud to specify that Solr is in Solrcloud mode.<\/p>\n<blockquote><p><strong>Configuring Zookeeper:<\/strong><\/p><\/blockquote>\n<p>Go to \/opt\/zookeeper :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/opt\/zookeeper<\/pre>\n<p>We will be creating the configuration that allows to setup a ZK ensemble made of 3 machines.<br \/>\nCreate a folder allowing Zookeeper to place its data :<\/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>Change 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\/2015\/05\/Solrcloud5_EC2_07_running_instances.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-335\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-300x127.png\" alt=\"Solrcloud5_EC2_07_running_instances\" width=\"300\" height=\"127\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-300x127.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-1024x435.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-500x212.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances.png 1447w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now let&#8217;s move on to the configuration per se, by creating the zoo.cfg file in \/opt\/zookeeper\/conf :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">nano \/opt\/zookeeper\/conf\/zoo.cfg<\/pre>\n<p>Now put the following configuration :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">tickTime=2000<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">dataDir=\/opt\/zookeeper\/tmp<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">clientPort=2181<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">initLimit=5<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">syncLimit=2<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">server.1=ec2-54-155-21-60.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">server.2=ec2-54-216-61-115.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">server.3=ec2-54-195-44-73.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-336\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-300x126.png\" alt=\"Solrcloud5_EC2_08_running_instances\" width=\"300\" height=\"126\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-300x126.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-1024x431.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-500x210.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances.png 1446w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Hints :<br \/>\n&#8211; Take care not to put the public IP address, but rather the public DNS, otherwise the machines won&#8217;t be able to talk with each other.<br \/>\nTo be sure, check upfront that they can ping each other<br \/>\n&#8211; Also beware of the instances security group. Ensure that the ports that are necessary for communication between instances on Zookeeper are properly open (2181, 2888 et 3888)<\/p>\n<p>Open the ZK logs and check that everything is 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\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-337\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-300x131.png\" alt=\"Solrcloud5_EC2_09_running_zookeeper\" width=\"300\" height=\"131\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-300x131.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-1024x446.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-500x218.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper.png 1451w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We can now connect to the web interface from any instance, and start configuring our SolrCloud cluster.<\/p>\n<blockquote><p><strong>Configuration de SolrCloud:<\/strong><\/p><\/blockquote>\n<p>To connect to the web interface, for instance solrcloud1 :<br \/>\nhttp:\/\/54.195.44.73:8983\/solr\/<br \/>\nYou should see a Cloud tab, which is a good sign !<br \/>\nClick on this tab, then on Tree, and you should get&#8230; an empty screen, which is normal since no collection has been configured yet.<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-339\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-300x122.png\" alt=\"Solrcloud5_EC2_10_solr_admin\" width=\"300\" height=\"122\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-300x122.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-1024x418.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-500x204.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin.png 1453w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>So let&#8217;s add a collection made of 3 shards with 2 replicas each, on our ensemble of 3 instances.<br \/>\nTo achieve this, let&#8217;s use the collections API of SolrCloud : https:\/\/cwiki.apache.org\/confluence\/display\/solr\/Collections+API<br \/>\nThe syntax looks like this :<br \/>\n\/admin\/collections?action=CREATE&amp;name=name&amp;numShards=number&amp;replicationFactor=number&amp;maxShardsPerNode=number&amp;createNodeSet=nodelist&amp;collection.configName=configname<\/p>\n<p>To do this, we firstt need a Solr configuration in Zookeeper (param\u00e8tre collection.configName=configname).<br \/>\nWe&#8217;ll be using here the zkcli.sh script which is available in the Solr distro under server\/scripts\/cloud-scripts to upload our Solr configuration towards ZK.<\/p>\n<p>BEWARE ! From now on, the commands must be entered in only one instance, not simultaneously on the 3 instances anymore !<\/p>\n<p>For this, go to \/home\/admin\/solr-5.1.0\/server\/scripts\/cloud-scripts :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/home\/admin\/solr-5.1.0\/server\/scripts\/cloud-scripts<\/pre>\n<p>Then enter :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">.\/zkcli.sh -zkhost ec2-54-74-44-196.eu-west-1.compute.amazonaws.com:2181,ec2-54-216-61-115.eu-west-1.compute.amazonaws.com:2888,ec2-54-195-44-73.eu-west-1.compute.amazonaws.com:2888 -cmd upconfig -confdir \/home\/admin\/solr-5.1.0\/server\/solr\/configsets\/basic_configs\/conf -confname myconfig<\/pre>\n<p>zkhost represents the ZK ensemble, -cmd upconfig represents the folder in which you&#8217;ll find the Solr configuration to be sent (here we use the default configuration provided with Solr) and last the name with which the configuration will be stored in ZK.<\/p>\n<p>Hint: the sequence of the arguments in the command does matter<\/p>\n<p>What&#8217;s left for us is to connect to the web interface to check if the configuration is present in ZK :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-340\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders-183x300.png\" alt=\"Solrcloud5_EC2_11_zookeeper_folders\" width=\"183\" height=\"300\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders-183x300.png 183w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders.png 403w\" sizes=\"auto, (max-width: 183px) 100vw, 183px\" \/><\/a><\/p>\n<p>We can now create the collection on our 3 instances, let&#8217;s use the command mentionned above, which comes from the collections API :<br \/>\n\/admin\/collections?action=CREATE&amp;name=name&amp;numShards=number&amp;replicationFactor=number&amp;maxShardsPerNode=number&amp;createNodeSet=nodelist&amp;collection.configName=configname<\/p>\n<p>Let&#8217;s adapt this commande for our case, and type it in in our web browser :<\/p>\n<p>http:\/\/54.74.44.196:8983\/solr\/admin\/collections?action=CREATE&#038;name=francelabs&#038;numShards=3&#038;replicationFactor=3&#038;collection.configName=myconfig&#038;maxShardsPerNode=3<br \/>\nSome explanation about the parameters :<\/p>\n<ul>\n<li>54.74.44.196 :8983 : the public ip address of the solrcloud1 instance, we could also have chosen the ones of solrcloud2 or solrcloud3, this doesn&#8217;t matter<\/li>\n<li>name = francelabs : the name of our collection<\/li>\n<li>numShards = 3 : the number of shards that will be sharing the Solr index<\/li>\n<li>replicationFactor = 3 : each shard is replicated 2 times (as a matter of fact, using a replication factor of 1 means that shard is alone)<\/li>\n<li>maxShardsPerNode : the maximum number of shards per instance: here we have 3 shards with a replication factor of 3 hence 3&#215;3 = 9 shards in total. We have 3 machines hence 9 \/ 3 = 3 shards per node, so we set maxShardsPerNode to 3.<\/li>\n<\/ul>\n<p>This command will take some time to complete. Once it is done, check the status of your cloud :<br \/>\nhttp:\/\/54.195.44.73:8983\/solr\/#\/~cloud<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-341\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-300x94.png\" alt=\"Solrcloud5_EC2_12_solr_admin_zookeeper\" width=\"300\" height=\"94\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-300x94.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-1024x321.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-500x157.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper.png 1211w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>And if we want to see which files have been created (connect to any instance, here to solrcloud1) :<br \/>\ncd \/var\/solr\/data<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-342\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-300x28.png\" alt=\"Solrcloud5_EC2_13_solr_files\" width=\"300\" height=\"28\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-300x28.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-1000x95.png 1000w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-500x46.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files.png 1023w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We have 3 created folders, each containing a part of the index :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-343\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files-300x33.png\" alt=\"Solrcloud5_EC2_14_solr_files\" width=\"300\" height=\"33\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files-300x33.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files-500x55.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files.png 645w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The only folder is data, as the configuration of Solr is stored in Zookeeper.<\/p>\n<p>And VOILA, you now have a fully fonctionnal Solrcloud system on Amazon EC2. We hope you enjoyed this blog post!<\/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 5.1, de Jetty embarqu\u00e9 avec Solr 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.<br \/>\nCette 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 :<br \/>\n&#8211; 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<br \/>\n&#8211; 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.<\/p>\n<p>Voici sch\u00e9matiquement ce que l\u2019on souhaite obtenir :<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-328\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi-300x251.png\" alt=\"Solrcloud 5 archi EC2\" width=\"300\" height=\"251\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi-300x251.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi-358x300.png 358w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_01_archi.png 772w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>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 de Zookeeper<\/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\/2015\/05\/Solrcloud5_EC2_02_archi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-329\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi-300x68.png\" alt=\"Sorlcloud EC2 machines specs\" width=\"300\" height=\"68\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi-300x68.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi-500x113.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_02_archi.png 556w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>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 Debian8 (Jessy) 64 bits disponible sur le AWS Store (gratuit) :<\/p>\n<p>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\/2015\/05\/Solrcloud5_EC2_03_EC2machines.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-330\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-300x16.png\" alt=\"EC2 machines running\" width=\"300\" height=\"16\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-300x16.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-1024x54.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines-500x26.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_03_EC2machines.png 1439w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>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 Jetty de l\u2019ext\u00e9rieur.<\/p>\n<p>Les r\u00e8gles \u00e0 ajouter sont les suivantes (en plus de la connexion SSH) :<br \/>\nJetty : TCP 8983<br \/>\nZookeeper : TCP 2181, 2888, 3888<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-331\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-300x94.png\" alt=\"The ports for the tutorial\" width=\"300\" height=\"94\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-300x94.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-1024x322.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports-500x157.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_04_Ports.png 1217w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Il est conseill\u00e9 d\u2019associer des \u00ab elastic ip \u00bb aux instances pour pouvoir y acc\u00e9der via une ip publique fixe.<br \/>\nEn effet, sans elastic ip, nous sommes 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\u00e9marr\u00e9e. Alors que le public dns permet de faire la r\u00e9solution de l\u2019ip priv\u00e9e de l\u2019instance.<\/p>\n<p>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 EC2Box (http:\/\/ec2box.com\/) qui permet d\u2019envoyer des commandes group\u00e9es \u00e0 plusieurs instances EC2 facilement.<br \/>\nPour cela, t\u00e9l\u00e9charger EC2box ici : https:\/\/github.com\/skavanagh\/EC2Box\/releases<br \/>\nEtant sur Windows, la version install\u00e9e ici est la ec2box-jetty-v-0.26.00<br \/>\nUne fois install\u00e9, lancer startEC2Box.bat.<br \/>\nPuis se connecter sur https:\/\/localhost:8443\/<\/p>\n<p>Les infos de login par d\u00e9faut sont :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">username:admin<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">password:changeme<\/pre>\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.<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-333\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-300x142.png\" alt=\"Solrcloud5_EC2_05_instancescmds\" width=\"300\" height=\"142\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-300x142.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-1024x483.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds-500x236.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_05_instancescmds.png 1454w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>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 :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">sudo -i<\/pre>\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 8 puis nous allons t\u00e9l\u00e9charger les derni\u00e8res versions de Solr 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 repository host\u00e9 par webupd8team :<br \/>\nhttp:\/\/www.webupd8.org\/2014\/03\/how-to-install-oracle-java-8-in-debian.html<br \/>\nVoici les commandes :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">echo &quot;deb http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu trusty main&quot; | tee \/etc\/apt\/sources.list.d\/webupd8team-java.list<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">echo &quot;deb-src http:\/\/ppa.launchpad.net\/webupd8team\/java\/ubuntu trusty main&quot; | tee -a \/etc\/apt\/sources.list.d\/webupd8team-java.list<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys EEA14886<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">apt-get update<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">apt-get install oracle-java8-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<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">&quot;1.8.0_45&quot;<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Java(TM) SE Runtime Environment (build 1.8.0_45-b14)<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-345\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-300x181.png\" alt=\"Solrcloud5_EC2_15_java_success\" width=\"300\" height=\"181\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-300x181.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-1024x616.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success-498x300.png 498w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_15_java_success.png 1367w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<blockquote><p><strong>Installation des briques logicielles:<\/strong><\/p><\/blockquote>\n<p>Se placer dans \/home\/admin :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/home\/admin<\/pre>\n<p>T\u00e9l\u00e9charger Solr :<br \/>\nhttp:\/\/apache.mirrors.ovh.net\/ftp.apache.org\/dist\/lucene\/solr\/5.1.0<\/p>\n<p>T\u00e9l\u00e9charger Zookeeper :<br \/>\nhttp:\/\/mirrors.ircam.fr\/pub\/apache\/zookeeper\/stable\/zookeeper-3.4.6.tar.gz<\/p>\n<p>Puis d\u00e9compresser chacune des archives :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Tar xfvz solr*.tar.gz<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Tar xfvz zookeeper-3.4.6.tar.gz<\/pre>\n<p>On installe Solr comme un service avec le script fourni :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/home\/admin\/solr-5.1.0\/solr\/bin<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">.\/install_solr_service.sh \/home\/admin\/solr-5.1.0.zip<\/pre>\n<p>On laisse les param\u00e8tres par d\u00e9faut du script.<br \/>\nTous les fichiers d\u2019installation sont dans \/opt\/solr (\u00e0 ne pas modifier) et tous les fichiers \u00e0 modifier sont dans \/var\/solr (solr home, logs)<br \/>\nSolr est install\u00e9 par d\u00e9faut dans \/opt\/solr-5.1.0 avec un lien symbolique vers \/opt\/solr.<br \/>\nLa RAM est \u00e9galement param\u00e9tr\u00e9e par d\u00e9faut. Pour modifier ces valeurs, il faut modifier dans \/var\/solr\/solr.in.sh le param\u00e8tre SOLR_JAVA_MEM :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_JAVA_MEM=&quot;-Xms512m -Xmx512m&quot;<\/pre>\n<p>On d\u00e9place ensuite le r\u00e9pertoire de Zookeeper dans \/opt :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">mv zookeeper-3.4.6 \/opt\/zookeeper<\/pre>\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><strong>Configuration du Solr Home:<\/strong><\/p><\/blockquote>\n<p>Allons maintenant dans le solr home :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/var\/solr\/data<\/pre>\n<p>Editer le fichier solr.xml en rempla\u00e7ant le host par l\u2019ip publique de chaque instance ec2.<br \/>\n<a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-334\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-300x126.png\" alt=\"EC2 config Solrcloud\" width=\"300\" height=\"126\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-300x126.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-1024x430.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config-500x210.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_06_instances_config.png 1454w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Il faut \u00e9galement modifier le script de lancement de Solr pour indiquer que nous d\u00e9sirons d\u00e9marrer Solr en mode SolrCloud.<\/p>\n<p>Nano \/var\/solr\/solr.in.sh :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">ZK_HOST=ec2-54-216-117-22.eu-west-1.compute.amazonaws.com:2181,ec2-54-74-44-196.eu-west-1.compute.amazonaws.com:2181,ec2-54-74-32-181.eu-west-1.compute.amazonaws.com:2181<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_PID_DIR=\/var\/solr<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_HOME=\/var\/solr\/data<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">LOG4J_PROPS=\/var\/solr\/log4j.properties<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_LOGS_DIR=var\/solr\/logs<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_PORT=8983<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">SOLR_MODE=solrcloud<\/pre>\n<p>Les param\u00e8tres les plus importants sont ZK_HOST o\u00f9 il faut sp\u00e9cifier les IP de notre ensemble ZK et SOLR_MODE=solrcloud pour sp\u00e9cifier que Solr est en mode Solrcloud.<\/p>\n<blockquote><p><strong>Configuration de Zookeeper:<\/strong><\/p><\/blockquote>\n<p>Aller dans \/opt\/zookeeper :<br \/>\ncd \/opt\/zookeeper<br \/>\nNous 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 :<br \/>\nmkdir \/opt\/zookeeper\/tmp<br \/>\nEt \u00e0 l\u2019int\u00e9rieur de celui-ci cr\u00e9er un fichier myid :<br \/>\nnano \/opt\/zookeeper\/tmp\/myid<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\/2015\/05\/Solrcloud5_EC2_07_running_instances.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-335\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-300x127.png\" alt=\"Solrcloud5_EC2_07_running_instances\" width=\"300\" height=\"127\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-300x127.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-1024x435.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances-500x212.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_07_running_instances.png 1447w\" 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<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">dataDir=\/opt\/zookeeper\/tmp<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">clientPort=2181<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">initLimit=5<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">syncLimit=2<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">server.1=ec2-54-155-21-60.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">server.2=ec2-54-216-61-115.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">server.3=ec2-54-195-44-73.eu-west-1.compute.amazonaws.com:2888:3888<\/pre>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-336\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-300x126.png\" alt=\"Solrcloud5_EC2_08_running_instances\" width=\"300\" height=\"126\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-300x126.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-1024x431.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances-500x210.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_08_running_instances.png 1446w\" 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>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\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-337\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-300x131.png\" alt=\"Solrcloud5_EC2_09_running_zookeeper\" width=\"300\" height=\"131\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-300x131.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-1024x446.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper-500x218.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_09_running_zookeeper.png 1451w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Nous pouvons maintenant nous connecter \u00e0 l\u2019interface web par n\u2019importe quelle instance et maintenant configurer notre cluster SolrCloud.<\/p>\n<blockquote><p><strong>Configuration de SolrCloud:<\/strong><\/p><\/blockquote>\n<p>Se connecter \u00e0 l\u2019interface web, par exemple solrcloud1 :<br \/>\nhttp:\/\/54.195.44.73:8983\/solr\/<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\/2015\/05\/Solrcloud5_EC2_10_solr_admin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-339\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-300x122.png\" alt=\"Solrcloud5_EC2_10_solr_admin\" width=\"300\" height=\"122\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-300x122.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-1024x418.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin-500x204.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_10_solr_admin.png 1453w\" 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 collections API de SolrCloud : https:\/\/cwiki.apache.org\/confluence\/display\/solr\/Collections+API<br \/>\nLa syntaxe sera de cette forme :<br \/>\n\/admin\/collections?action=CREATE&amp;name=name&amp;numShards=number&amp;replicationFactor=number&amp;maxShardsPerNode=number&amp;createNodeSet=nodelist&amp;collection.configName=configname<\/p>\n<p>Mais pour pouvoir faire cela il faut au pr\u00e9alable avoir une configuration de Solr dans Zookeeper (param\u00e8tre collection.configName=configname).<br \/>\nNous allons utiliser ici le script zkcli.sh qui est pr\u00e9sent dans la distribution de Solr dans server\/scripts\/cloud-scripts pour uploader notre configuration 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 \/home\/admin\/solr-5.1.0\/server\/scripts\/cloud-scripts :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">cd \/home\/admin\/solr-5.1.0\/server\/scripts\/cloud-scripts<\/pre>\n<p>Puis taper :<\/p>\n<pre><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">.\/zkcli.sh -zkhost ec2-54-74-44-196.eu-west-1.compute.amazonaws.com:2181,ec2-54-216-61-115.eu-west-1.compute.amazonaws.com:2888,ec2-54-195-44-73.eu-west-1.compute.amazonaws.com:2888 -cmd upconfig -confdir \/home\/admin\/solr-5.1.0\/server\/solr\/configsets\/basic_configs\/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 une configuration par d\u00e9faut fournie 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>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\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-340\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders-183x300.png\" alt=\"Solrcloud5_EC2_11_zookeeper_folders\" width=\"183\" height=\"300\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders-183x300.png 183w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_11_zookeeper_folders.png 403w\" sizes=\"auto, (max-width: 183px) 100vw, 183px\" \/><\/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 :<br \/>\n\/admin\/collections?action=CREATE&amp;name=name&amp;numShards=number&amp;replicationFactor=number&amp;maxShardsPerNode=number&amp;createNodeSet=nodelist&amp;collection.configName=configname<\/p>\n<p>Adaptons la commande pour notre cas \u00e0 entrer dans le browser web :<\/p>\n<p>http:\/\/54.74.44.196:8983\/solr\/admin\/collections?action=CREATE&#038;name=francelabs&#038;numShards=3&#038;replicationFactor=3&#038;collection.configName=myconfig&#038;maxShardsPerNode=3<br \/>\nLes param\u00e8tres expliqu\u00e9s :<\/p>\n<ul>\n<li>54.74.44.196 :8983 : ip publique de l\u2019instance solrcloud1, on aurait pu prendre indiff\u00e9remment celles de solrcloud2 ou solrcloud3<\/li>\n<li>name = francelabs : le nom de notre collection<\/li>\n<li>numShards = 3 : le nombre de shards qui vont se partager l\u2019index Solr<\/li>\n<li>replicationFactor = 3 : chaque shard est r\u00e9pliqu\u00e9 2 fois (en effet un replication factor de 1 veut dire que le shard est tout seul)<\/li>\n<li>maxShardsPerNode : 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.<\/li>\n<\/ul>\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 \/>\nhttp:\/\/54.195.44.73:8983\/solr\/#\/~cloud<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-341\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-300x94.png\" alt=\"Solrcloud5_EC2_12_solr_admin_zookeeper\" width=\"300\" height=\"94\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-300x94.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-1024x321.png 1024w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper-500x157.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_12_solr_admin_zookeeper.png 1211w\" 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) :<br \/>\ncd \/var\/solr\/data<\/p>\n<p><a href=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-342\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-300x28.png\" alt=\"Solrcloud5_EC2_13_solr_files\" width=\"300\" height=\"28\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-300x28.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-1000x95.png 1000w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files-500x46.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_13_solr_files.png 1023w\" 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\/2015\/05\/Solrcloud5_EC2_14_solr_files.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-343\" src=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files-300x33.png\" alt=\"Solrcloud5_EC2_14_solr_files\" width=\"300\" height=\"33\" srcset=\"https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files-300x33.png 300w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files-500x55.png 500w, https:\/\/www.francelabs.com\/blog\/wp-content\/uploads\/2015\/05\/Solrcloud5_EC2_14_solr_files.png 645w\" 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>Et voil\u00e0, votre SolrCloud sur Amazon EC2 est maintenant fonctionnel, en esp\u00e9rant que ce blog vous sera utile!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE: This tutorial is based on Solr 5. 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 a French version to this &hellip; <a href=\"https:\/\/www.francelabs.com\/blog\/tutorial-solrcloud-5-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,54],"tags":[56,42,44,43,55],"class_list":["post-325","post","type-post","status-publish","format-standard","hentry","category-search","category-solr","category-solrcloud","tag-amazon","tag-amazon-ec2","tag-big-data","tag-cloud","tag-ec2"],"_links":{"self":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/325","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=325"}],"version-history":[{"count":15,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/325\/revisions"}],"predecessor-version":[{"id":600,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/325\/revisions\/600"}],"wp:attachment":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}