Class Builder
This class follows the Builder design pattern and is the preferred method for creating Basho\Riak\Node objects for
connecting to your Riak node cluster.
use Basho\Riak\Node;
$nodes = (new Node\Builder)
->buildLocalhost([10018, 10028, 10038, 10048, 10058]);
use Basho\Riak\Node;
$nodes = (new Node\Builder)
->onPort(8098)
->usingPasswordAuthentication('riakuser', 'riakpassword')
->withCertificateAuthorityFile(getcwd() . '/path/to/cacert.pem')
->buildCluster(['riak1.company.int','riak2.company.int','riak3.company.int']);
use Basho\Riak\Node;
$node = (new Node\Builder)
->atHost('riak.company.int')
->onPort(8098)
->usingCertificateAuthentication(getcwd() . '/path/to/client.crt')
->withCertificateAuthorityFile(getcwd() . '/path/to/cacert.pem')
->build();
use Basho\Riak\Node;
$node = (new Node\Builder)
->atHost('riak.company.int')
->onPort(8098)
->usingPamAuthentication('riakuser')
->withCertificateAuthorityFile(getcwd() . '/path/to/cacert.pem')
->build();
Methods summary
public
|
|
public
|
#
usingTrustAuthentication( string $user = '' )
usingTrustAuthentication
Build nodes with trust authentication
User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL
is required to communicate with your Riak nodes.
Parameters
Returns
$this
|
public
|
#
usingPasswordAuthentication( $user, $pass = '' )
usingPasswordAuthentication
usingPasswordAuthentication
Build nodes with password authentication
User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL
is required to communicate with your Riak nodes.
Parameters
Returns
$this
|
public
|
#
usingCertificateAuthentication( $certificate, string $password = '' )
usingCertificateAuthentication
usingCertificateAuthentication
Build nodes with certificate authentication
User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL
is required to communicate with your Riak nodes.
CURRENTLY NOT SUPPORTED OVER THE RIAK HTTP API
Parameters
Returns
$this
Throws
|
public
|
#
usingPamAuthentication( $user )
usingPamAuthentication
Build nodes with PAM authentication
User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL
is required to communicate with your Riak nodes.
Parameters
Returns
$this
|
public
|
#
withCertificateAuthorityFile( $ca_file )
withCertificateAuthorityDirectory
withCertificateAuthorityDirectory
Path to CA file. A Certificate Authority file is required for any secure connections to Riak
Parameters
Returns
$this
|
public
|
#
withCertificateAuthorityDirectory( $ca_directory )
withCertificateAuthorityDirectory
withCertificateAuthorityDirectory
Directory where the CA file can be found. A Certificate Authority file is required for any secure connections to
Riak
Parameters
Returns
$this
|
public
|
|
public
|
#
withConnectionTimeout( $timeout )
Client side connection timeout for requests
Client side connection timeout for requests
Parameters
|
public
Basho\Riak\Node\Config |null
|
|
public
Basho\Riak\Node[]
|
#
buildCluster( array $hosts = ['localhost'] )
Build distributed cluster
Build distributed cluster
Build node objects configured to listen on the same port but different hosts. Commonly used in
staging and production environments where you have multiple Riak nodes on multiple machines / vms.
Parameters
Returns
|
public
Basho\Riak\Node
|
#
build( )
Build node
Validate configuration for a single node object, then build it
Returns
|
protected
|
#
validate( )
Builder configuration validation
Builder configuration validation
Checks the current configuration of the Node Builder for errors. This method should be executed before each Node
is built.
Throws
|
public
|
#
atHost( $host )
Build with host address
Build node objects with configuration to use a specific host address
Parameters
Returns
$this
|
public
Basho\Riak\Node[]
|
#
buildLocalhost( array $ports = [8087] )
Build local node cluster
Build multiple node objects configured with the same host address but different ports. Commonly used in
development environments where you have multiple Riak nodes on a single machine / vm.
Parameters
Returns
|
public
|
#
onPort( $port )
Build node objects with configuration to use a specific port number
Build node objects with configuration to use a specific port number
Parameters
Returns
$this
|