Cassandra\Cluster builder allows fluent configuration of the cluster instance.
See Also:
Methods
Configures default consistency for all requests.
Parameters:
Name
Type
Details
$consistency
int
A consistency level, must be one of Cassandra::CONSISTENCY_* values
Returns:
Configures default page size for all results. Cassandra\Set to null to disable paging altogether.
Parameters:
Name
Type
Details
$pageSize
int
default page size
Returns:
Configures default timeout for future resolution in blocking operations Cassandra\Set to null to disable (default).
Parameters:
Name
Type
Details
$timeout
float
Timeout value in seconds, can be fractional
Returns:
Configures the initial endpoints. Note that the driver will automatically discover and connect to the rest of the cluster.
Parameters:
Name
Type
Details
$host
string
one or more ip addresses or hostnames
Returns:
Specify a different port to be used when connecting to the cluster.
Parameters:
Name
Type
Details
$port
int
a number between 1 and 65535
Throws:
Returns:
Configures this cluster to use a round robin load balancing policy.
Returns:
Cluster\Builder withDatacenterAwareRoundRobinLoadBalancingPolicy
( string $localDatacenter,
int $hostPerRemoteDatacenter,
bool $useRemoteDatacenterForLocalConsistencies
)
Configures this cluster to use a datacenter aware round robin load balancing policy.
Parameters:
Name
Type
Details
$localDatacenter
string
Name of the local datacenter
$hostPerRemoteDatacenter
int
Maximum number of hosts to try in remote datacenters
$useRemoteDatacenterForLocalConsistencies
bool
Allow using hosts from remote datacenters to execute statements with local consistencies
Returns:
Enable token aware routing.
Parameters:
Name
Type
Details
$enabled
bool
Whether to enable token aware routing (optional)
Returns:
Configures cassandra authentication.
Parameters:
Name
Type
Details
$username
string
Username
$password
string
Password
Returns:
Timeout used for establishing TCP connections.
Parameters:
Name
Type
Details
$timeout
float
Timeout value in seconds, can be fractional
Returns:
Timeout used for waiting for a response from a node.
Parameters:
Name
Type
Details
$timeout
float
Timeout value in seconds, can be fractional
Returns:
Enable persistent sessions and clusters.
Parameters:
Name
Type
Details
$enabled
bool
whether to enable persistent sessions and clusters (optional)
Returns:
Force the driver to use a specific binary protocol version.
Apache Cassandra 1.2+ supports protocol version 1
Apache Cassandra 2.0+ supports protocol version 2
Parameters:
Name
Type
Details
$version
int
the actual protocol version, only 1 or 2 are supported
Returns:
Total number of IO threads to use for handling the requests.
Note: number of io threads * core connections per host <= total number of connections <= number of io threads * max connections per host
Parameters:
Name
Type
Details
$count
int
total number of threads.
Returns:
Cassandra\Set the size of connection pools used by the driver. Pools are fixed when only $core is given, when a $max is specified as well, additional connections will be created automatically based on current load until the maximum number of connection has been reached. When request load goes down, extra connections are automatically cleaned up until only the core number of connections is left.
Parameters:
Name
Type
Details
$core
int
minimum connections to keep open to any given host
$max
int
maximum connections to keep open to any given host
Returns:
Specify interval in seconds that the driver should wait before attempting to re-establish a closed connection.
Parameters:
Name
Type
Details
$interval
float
interval in seconds
Returns:
Enables/disables latency-aware routing.
Parameters:
Name
Type
Details
$enabled
bool
whether to actually enable or disable the routing.
Returns:
Disables nagle algorithm for lower latency.
Parameters:
Name
Type
Details
$enabled
bool
whether to actually enable or disable nodelay.
Returns:
Enables/disables TCP keepalive.
Parameters:
Name
Type
Details
$delay
float
the period of inactivity in seconds, after which the keepalive probe should be sent over the connection. If set to null, disables keepalive probing.
Returns: