blob: 326cd65e0f4c9a5a29458e41bd55dc4200b1eabc [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Installing Cassandra &mdash; Apache Cassandra Documentation v4.0-rc2</title>
<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/extra.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Configuring Cassandra" href="configuring.html" />
<link rel="prev" title="Getting Started" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> Apache Cassandra
</a>
<div class="version">
4.0-rc2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<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>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Apache Cassandra</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> &raquo;</li>
<li><a href="index.html">Getting Started</a> &raquo;</li>
<li>Installing Cassandra</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/getting_started/installing.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<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><p>Ubuntu, most notably LTS releases 16.04 to 18.04</p></li>
<li><p>CentOS &amp; RedHat Enterprise Linux (RHEL) including 6.6 to 7.7</p></li>
<li><p>Amazon Linux AMIs including 2016.09 through to Linux 2</p></li>
<li><p>Debian versions 8 &amp; 9</p></li>
<li><p>SUSE Enterprise Linux 12</p></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><p>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>.</p></li>
<li><p><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>.</p></li>
<li><p>For using cqlsh, the latest version of <a class="reference external" href="https://www.python.org/downloads/">Python 3.6+</a> or Python 2.7 (support deprecated). 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>.</p></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><p>Verify the version of Java installed. For example:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ java -version
openjdk version &quot;1.8.0_222&quot;
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><p>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:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ curl -OL http://apache.mirror.digitalpacific.com.au/cassandra/4.0-beta1/apache-cassandra-4.0-beta1-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><p>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:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ gpg --print-md SHA256 apache-cassandra-4.0-beta1-bin.tar.gz
apache-cassandra-4.0-beta1-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-beta1/apache-cassandra-4.0-beta1-bin.tar.gz.sha256
28757dde589f70410f9a6a95c39ee7e6cde63440e2b06b91ae6b200614fa364d
</pre></div>
</div>
<ol class="arabic simple" start="4">
<li><p>Unpack the tarball:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ tar xzvf apache-cassandra-4.0-beta1-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-beta1/</span></code> directory. This is the tarball installation
location.</p>
<ol class="arabic simple" start="5">
<li><p>Located in the tarball installation location are the directories for the scripts, binaries, utilities, configuration, data and log files:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&lt;tarball_installation&gt;/
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><p>Start Cassandra:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ cd apache-cassandra-4.0-beta1/
$ 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><p>Check the status of Cassandra:</p></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><p>Verify the version of Java installed. For example:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ java -version
openjdk version &quot;1.8.0_222&quot;
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><p>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>):</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ echo &quot;deb http://downloads.apache.org/cassandra/debian 40x main&quot; | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
deb http://downloads.apache.org/cassandra/debian 40x main
</pre></div>
</div>
<ol class="arabic simple" start="3">
<li><p>Add the Apache Cassandra repository keys to the list of trusted keys on the server:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ curl https://downloads.apache.org/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><p>Update the package index from sources:</p></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><p>Install Cassandra with APT:</p></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><p>The Cassandra service gets started automatically after installation. Monitor the progress of
the startup with:</p></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><p>Check the status of Cassandra:</p></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><p>Verify the version of Java installed. For example:</p></li>
</ol>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ java -version
openjdk version &quot;1.8.0_222&quot;
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><p>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>):</p></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><p>Update the package index from sources:</p></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><p>Install Cassandra with YUM:</p></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><p>Start the Cassandra service:</p></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><p>Monitor the progress of the startup with:</p></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><p>Check the status of Cassandra:</p></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>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="configuring.html" class="btn btn-neutral float-right" title="Configuring Cassandra" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="index.html" class="btn btn-neutral float-left" title="Getting Started" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2020, The Apache Cassandra team
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>