You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6226e74
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: api/cassandra/cluster.html
+73-33Lines changed: 73 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -103,9 +103,26 @@ <h3>Quick search</h3>
103
103
</div>
104
104
<p><codeclass="docutils literal"><spanclass="pre">Cluster</span></code> and <codeclass="docutils literal"><spanclass="pre">Session</span></code> also provide context management functions
105
105
which implicitly handle shutdown when leaving scope.</p>
106
-
<p>Any of the mutable Cluster attributes may be set as keyword arguments
107
-
to the constructor.</p>
106
+
<p><codeclass="docutils literal"><spanclass="pre">executor_threads</span></code> defines the number of threads in a pool for handling asynchronous tasks such as
107
+
extablishing connection pools or refreshing metadata.</p>
108
108
<p>Any of the mutable Cluster attributes may be set as keyword arguments to the constructor.</p>
109
+
<dlclass="attribute">
110
+
<dtid="cassandra.cluster.Cluster.contact_points">
111
+
<codeclass="descname">contact_points</code><emclass="property"> = ['127.0.0.1']</em><aclass="headerlink" href="#cassandra.cluster.Cluster.contact_points" title="Permalink to this definition">¶</a></dt>
112
+
<dd><p>The list of contact points to try connecting for cluster discovery.</p>
113
+
<p>Defaults to loopback interface.</p>
114
+
<p>Note: When using <codeclass="xref py py-class docutils literal"><spanclass="pre">DCAwareLoadBalancingPolicy</span></code> with no explicit
115
+
local_dc set (as is the default), the DC is chosen from an arbitrary
116
+
host in contact_points. In this case, contact_points should contain
117
+
only nodes from a single, local DC.</p>
118
+
</dd></dl>
119
+
120
+
<dlclass="attribute">
121
+
<dtid="cassandra.cluster.Cluster.port">
122
+
<codeclass="descname">port</code><emclass="property"> = 9042</em><aclass="headerlink" href="#cassandra.cluster.Cluster.port" title="Permalink to this definition">¶</a></dt>
123
+
<dd><p>The server-side port to open connections to. Defaults to 9042.</p>
124
+
</dd></dl>
125
+
109
126
<dlclass="attribute">
110
127
<dtid="cassandra.cluster.Cluster.cql_version">
111
128
<codeclass="descname">cql_version</code><emclass="property"> = None</em><aclass="headerlink" href="#cassandra.cluster.Cluster.cql_version" title="Permalink to this definition">¶</a></dt>
@@ -161,12 +178,6 @@ <h3>Quick search</h3>
161
178
</table>
162
179
</dd></dl>
163
180
164
-
<dlclass="attribute">
165
-
<dtid="cassandra.cluster.Cluster.port">
166
-
<codeclass="descname">port</code><emclass="property"> = 9042</em><aclass="headerlink" href="#cassandra.cluster.Cluster.port" title="Permalink to this definition">¶</a></dt>
167
-
<dd><p>The server-side port to open connections to. Defaults to 9042.</p>
168
-
</dd></dl>
169
-
170
181
<dlclass="attribute">
171
182
<dtid="cassandra.cluster.Cluster.compression">
172
183
<codeclass="descname">compression</code><emclass="property"> = True</em><aclass="headerlink" href="#cassandra.cluster.Cluster.compression" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">connection_class</code><emclass="property"> = <class 'cassandra.io.libevreactor.LibevConnection'></em><aclass="headerlink" href="#cassandra.cluster.Cluster.connection_class" title="Permalink to this definition">¶</a></dt>
243
-
<dd><p>This determines what event loop system will be used for managing
244
-
I/O with Cassandra. These are the current options:</p>
<p>By default, <codeclass="docutils literal"><spanclass="pre">AsyncoreConnection</span></code> will be used, which uses
253
-
the <codeclass="docutils literal"><spanclass="pre">asyncore</span></code> module in the Python standard library.</p>
254
-
<p>If <codeclass="docutils literal"><spanclass="pre">libev</span></code> is installed, <codeclass="docutils literal"><spanclass="pre">LibevConnection</span></code> will be used instead.</p>
255
-
<p>If <codeclass="docutils literal"><spanclass="pre">gevent</span></code> or <codeclass="docutils literal"><spanclass="pre">eventlet</span></code> monkey-patching is detected, the corresponding
<codeclass="descname">metrics_enabled</code><emclass="property"> = False</em><aclass="headerlink" href="#cassandra.cluster.Cluster.metrics_enabled" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">metadata</code><emclass="property"> = None</em><aclass="headerlink" href="#cassandra.cluster.Cluster.metadata" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">ssl_options</code><emclass="property"> = None</em><aclass="headerlink" href="#cassandra.cluster.Cluster.ssl_options" title="Permalink to this definition">¶</a></dt>
@@ -314,6 +300,31 @@ <h3>Quick search</h3>
314
300
If set <= 0, the driver will bypass schema agreement waits altogether.</p>
315
301
</dd></dl>
316
302
303
+
<dlclass="attribute">
304
+
<dtid="cassandra.cluster.Cluster.metadata">
305
+
<codeclass="descname">metadata</code><emclass="property"> = None</em><aclass="headerlink" href="#cassandra.cluster.Cluster.metadata" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">connection_class</code><emclass="property"> = <class 'cassandra.io.libevreactor.LibevConnection'></em><aclass="headerlink" href="#cassandra.cluster.Cluster.connection_class" title="Permalink to this definition">¶</a></dt>
312
+
<dd><p>This determines what event loop system will be used for managing
313
+
I/O with Cassandra. These are the current options:</p>
<p>By default, <codeclass="docutils literal"><spanclass="pre">AsyncoreConnection</span></code> will be used, which uses
322
+
the <codeclass="docutils literal"><spanclass="pre">asyncore</span></code> module in the Python standard library.</p>
323
+
<p>If <codeclass="docutils literal"><spanclass="pre">libev</span></code> is installed, <codeclass="docutils literal"><spanclass="pre">LibevConnection</span></code> will be used instead.</p>
324
+
<p>If <codeclass="docutils literal"><spanclass="pre">gevent</span></code> or <codeclass="docutils literal"><spanclass="pre">eventlet</span></code> monkey-patching is detected, the corresponding
<codeclass="descname">control_connection_timeout</code><emclass="property"> = 2.0</em><aclass="headerlink" href="#cassandra.cluster.Cluster.control_connection_timeout" title="Permalink to this definition">¶</a></dt>
@@ -358,6 +369,35 @@ <h3>Quick search</h3>
358
369
<p>See <aclass="reference internal" href="#cassandra.cluster.Cluster.schema_event_refresh_window" title="cassandra.cluster.Cluster.schema_event_refresh_window"><codeclass="xref py py-attr docutils literal"><spanclass="pre">schema_event_refresh_window</span></code></a> for discussion of rationale</p>
<codeclass="descname">status_event_refresh_window</code><emclass="property"> = 2</em><aclass="headerlink" href="#cassandra.cluster.Cluster.status_event_refresh_window" title="Permalink to this definition">¶</a></dt>
375
+
<dd><p>Window, in seconds, within which the driver will start the reconnect after
376
+
receiving a status_change event.</p>
377
+
<p>Setting this to zero will connect immediately.</p>
378
+
<p>This is primarily used to avoid ‘thundering herd’ in deployments with large fanout from cluster to clients.
379
+
When nodes come up, clients attempt to reprepare prepared statements (depending on <aclass="reference internal" href="#cassandra.cluster.Cluster.reprepare_on_up" title="cassandra.cluster.Cluster.reprepare_on_up"><codeclass="xref py py-attr docutils literal"><spanclass="pre">reprepare_on_up</span></code></a>), and
380
+
establish connection pools. This can cause a rush of connections and queries if not mitigated with this factor.</p>
<codeclass="descname">prepare_on_all_hosts</code><emclass="property"> = True</em><aclass="headerlink" href="#cassandra.cluster.Cluster.prepare_on_all_hosts" title="Permalink to this definition">¶</a></dt>
386
+
<dd><p>Specifies whether statements should be prepared on all hosts, or just one.</p>
387
+
<p>This can reasonably be disabled on long-running applications with numerous clients preparing statements on startup,
388
+
where a randomized initial condition of the load balancing policy can be expected to distribute prepares from
<codeclass="descname">reprepare_on_up</code><emclass="property"> = True</em><aclass="headerlink" href="#cassandra.cluster.Cluster.reprepare_on_up" title="Permalink to this definition">¶</a></dt>
395
+
<dd><p>Specifies whether all known prepared statements should be prepared on a node when it comes up.</p>
396
+
<p>May be used to avoid overwhelming a node on return, or if it is supposed that the node was only marked down due to
397
+
network. If statements are not reprepared, they are prepared on the first execution, causing
398
+
an extra roundtrip for one or more client requests.</p>
<codeclass="descname">connect_timeout</code><emclass="property"> = 5</em><aclass="headerlink" href="#cassandra.cluster.Cluster.connect_timeout" title="Permalink to this definition">¶</a></dt>
<dt><ahref="api/cassandra/cqlengine/management.html#cassandra.cqlengine.management.sync_table">sync_table() (in module cassandra.cqlengine.management)</a>
0 commit comments