Using a ZooKeeper Client
ZooKeeper is an open-source, highly reliable, and distributed consistency coordination service. ZooKeeper is designed to solve the problem that data consistency cannot be ensured for complex and error-prone distributed systems. ZooKeeper eliminates the need to develop custom coordination services. It is well suited for ensuring data consistency in high-availability applications.
Notes and Constraints
- Before using the client, you must download and update the configuration files across all cluster nodes, excluding the active management node.
- Every MRS cluster includes a built-in ZooKeeper component by default, which provides essential coordination services for other components across the cluster.
Procedure
- Download the client configuration file.
- Log in to FusionInsight Manager. For details, see Accessing FusionInsight Manager.
- For versions prior to MRS 3.3.0: Choose Cluster > Dashboard, click More, and select Download Client.
- For MRS 3.3.0 or later, click Download Client in upper right corner of the homepage
- Download the cluster client.
Set Select Client Type to Configuration Files Only, select a platform type, and click OK to generate the client configuration file which is then saved in the /tmp/FusionInsight-Client/ directory on the active management node by default.
- Log in to FusionInsight Manager. For details, see Accessing FusionInsight Manager.
- Log in to the active management node of Manager.
- Log in to any node where Manager is deployed as user root.
- Run the following command to identify the active and standby nodes:
sh ${BIGDATA_HOME}/om-server/om/sbin/status-oms.sh
In the command output, the value of HAActive for the active management node is active, and that for the standby management node is standby. In the following example, node-master1 is the active management node, and node-master2 is the standby management node.
HAMode double NodeName HostName HAVersion StartTime HAActive HAAllResOK HARunPhase 192-168-0-30 node-master1 V100R001C01 2020-05-01 23:43:02 active normal Actived 192-168-0-24 node-master2 V100R001C01 2020-05-01 07:14:02 standby normal Deactived
- Log in to the primary management node as user root and run the following command to switch to user omm:
sudo su - omm
- Run the following command to switch to the client installation directory, for example, /opt/client:
cd /opt/client
- Run the following command to update the client configuration for the active management node.
sh refreshConfig.sh /opt/client Absolute path of the client configuration file package
For example, run the following command:
sh refreshConfig.sh /opt/client /tmp/FusionInsight-Client/FusionInsight_Cluster_1_Services_Client.tar
If the following information is displayed, the configurations have been updated successfully:
ReFresh components client config is complete. Succeed to refresh components client config.
- Use the client on a Master node.
- On the active management node where the client is updated, for example, node 192-168-0-30, run the following command to go to the client directory:
cd /opt/client
- Run the following command to configure environment variables:
- If Kerberos authentication has been enabled for the current cluster, run the following command to authenticate the current user. For details, see Managing Roles to configure roles with required permissions. For details about how to bind roles with users, see Creating a User. If Kerberos authentication is disabled for the current cluster, skip this step:
kinit MRS cluster user
Example: kinit zookeeperuser.
- Run the following Zookeeper client command:
zkCli.sh -server <zookeeper installation node IP>:<port>
Example: zkCli.sh -server node-master1DGhZ:2181
You can search for clientPort across the ZooKeeper configuration parameters to view the <port> value. The default ports are as follows:- Default open-source port: 2181
- Default custom port: 24002
When creating an LTS version cluster, you can configure component ports as either open-source or customized. The system will automatically use the corresponding port based on your selection.
- On the active management node where the client is updated, for example, node 192-168-0-30, run the following command to go to the client directory:
- Run the ZooKeeper client command.
- Create a ZNode.
create /test
- View ZNode information.
ls /
- Write data to the ZNode.
set /test "zookeeper test"
- View the data written to the ZNode.
get /test
- Delete the created ZNode.
delete /test
- Create a ZNode.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot