| --- |
| layout: docpage |
| |
| title: "Documentation" |
| |
| is_homepage: false |
| is_sphinx_doc: true |
| |
| doc-parent: "Getting Started" |
| |
| doc-title: "Installing Cassandra" |
| doc-header-links: ' |
| <link rel="top" title="Apache Cassandra Documentation v4.0-alpha5" href="../index.html"/> |
| <link rel="up" title="Getting Started" href="index.html"/> |
| <link rel="next" title="Configuring Cassandra" href="configuring.html"/> |
| <link rel="prev" title="Getting Started" href="index.html"/> |
| ' |
| doc-search-path: "../search.html" |
| |
| extra-footer: ' |
| <script type="text/javascript"> |
| var DOCUMENTATION_OPTIONS = { |
| URL_ROOT: "", |
| VERSION: "", |
| COLLAPSE_INDEX: false, |
| FILE_SUFFIX: ".html", |
| HAS_SOURCE: false, |
| SOURCELINK_SUFFIX: ".txt" |
| }; |
| </script> |
| ' |
| |
| --- |
| <div class="container-fluid"> |
| <div class="row"> |
| <div class="col-md-3"> |
| <div class="doc-navigation"> |
| <div class="doc-menu" role="navigation"> |
| <div class="navbar-header"> |
| <button type="button" class="pull-left navbar-toggle" data-toggle="collapse" data-target=".sidebar-navbar-collapse"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| </div> |
| <div class="navbar-collapse collapse sidebar-navbar-collapse"> |
| <form id="doc-search-form" class="navbar-form" action="../search.html" method="get" role="search"> |
| <div class="form-group"> |
| <input type="text" size="30" class="form-control input-sm" name="q" placeholder="Search docs"> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </div> |
| </form> |
| |
| |
| |
| <ul class="current"> |
| <li class="toctree-l1 current"><a class="reference internal" href="index.html">Getting Started</a><ul class="current"> |
| <li class="toctree-l2 current"><a class="current reference internal" href="#">Installing Cassandra</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#prerequisites">Prerequisites</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#choosing-an-installation-method">Choosing an installation method</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#installing-the-binary-tarball">Installing the binary tarball</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#installing-the-debian-packages">Installing the Debian packages</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#installing-the-rpm-packages">Installing the RPM packages</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#further-installation-info">Further installation info</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="configuring.html">Configuring Cassandra</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="querying.html">Inserting and querying</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="drivers.html">Client drivers</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="production.html">Production Recommendations</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../new/index.html">New Features in Apache Cassandra 4.0</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../architecture/index.html">Architecture</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../cql/index.html">The Cassandra Query Language (CQL)</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../data_modeling/index.html">Data Modeling</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../configuration/index.html">Configuring Cassandra</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../plugins/index.html">Third-Party Plugins</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> |
| </ul> |
| |
| |
| |
| </div><!--/.nav-collapse --> |
| </div> |
| </div> |
| </div> |
| <div class="col-md-8"> |
| <div class="content doc-content"> |
| <div class="content-container"> |
| |
| <div class="section" id="installing-cassandra"> |
| <h1>Installing Cassandra<a class="headerlink" href="#installing-cassandra" title="Permalink to this headline">¶</a></h1> |
| <p>These are the instructions for deploying the supported releases of Apache Cassandra on Linux servers.</p> |
| <p>Cassandra runs on a wide array of Linux distributions including (but not limited to):</p> |
| <ul class="simple"> |
| <li>Ubuntu, most notably LTS releases 16.04 to 18.04</li> |
| <li>CentOS & RedHat Enterprise Linux (RHEL) including 6.6 to 7.7</li> |
| <li>Amazon Linux AMIs including 2016.09 through to Linux 2</li> |
| <li>Debian versions 8 & 9</li> |
| <li>SUSE Enterprise Linux 12</li> |
| </ul> |
| <p>This is not an exhaustive list of operating system platforms, nor is it prescriptive. However users will be |
| well-advised to conduct exhaustive tests of their own particularly for less-popular distributions of Linux. |
| Deploying on older versions is not recommended unless you have previous experience with the older distribution |
| in a production environment.</p> |
| <div class="section" id="prerequisites"> |
| <h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline">¶</a></h2> |
| <ul class="simple"> |
| <li>Install the latest version of Java 8, either the <a class="reference external" href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Oracle Java Standard Edition 8</a> or <a class="reference external" href="http://openjdk.java.net/">OpenJDK 8</a>. To |
| verify that you have the correct version of java installed, type <code class="docutils literal notranslate"><span class="pre">java</span> <span class="pre">-version</span></code>.</li> |
| <li><strong>NOTE</strong>: <em>Experimental</em> support for Java 11 was added in Cassandra 4.0 (<a class="reference external" href="https://issues.apache.org/jira/browse/CASSANDRA-9608">CASSANDRA-9608</a>). |
| Running Cassandra on Java 11 is <em>experimental</em>. Do so at your own risk. For more information, see |
| <a class="reference external" href="https://github.com/apache/cassandra/blob/trunk/NEWS.txt">NEWS.txt</a>.</li> |
| <li>For using cqlsh, the latest version of <a class="reference external" href="https://www.python.org/downloads/">Python 2.7</a> or Python 3.6+. To verify that you have |
| the correct version of Python installed, type <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">--version</span></code>.</li> |
| </ul> |
| </div> |
| <div class="section" id="choosing-an-installation-method"> |
| <h2>Choosing an installation method<a class="headerlink" href="#choosing-an-installation-method" title="Permalink to this headline">¶</a></h2> |
| <p>For most users, installing the binary tarball is the simplest choice. The tarball unpacks all its contents |
| into a single location with binaries and configuration files located in their own subdirectories. The most |
| obvious attribute of the tarball installation is it does not require <code class="docutils literal notranslate"><span class="pre">root</span></code> permissions and can be |
| installed on any Linux distribution.</p> |
| <p>Packaged installations require <code class="docutils literal notranslate"><span class="pre">root</span></code> permissions. Install the RPM build on CentOS and RHEL-based |
| distributions if you want to install Cassandra using YUM. Install the Debian build on Ubuntu and other |
| Debian-based distributions if you want to install Cassandra using APT. Note that both the YUM and APT |
| methods required <code class="docutils literal notranslate"><span class="pre">root</span></code> permissions and will install the binaries and configuration files as the |
| <code class="docutils literal notranslate"><span class="pre">cassandra</span></code> OS user.</p> |
| </div> |
| <div class="section" id="installing-the-binary-tarball"> |
| <h2>Installing the binary tarball<a class="headerlink" href="#installing-the-binary-tarball" title="Permalink to this headline">¶</a></h2> |
| <ol class="arabic simple"> |
| <li>Verify the version of Java installed. For example:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ java -version |
| openjdk version "1.8.0_222" |
| OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10) |
| OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode) |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="2"> |
| <li>Download the binary tarball from one of the mirrors on the <a class="reference external" href="http://cassandra.apache.org/download/">Apache Cassandra Download</a> |
| site. For example, to download 4.0:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ curl -OL http://apache.mirror.digitalpacific.com.au/cassandra/4.0.0/apache-cassandra-4.0.0-bin.tar.gz |
| </pre></div> |
| </div> |
| <p>NOTE: The mirrors only host the latest versions of each major supported release. To download an earlier |
| version of Cassandra, visit the <a class="reference external" href="http://archive.apache.org/dist/cassandra/">Apache Archives</a>.</p> |
| <ol class="arabic simple" start="3"> |
| <li>OPTIONAL: Verify the integrity of the downloaded tarball using one of the methods <a class="reference external" href="https://www.apache.org/dyn/closer.cgi#verify">here</a>. |
| For example, to verify the hash of the downloaded file using GPG:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ gpg --print-md SHA256 apache-cassandra-4.0.0-bin.tar.gz |
| apache-cassandra-4.0.0-bin.tar.gz: 28757DDE 589F7041 0F9A6A95 C39EE7E6 |
| CDE63440 E2B06B91 AE6B2006 14FA364D |
| </pre></div> |
| </div> |
| <p>Compare the signature with the SHA256 file from the Downloads site:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ curl -L https://downloads.apache.org/cassandra/4.0.0/apache-cassandra-4.0.0-bin.tar.gz.sha256 |
| 28757dde589f70410f9a6a95c39ee7e6cde63440e2b06b91ae6b200614fa364d |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="4"> |
| <li>Unpack the tarball:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ tar xzvf apache-cassandra-4.0.0-bin.tar.gz |
| </pre></div> |
| </div> |
| <p>The files will be extracted to the <code class="docutils literal notranslate"><span class="pre">apache-cassandra-4.0.0/</span></code> directory. This is the tarball installation |
| location.</p> |
| <ol class="arabic simple" start="5"> |
| <li>Located in the tarball installation location are the directories for the scripts, binaries, utilities, configuration, data and log files:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span><tarball_installation>/ |
| bin/ |
| conf/ |
| data/ |
| doc/ |
| interface/ |
| javadoc/ |
| lib/ |
| logs/ |
| pylib/ |
| tools/ |
| </pre></div> |
| </div> |
| <p>For information on how to configure your installation, see |
| <a class="reference external" href="http://cassandra.apache.org/doc/latest/getting_started/configuring.html">Configuring Cassandra</a>.</p> |
| <ol class="arabic simple" start="6"> |
| <li>Start Cassandra:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ cd apache-cassandra-4.0.0/ |
| $ bin/cassandra |
| </pre></div> |
| </div> |
| <p>NOTE: This will run Cassandra as the authenticated Linux user.</p> |
| <p>You can monitor the progress of the startup with:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ tail -f logs/system.log |
| </pre></div> |
| </div> |
| <p>Cassandra is ready when you see an entry like this in the <code class="docutils literal notranslate"><span class="pre">system.log</span></code>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)... |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="7"> |
| <li>Check the status of Cassandra:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ bin/nodetool status |
| </pre></div> |
| </div> |
| <p>The status column in the output should report UN which stands for “Up/Normal”.</p> |
| <p>Alternatively, connect to the database with:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ bin/cqlsh |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="installing-the-debian-packages"> |
| <h2>Installing the Debian packages<a class="headerlink" href="#installing-the-debian-packages" title="Permalink to this headline">¶</a></h2> |
| <ol class="arabic simple"> |
| <li>Verify the version of Java installed. For example:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ java -version |
| openjdk version "1.8.0_222" |
| OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10) |
| OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode) |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="2"> |
| <li>Add the Apache repository of Cassandra to the file <code class="docutils literal notranslate"><span class="pre">cassandra.sources.list</span></code>. The latest major version |
| is 4.0 and the corresponding distribution name is <code class="docutils literal notranslate"><span class="pre">40x</span></code> (with an “x” as the suffix). |
| For older releases use <code class="docutils literal notranslate"><span class="pre">311x</span></code> for C* 3.11 series, <code class="docutils literal notranslate"><span class="pre">30x</span></code> for 3.0, <code class="docutils literal notranslate"><span class="pre">22x</span></code> for 2.2 and <code class="docutils literal notranslate"><span class="pre">21x</span></code> for 2.1. |
| For example, to add the repository for version 4.0 (<code class="docutils literal notranslate"><span class="pre">40x</span></code>):</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ echo "deb http://www.apache.org/dist/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list |
| deb http://www.apache.org/dist/cassandra/debian 40x main |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="3"> |
| <li>Add the Apache Cassandra repository keys to the list of trusted keys on the server:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add - |
| % Total % Received % Xferd Average Speed Time Time Time Current |
| Dload Upload Total Spent Left Speed |
| 100 266k 100 266k 0 0 320k 0 --:--:-- --:--:-- --:--:-- 320k |
| OK |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="4"> |
| <li>Update the package index from sources:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo apt-get update |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="5"> |
| <li>Install Cassandra with APT:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo apt-get install cassandra |
| </pre></div> |
| </div> |
| <p>NOTE: A new Linux user <code class="docutils literal notranslate"><span class="pre">cassandra</span></code> will get created as part of the installation. The Cassandra service |
| will also be run as this user.</p> |
| <ol class="arabic simple" start="6"> |
| <li>The Cassandra service gets started automatically after installation. Monitor the progress of |
| the startup with:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ tail -f /var/log/cassandra/system.log |
| </pre></div> |
| </div> |
| <p>Cassandra is ready when you see an entry like this in the <code class="docutils literal notranslate"><span class="pre">system.log</span></code>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)... |
| </pre></div> |
| </div> |
| <p>NOTE: For information on how to configure your installation, see |
| <a class="reference external" href="http://cassandra.apache.org/doc/latest/getting_started/configuring.html">Configuring Cassandra</a>.</p> |
| <ol class="arabic simple" start="7"> |
| <li>Check the status of Cassandra:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ nodetool status |
| </pre></div> |
| </div> |
| <p>The status column in the output should report <code class="docutils literal notranslate"><span class="pre">UN</span></code> which stands for “Up/Normal”.</p> |
| <p>Alternatively, connect to the database with:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ cqlsh |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="installing-the-rpm-packages"> |
| <h2>Installing the RPM packages<a class="headerlink" href="#installing-the-rpm-packages" title="Permalink to this headline">¶</a></h2> |
| <ol class="arabic simple"> |
| <li>Verify the version of Java installed. For example:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ java -version |
| openjdk version "1.8.0_222" |
| OpenJDK Runtime Environment (build 1.8.0_232-b09) |
| OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode) |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="2"> |
| <li>Add the Apache repository of Cassandra to the file <code class="docutils literal notranslate"><span class="pre">/etc/yum.repos.d/cassandra.repo</span></code> (as the <code class="docutils literal notranslate"><span class="pre">root</span></code> |
| user). The latest major version is 4.0 and the corresponding distribution name is <code class="docutils literal notranslate"><span class="pre">40x</span></code> (with an “x” as the suffix). |
| For older releases use <code class="docutils literal notranslate"><span class="pre">311x</span></code> for C* 3.11 series, <code class="docutils literal notranslate"><span class="pre">30x</span></code> for 3.0, <code class="docutils literal notranslate"><span class="pre">22x</span></code> for 2.2 and <code class="docutils literal notranslate"><span class="pre">21x</span></code> for 2.1. |
| For example, to add the repository for version 4.0 (<code class="docutils literal notranslate"><span class="pre">40x</span></code>):</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>[cassandra] |
| name=Apache Cassandra |
| baseurl=https://downloads.apache.org/cassandra/redhat/40x/ |
| gpgcheck=1 |
| repo_gpgcheck=1 |
| gpgkey=https://downloads.apache.org/cassandra/KEYS |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="3"> |
| <li>Update the package index from sources:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo yum update |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="4"> |
| <li>Install Cassandra with YUM:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo yum install cassandra |
| </pre></div> |
| </div> |
| <p>NOTE: A new Linux user <code class="docutils literal notranslate"><span class="pre">cassandra</span></code> will get created as part of the installation. The Cassandra service |
| will also be run as this user.</p> |
| <ol class="arabic simple" start="5"> |
| <li>Start the Cassandra service:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ sudo service cassandra start |
| </pre></div> |
| </div> |
| <ol class="arabic simple" start="6"> |
| <li>Monitor the progress of the startup with:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ tail -f /var/log/cassandra/system.log |
| </pre></div> |
| </div> |
| <p>Cassandra is ready when you see an entry like this in the <code class="docutils literal notranslate"><span class="pre">system.log</span></code>:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)... |
| </pre></div> |
| </div> |
| <p>NOTE: For information on how to configure your installation, see |
| <a class="reference external" href="http://cassandra.apache.org/doc/latest/getting_started/configuring.html">Configuring Cassandra</a>.</p> |
| <ol class="arabic simple" start="7"> |
| <li>Check the status of Cassandra:</li> |
| </ol> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ nodetool status |
| </pre></div> |
| </div> |
| <p>The status column in the output should report <code class="docutils literal notranslate"><span class="pre">UN</span></code> which stands for “Up/Normal”.</p> |
| <p>Alternatively, connect to the database with:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ cqlsh |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="further-installation-info"> |
| <h2>Further installation info<a class="headerlink" href="#further-installation-info" title="Permalink to this headline">¶</a></h2> |
| <p>For help with installation issues, see the <a class="reference external" href="http://cassandra.apache.org/doc/latest/troubleshooting/index.html">Troubleshooting</a> section.</p> |
| </div> |
| </div> |
| |
| |
| |
| |
| <div class="doc-prev-next-links" role="navigation" aria-label="footer navigation"> |
| |
| <a href="configuring.html" class="btn btn-default pull-right " role="button" title="Configuring Cassandra" accesskey="n">Next <span class="glyphicon glyphicon-circle-arrow-right" aria-hidden="true"></span></a> |
| |
| |
| <a href="index.html" class="btn btn-default" role="button" title="Getting Started" accesskey="p"><span class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></span> Previous</a> |
| |
| </div> |
| |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |