blob: 8ab9d8bb14182507b94649320e45dd7881c2447c [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>generatetokens &mdash; Apache Cassandra Documentation v4.0-rc2</title>
<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" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Nodetool" href="nodetool/nodetool.html" />
<link rel="prev" title="cqlsh: the CQL shell" href="cqlsh.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"><a class="reference internal" href="../getting_started/index.html">Getting Started</a></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 current"><a class="reference internal" href="index.html">Cassandra Tools</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="cqlsh.html">cqlsh: the CQL shell</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">generatetokens</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l3"><a class="reference internal" href="#example-output">Example Output</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="nodetool/nodetool.html">Nodetool</a></li>
<li class="toctree-l2"><a class="reference internal" href="nodetool/nodetool.html#usage">Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="sstable/index.html">SSTable Tools</a></li>
<li class="toctree-l2"><a class="reference internal" href="cassandra_stress.html">Cassandra Stress</a></li>
</ul>
</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" class="icon icon-home"></a> &raquo;</li>
<li><a href="index.html">Cassandra Tools</a> &raquo;</li>
<li>generatetokens</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/tools/generatetokens.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="generatetokens">
<h1>generatetokens<a class="headerlink" href="#generatetokens" title="Permalink to this headline"></a></h1>
<p>Pre-generates tokens for a datacenter with the given number of nodes using the token allocation algorithm. Useful in edge-cases when generated tokens needs to be known in advance of bootstrapping nodes. In nearly all cases it is best to just let the bootstrapping nodes automatically generate their own tokens.
ref: <a class="reference external" href="https://issues.apache.org/jira/browse/CASSANDRA-16205">https://issues.apache.org/jira/browse/CASSANDRA-16205</a></p>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>generatetokens -n NODES -t TOKENS –rf REPLICATION_FACTOR [–partitioner PARTITIONER] [–racks RACK_NODE_COUNTS]</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 15%" />
<col style="width: 85%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>-n,–nodes &lt;arg&gt;</p></td>
<td><p>Number of nodes.</p></td>
</tr>
<tr class="row-even"><td><p>-t,–tokens &lt;arg&gt;</p></td>
<td><p>Number of tokens/vnodes per node.</p></td>
</tr>
<tr class="row-odd"><td><p>–rf &lt;arg&gt;</p></td>
<td><p>Replication factor.</p></td>
</tr>
<tr class="row-even"><td><p>-p,–partitioner &lt;arg&gt;</p></td>
<td><p>Database partitioner, either Murmur3Partitioner or RandomPartitioner.</p></td>
</tr>
<tr class="row-odd"><td><p>–racks &lt;arg&gt;</p></td>
<td><p>Number of nodes per rack, separated by commas. Must add up to the total node count. For example, ‘generatetokens -n 30 -t 8 –rf 3 –racks 10,10,10’ will generate tokens for three racks of 10 nodes each.</p></td>
</tr>
</tbody>
</table>
<p>This command, if used, is expected to be run before the Cassandra node is first started. The output from the command is used to configure the nodes <cite>num_tokens</cite> setting in the <cite>cassandra.yaml</cite></p>
</div>
<div class="section" id="example-output">
<h2>Example Output<a class="headerlink" href="#example-output" title="Permalink to this headline"></a></h2>
<p>Example usage and output is</p>
<blockquote>
<div><p>$ tools/bin/generatetokens -n 9 -t 4 –rf 3 –racks 3,3,3</p>
<p>Generating tokens for 9 nodes with 4 vnodes each for replication factor 3 and partitioner Murmur3Partitioner
Node 0 rack 0: [-6270077235120413733, -1459727275878514299, 2887564907718879562, 5778609289102954400]
Node 1 rack 1: [-8780789453057732897, -3279530982831298765, 1242905755717369197, 8125606440590916903]
Node 2 rack 2: [-7240625170832344686, -4453155190605073029, 74749827226930055, 4615117940688406403]
Node 3 rack 0: [-5361616212862743381, -2369629129354906532, 2065235331718124379, 6952107864846935651]
Node 4 rack 1: [-8010707311945038792, -692488724325792122, 3751341424203642982, 7538857152718926277]
Node 5 rack 2: [-7625666241388691739, -3866343086718185897, 5196863614895680401, 8895780530621367810]
Node 6 rack 0: [-5815846723991578557, -1076108000102153211, 1654070543717746788, 8510693485606142356]
Node 7 rack 1: [-2824580056093102649, 658827791472149626, 3319453165961261272, 6365358576974945025]
Node 8 rack 2: [-4159749138661629463, -1914678202616710416, 4905990777792043402, 6658733220910940338]</p>
</div></blockquote>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="nodetool/nodetool.html" class="btn btn-neutral float-right" title="Nodetool" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="cqlsh.html" class="btn btn-neutral float-left" title="cqlsh: the CQL shell" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2020, The Apache Cassandra team.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/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>