A list of all supported request consistencies

See Also:
[ :any, :one, :two, :three, :quorum, :all, :local_quorum,
:each_quorum, :serial, :local_serial, :local_one ].freeze


A list of all supported serial consistencies

See Also:
[:serial, :local_serial].freeze


A list of all possible write types that a Errors::WriteTimeoutError can have.

See Also:
[:simple, :batch, :unlogged_batch, :counter, :batch_log].freeze






(options = {})

Creates a Cluster instance.

Connecting to localhost
cluster = Cassandra.cluster
Configuring Cluster
cluster = Cassandra.cluster(
            username: username,
            password: password,
            hosts: ['', '', '']
Name Type Details
options Hash (defaults to: {}) a customizable set of options
Keys for options:
Key Type Details
:hosts Array<String, IPAddr> default: [''] a list of initial addresses. Note that the entire list of cluster members will be discovered automatically once a connection to any hosts from the original list is successful.
:port Integer default: 9042 cassandra native protocol port.
:datacenter String default: nil name of current datacenter. First datacenter found will be assumed current by default. Note that you can skip this option if you specify only hosts from the local datacenter in :hosts option.
:shuffle_replicas Boolean default: true whether replicas list found by the default Token-Aware Load Balancing Policy should be shuffled. See Token-Aware Load Balancing Policy.
:connect_timeout Numeric default: 10 connection timeout in seconds. Setting value to nil will reset it to 5 seconds.
:timeout Numeric default: 10 request execution timeout in seconds. Setting value to nil will remove request timeout.
:heartbeat_interval Numeric default: 30 how often should a heartbeat be sent to determine if a connection is alive. Several things to note about this option. Only one heartbeat request will ever be outstanding on a given connection. Each heatbeat will be sent in at least :heartbeat_interval seconds after the last request has been sent on a given connection. Setting value to nil will remove connection timeout.
:idle_timeout Numeric default: 60 period of inactivity after which a connection is considered dead. Note that this value should be at least a few times larger than :heartbeat_interval. Setting value to nil will remove automatic connection termination.
:username String default: none username to use for authentication to cassandra. Note that you must also specify :password.
:password String default: none password to use for authentication to cassandra. Note that you must also specify :username.
:ssl (Boolean or OpenSSL::SSL::SSLContext) default: false enable default ssl authentication if true (not recommended). Also accepts an initialized OpenSSL::SSL::SSLContext. Note that this option should be ignored if :server_cert, :client_cert, :private_key or :passphrase are given.
:server_cert String default: none path to server certificate or certificate authority file.
:client_cert String default: none path to client certificate file. Note that this option is only required when encryption is configured to require client authentication.
:private_key String default: none path to client private key. Note that this option is only required when encryption is configured to require client authentication.
:passphrase String default: none passphrase for private key.
:compression Symbol default: none compression to use. Must be either :snappy or :lz4. Also note, that in order for compression to work, you must install ‘snappy’ or ‘lz4-ruby’ gems.
:load_balancing_policy LoadBalancing::Policy default: token aware data center aware round robin.
:address_resolution Symbol default: :none a pre-configured address resolver to use. Must be one of :none or :ec2_multi_region.
:synchronize_schema Boolean default: true whether the driver should automatically keep schema metadata synchronized. When enabled, the driver updates schema metadata after receiving schema change notifications from Cassandra. Setting this setting to false disables automatic schema updates. Schema metadata is used by the driver to determine cluster partitioners as well as to find partition keys and replicas of prepared statements, this information makes token aware load balancing possible. One can still refresh schema manually.
:schema_refresh_delay Numeric default: 1 the driver will wait for :schema_refresh_delay before fetching metadata after receiving a schema change event. This timer is restarted every time a new schema change event is received. Finally, when the timer expires or a maximum wait time of :schema_refresh_timeout has been reached, a schema refresh attempt will be made and the timeout is reset.
:schema_refresh_timeout Numeric default: 10 the maximum delay before automatically refreshing schema. Such delay can occur whenever multiple schema change events are continuously arriving within :schema_refresh_delay interval.
:reconnection_policy Reconnection::Policy default: Exponential. Note that the default policy is configured with (0.5, 30, 2).
:retry_policy Retry::Policy default: Default Retry Policy.
:logger Logger default: none logger. a Logger instance from the standard library or any object responding to standard log methods (#debug, #info, #warn, #error and #fatal).
:listeners Enumerable<Listener> default: none initial listeners. A list of initial cluster state listeners. Note that a :load_balancing policy is automatically registered with the cluster.
:consistency Symbol default: :one default consistency to use for all requests. Must be one of CONSISTENCIES.
:trace Boolean default: false whether or not to trace all requests by default.
:page_size Integer default: 10000 default page size for all select queries. Set this value to nil to disable paging.
:credentials Hash{String => String} default: none a hash of credentials - to be used with credentials authentication in cassandra 1.2. Note that if you specified :username and :password options, those credentials are configured automatically.
:auth_provider Auth::Provider default: none a custom auth provider to be used with SASL authentication in cassandra 2.0. Note that if you have specified :username and :password, then a Password Provider will be used automatically.
:compressor Compression::Compressor default: none a custom compressor. Note that if you have specified :compression, an appropriate compressor will be provided automatically.
:address_resolution_policy AddressResolution::Policy default: No Resolution Policy a custom address resolution policy. Note that if you have specified :address_resolution, an appropriate address resolution policy will be provided automatically.
:futures_factory Object<#all, #error, #value, #promise> default: Future a futures factory to assist with integration into existing futures library. Note that promises returned by this object must conform to Promise api, which is not yet public. Things may change, use at your own risk.
Type Details
Cluster a cluster instance


(options = {})

Creates a Cluster instance.

Type Details
Future<Cluster> a future resolving to the cluster instance.
See Also: