{"id":3572,"date":"2019-11-22T08:09:32","date_gmt":"2019-11-22T08:09:32","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=3572"},"modified":"2024-04-03T10:08:23","modified_gmt":"2024-04-03T10:08:23","slug":"multinode-cluster-setup-in-cassandra","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/","title":{"rendered":"MultiNode Cluster Setup in Cassandra"},"content":{"rendered":"<h2><span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Setting up Cassandra Multi-node Cluster&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:6273,&quot;3&quot;:{&quot;1&quot;:0,&quot;3&quot;:1},&quot;10&quot;:2,&quot;14&quot;:{&quot;1&quot;:3,&quot;3&quot;:1},&quot;15&quot;:&quot;Arial&quot;}\">Setting up Cassandra Multi-node Cluster<\/span><\/h2>\n<h3><strong>Prerequisites:<\/strong><\/h3>\n<p>As you\u2019re about to create a multi-node Cassandra cluster, you must identify how many servers you\u2019d like to have in your cluster and configure each of them.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3570\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png\" alt=\"\" width=\"622\" height=\"398\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png 622w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi-300x192.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/p>\n<p>It is recommended, but not required, to have the same or similar specifications.<\/p>\n<p>To complete this tutorial, you\u2019ll need following prerequisites:<\/p>\n<p>You need at least two Ubuntu 14.04 servers configured using this initial setup guide.<\/p>\n<p>Every server must be secured with a firewall using this IPTables guide.<\/p>\n<p>Every server must also have Cassandra installed by following this Cassandra installation guide.<\/p>\n<h3><strong>Step 1 \u2014 Deleting Default Data<\/strong><\/h3>\n<p>Servers in a Cassandra cluster are called as nodes.<\/p>\n<p>What you have on every server right now is a single-node Cassandra cluster. In this step, we will set up nodes to function as a multi-node Cassandra cluster.<\/p>\n<p>All the commands in this and subsequent steps must be repeated over every node in the cluster, so be sure to have as many terminals open as you have nodes in the cluster.<\/p>\n<p>The first command you\u2019ll run on every node will stop the Cassandra daemon.<\/p>\n<p>sudo service Cassandra stop<\/p>\n<p>When that\u2019s completed, delete the default dataset.<\/p>\n<p>sudo rm -rf \/var\/lib\/cassandra\/data\/system\/*<\/p>\n<p><strong>Step 2 \u2014 Configuring the Cluster<\/strong><\/p>\n<p>Go to\u00a0 cassandra.yaml file placed in the bin directory of the setup folder.<\/p>\n<p>Only the following directives are required to be modified to set up a multi-node Cassandra cluster:<\/p>\n<p>cluster_name: It\u2019s the name of your cluster.<\/p>\n<p>Note: All the nodes in your cluster need to have exactly the same name.<\/p>\n<p>seeds: This is a comma-delimited list of the IP address of every node in your cluster.<\/p>\n<p>listen_address: This is IP address which other nodes in the cluster will use to connect to this one. By defaults its localhost and needs changed to the IP address of the node.<\/p>\n<p>rpc_address: This is IP address for remote procedure calls. It defaults to localhost. If server\u2019s hostname is properly configured, leave this as is. Otherwise, change to server\u2019s IP address or the loopback address (127.0.0.1).<\/p>\n<p>endpoint_snitch: Name of snitch, which is what tells Cassandra about what its network looks like. T<\/p>\n<h3><strong>Step 3 \u2014 Configuring the Firewall<\/strong><\/h3>\n<p>At this point, the cluster has been configured, but nodes are not communicating. Here, we\u2019ll configure the firewall to allow Cassandra traffic.<\/p>\n<p>First, restart Cassandra daemon on every node.<\/p>\n<p>sudo service cassandra start<\/p>\n<p>If you need to check status of cluster, you\u2019ll find that only the local node is listed, because it\u2019s not yet able to communicate with the other nodes.<\/p>\n<p>sudo nodetool status<\/p>\n<p>IN order to allow communication, we need to open the following network ports for every node:<\/p>\n<ul>\n<li>7000: which is TCP port for commands and data.<\/li>\n<li>9042: which is TCP port for native transport server. cqlsh, the Cassandra command line utility, will connect to cluster through this port.<\/li>\n<\/ul>\n<p>To modify firewall rules, open the rules file for IPv4.<\/p>\n<p>sudo vi \/etc\/iptables\/rules.v4<\/p>\n<p>Copy and paste the following line within the INPUT chain, which will allow traffic on the a for mentioned ports.<\/p>\n<p>You can insert following line just before the<\/p>\n<p># Reject anything that&#8217;s fall through to this point comment.<\/p>\n<p>The IP address specified by -s must be the IP address of another node in a cluster.<\/p>\n<p>If you have two nodes with IP addresses<\/p>\n<p>111.111.111.111<\/p>\n<p>222.222.222.222,<\/p>\n<p>the rule on the<\/p>\n<p>111.111.111.111 machine must use the IP address 222.222.222.222.<\/p>\n<p>-A INPUT -p tcp -s your_other_server_ip -m multiport &#8211;dports 7000,9042 -m state &#8211;state NEW,ESTABLISHED -j ACCEPT<\/p>\n<p>After adding rule, save and close the file, then restart IPTables.<\/p>\n<h4><strong>Step 4 \u2014 Check the <a href=\"https:\/\/cassandra.apache.org\/_\/index.html\">Cluster<\/a> <a href=\"https:\/\/prwatech.in\/blog\/\">Status<\/a><\/strong><\/h4>\n<p>We\u2019ve now completed all the steps needed to make the nodes into a multi-node cluster. You can verify that they\u2019re all communicating by checking their status.<\/p>\n<p>sudo nodetool status<\/p>\n<p>If you can now see all the nodes you configured, you\u2019ve just successfully set up a multi-node Cassandra cluster.<\/p>\n<p>You can also check if you can connect to the cluster using cqlsh, the Cassandra command line client.<\/p>\n<p>Note that you can specify the IP address of any node in the cluster for this command.<\/p>\n<p>cqlsh your_server_ip 9042<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up Cassandra Multi-node Cluster Prerequisites: As you\u2019re about to create a multi-node Cassandra cluster, you must identify how many servers you\u2019d like to have in your cluster and configure each of them. It is recommended, but not required, to have the same or similar specifications. To complete this tutorial, you\u2019ll need following prerequisites: You [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92,1703],"tags":[],"class_list":["post-3572","post","type-post","status-publish","format-standard","hentry","category-cassandra","category-cassandra-modules"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Setting up Cassandra Multi-node Cluster - Prwatech<\/title>\n<meta name=\"description\" content=\"Master Setting up Cassandra Multi-node Cluster - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting up Cassandra Multi-node Cluster - Prwatech\" \/>\n<meta property=\"og:description\" content=\"Master Setting up Cassandra Multi-node Cluster - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-22T08:09:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-03T10:08:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/\",\"url\":\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/\",\"name\":\"Setting up Cassandra Multi-node Cluster - Prwatech\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png\",\"datePublished\":\"2019-11-22T08:09:32+00:00\",\"dateModified\":\"2024-04-03T10:08:23+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Master Setting up Cassandra Multi-node Cluster - Dive deep with our expert instructors and comprehensive curriculum.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png\",\"width\":622,\"height\":398},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MultiNode Cluster Setup in Cassandra\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Setting up Cassandra Multi-node Cluster - Prwatech","description":"Master Setting up Cassandra Multi-node Cluster - Dive deep with our expert instructors and comprehensive curriculum.","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Setting up Cassandra Multi-node Cluster - Prwatech","og_description":"Master Setting up Cassandra Multi-node Cluster - Dive deep with our expert instructors and comprehensive curriculum.","og_url":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2019-11-22T08:09:32+00:00","article_modified_time":"2024-04-03T10:08:23+00:00","og_image":[{"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png","type":"","width":"","height":""}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/","url":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/","name":"Setting up Cassandra Multi-node Cluster - Prwatech","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png","datePublished":"2019-11-22T08:09:32+00:00","dateModified":"2024-04-03T10:08:23+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Master Setting up Cassandra Multi-node Cluster - Dive deep with our expert instructors and comprehensive curriculum.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/11\/multi.png","width":622,"height":398},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/cassandra\/cassandra-modules\/multinode-cluster-setup-in-cassandra\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"MultiNode Cluster Setup in Cassandra"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/3572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=3572"}],"version-history":[{"count":4,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/3572\/revisions"}],"predecessor-version":[{"id":11255,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/3572\/revisions\/11255"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=3572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=3572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=3572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}