To prevent multiple IP nodes, bind the current ZooKeeper client to any available IP address. The data flow layer, management layer, and other network layers in the production environment have different IP address ranges. Bind the ZooKeeper client to the IP address at the data flow layer. This helps locate the failure scenario where the data IP address is unreachable.
Configure zookeeper.client.bind.address to ensure that the client is always bound to the specified IP address. To set zookeeper.client.bind.address to X, set -Dzookeeper.client.bind.address to X when starting the ZooKeeper client.
Parameter |
System Parameter |
Description |
Default Value |
---|---|---|---|
zookeeper.client.bind.address |
zookeeper.client.bind.address |
Optional. IP address or host name bound to the ZooKeeper client. By default, the ZooKeeper client is bound to any available IP address in the system. |
- |
cd /opt/client
vi ZooKeeper/component_env
Add the zookeeper.client.bind.address parameter and its value.
Normal mode:
export ZOOKEEPER_HOME="/opt/client/ZooKeeper/zookeeper" PATH_NEW=`echo $PATH | sed "s|:$ZOOKEEPER_HOME/bin||g" | sed "s|$ZOOKEEPER_HOME/bin:||g"` export PATH="$ZOOKEEPER_HOME/bin:$PATH_NEW" # default heap for zookeeper client export ZK_CLIENT_HEAP="256" export CLIENT_JVMFLAGS="-Xmx${ZK_CLIENT_HEAP}m" export CLIENT_JVMFLAGS="$CLIENT_JVMFLAGS -Dzookeeper.root.logger=WARN,CONSOLE -Dzookeeper.request.timeout=120000 -Dzookeeper.client.bind.address=X" #Add a parameter. X indicates the configured IP address.
Security mode:
if [ "$HADOOP_SECURITY_AUTHENTICATION" = "kerberos" ]; then default_realm=`cat $KRB5_CONFIG |grep default_realm|awk -F"=" '{gsub(" ","");print $2}'|tr 'A-Z' 'a-z'` export ZOO_SERVER_PRINCIPAL="zookeeper/hadoop.${default_realm}" export CLIENT_JVMFLAGS=" ${CLIENT_JVMFLAGS} -Djava.security.krb5.conf=$KRB5_CONFIG -Dzookeeper.kin -Dzookeeper.client.bind.address=X" #Add a parameter. X indicates the configured IP address.