Use this function to connect to the MapR cluster.
This API takes three parameters:
There are two methods by which you can use the zk_ensemble parameter to determine how the MapR client connection locates the MapR cluster to connect to:
zk_ensemble to NULL to connect to the default cluster that is defined in the
MapR recommends this method, which uses the configuration information that is listed for the cluster in the
zk_ensemble to a string that includes hostnames or IP addresses.
With this method, the client application can connect to a non-default cluster explicitly. The client application searches through the
mapr-clusters.conf file to find a cluster entry with a matching hostname/IP address. The first entry that is found to contain a matching hostname[:port]/IP address[:port} is used for the connection, as is the configuration information for that entry.
If none of the hostnames or IP addresses specified for
zk_ensemble are located in entries in
mapr-clusters.conf, or if mapr-clusters.conf does not exist, the client application tries to connect to the first specified hostname[:port]/IP address[:port]. If the client application cannot make a connection, it moves to the next specified hostname[:port]/IP address[:port].
mapr-clusters.conf file is involved, no additional configuration information is used for connections. For example, connections made in this way cannot be secure because no security parameters are provided.
Code in the sample application