今天搭建Hbase集群过程中,在页面http://hadoop01:16010/zk.jsp发现zk 通讯统计节(Quorum Server Statistics)存在提示stat is not executed because it is not in the whitelist.

解决思路:

[root@hadoop01 bigdata]# echo conf|nc hadoop01 2181
conf is not executed because it is not in the whitelist.
zk的这些指令未在白名单里。这些指令有
    // specify all of the commands that are availablestatic {cmd2String.put(confCmd, "conf");cmd2String.put(consCmd, "cons");cmd2String.put(crstCmd, "crst");cmd2String.put(dirsCmd, "dirs");cmd2String.put(dumpCmd, "dump");cmd2String.put(enviCmd, "envi");cmd2String.put(getTraceMaskCmd, "gtmk");cmd2String.put(ruokCmd, "ruok");cmd2String.put(setTraceMaskCmd, "stmk");cmd2String.put(srstCmd, "srst");cmd2String.put(srvrCmd, "srvr");cmd2String.put(statCmd, "stat");cmd2String.put(wchcCmd, "wchc");cmd2String.put(wchpCmd, "wchp");cmd2String.put(wchsCmd, "wchs");cmd2String.put(mntrCmd, "mntr");cmd2String.put(isroCmd, "isro");cmd2String.put(telnetCloseCmd, "telnet close");}

搜索源码is not executed because it is not in the whitelist.

/** Return if four letter word found and responded to, otw false **/private boolean checkFourLetterWord(final Channel channel,ChannelBuffer message, final int len) throws IOException{// We take advantage of the limited size of the length to look// for cmds. They are all 4-bytes which fits inside of an intif (!FourLetterCommands.isKnown(len)) {return false;}String cmd = FourLetterCommands.getCommandString(len);channel.setInterestOps(0).awaitUninterruptibly();packetReceived();final PrintWriter pwriter = new PrintWriter(new BufferedWriter(new SendBufferWriter()));// ZOOKEEPER-2693: don't execute 4lw if it's not enabled.// 注意此处命令是否允许执行,isEnabled方法用于判断if (!FourLetterCommands.isEnabled(cmd)) {LOG.debug("Command {} is not executed because it is not in the whitelist.", cmd);NopCommand nopCmd = new NopCommand(pwriter, this, cmd +" is not executed because it is not in the whitelist.");nopCmd.start();return true;}LOG.info("Processing " + cmd + " command from "+ channel.getRemoteAddress());if (len == FourLetterCommands.setTraceMaskCmd) {ByteBuffer mask = ByteBuffer.allocate(8);message.readBytes(mask);mask.flip();long traceMask = mask.getLong();ZooTrace.setTextTraceLevel(traceMask);SetTraceMaskCommand setMask = new SetTraceMaskCommand(pwriter, this, traceMask);setMask.start();return true;} else {CommandExecutor commandExecutor = new CommandExecutor();return commandExecutor.execute(this, pwriter, len, zkServer,factory);}}
 /*** Check if the specified command is enabled.** In ZOOKEEPER-2693 we introduce a configuration option to only* allow a specific set of white listed commands to execute.* A command will only be executed if it is also configured* in the white list.** @param command The command string.* @return true if the specified command is enabled*/public synchronized static boolean isEnabled(String command) {// whiteListInitialized是否初始化过的标记,默认是false,whiteListedCommands相关命令加载完成后,就为true了if (whiteListInitialized) {return whiteListedCommands.contains(command);}// 参数key名称zookeeper.4lw.commands.whitelist的值直接用*,则会把cmd2String里已经缓存的所有指令放到这个白名单里String commands = System.getProperty(ZOOKEEPER_4LW_COMMANDS_WHITELIST);if (commands != null) {String[] list = commands.split(",");for (String cmd : list) {if (cmd.trim().equals("*")) {for (Map.Entry<Integer, String> entry : cmd2String.entrySet()) {whiteListedCommands.add(entry.getValue());}break;}if (!cmd.trim().isEmpty()) {whiteListedCommands.add(cmd.trim());}}}// It is sad that isro and srvr are used by ZooKeeper itself. Need fix this// before deprecating 4lw.if (System.getProperty("readonlymode.enabled", "false").equals("true")) {whiteListedCommands.add("isro");}// zkServer.sh depends on "srvr".whiteListedCommands.add("srvr");whiteListInitialized = true;LOG.info("The list of known four letter word commands is : {}", Arrays.asList(cmd2String));LOG.info("The list of enabled four letter word commands is : {}", Arrays.asList(whiteListedCommands));return whiteListedCommands.contains(command);}

解决方法:

方法1和2均可解决,采用其一即可。

1、在zoo.cfg 文件里加入配置项让这些指令放行

#开启四字命令
4lw.commands.whitelist=*

2、在zk的启动脚本zkServer.sh中新增放行指令

    ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMXPORT -Dcom.sun.management.jmxremote.authenticate=$JMXAUTH -Dcom.sun.management.jmxremote.ssl=$JMXSSL -Dzookeeper.jmx.log4j.disable=$JMXLOG4J org.apache.zookeeper.server.quorum.QuorumPeerMain"fi
elseecho "JMX disabled by user request" >&2ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
fi#添加VM环境变量-Dzookeeper.4lw.commands.whitelist=*
ZOOMAIN="-Dzookeeper.4lw.commands.whitelist=* ${ZOOMAIN}"if [ "x$SERVER_JVMFLAGS" != "x" ]
thenJVMFLAGS="$SERVER_JVMFLAGS $JVMFLAGS"
fi

注:配置完毕后,记得重启集群。./zkServer.sh restart

Zookeeper 集群4字命令白名单 stat is not executed because it is not in the whitelist.相关推荐

  1. Zookeeper集群搭建(涵盖命令详解)与Error contacting service. It is probably not running的问题解决

    搭建部分参考文章:http://www.cnblogs.com/luotianshuai/p/5206662.html 这篇博客分为四个部分: >>>zookeeper简介 > ...

  2. Zookeeper命令操作(初始Zookeeper、JavaAPI操作、分布式锁实现、模拟12306售票分布式锁、Zookeeper集群搭建、选举投票)

    Zookeeper命令操作(初始Zookeeper.JavaAPI操作.分布式锁实现.模拟12306售票分布式锁.Zookeeper集群搭建.选举投票) 1.初始Zookeeper Zookeeper ...

  3. Zookeeper集群部署和使用

    Zookeeper 由 Apache Hadoop 的 Zookeeper 子项目发展而来,Google Chubby的一个开源实现.它是一个分布式应用程序协调服务,提供的功能包括:配置管理,名字服务 ...

  4. Zookeeper集群部署及报错分析

    安装 下载压缩包 解压 修改zoo.cfg文件 创建myid文件 启动 自启动配置 有时间再补hhh 报错处理 很荣幸的遇到了大部分报错,日志再zookeeper目录的bin下的zookeeper.o ...

  5. zookeeper集群节点热扩容和迁移详解

    推荐阅读 Helm3(K8S 资源对象管理工具)视频教程:https://edu.csdn.net/course/detail/32506 Helm3(K8S 资源对象管理工具)博客专栏:https: ...

  6. 三台机器安装zookeeper集群

    1.准备工作 (1).关闭防火墙 systemctl stop firewalld systemctl disable firewalld (2).三台机器关闭selinux 三台机器在root用户下 ...

  7. zookeeper集群搭建与使用

    1.概念 1.1集群中的角色 leader服务器:zookeeper集群的核心 follower服务器:zookeeper集群状态的跟随者 observer服务器:观察者1.2会话 会话是指客户端与z ...

  8. 分布式协调服务Zookeeper集群搭建

    分布式协调服务Zookeeper集群搭建 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装jdk环境 1>.操作环境 [root@node101.yinzhengjie ...

  9. 077. Zookeeper 集群相关信息

    1. ZooKeeper 集群 可靠的 ZooKeeper 服务. 只要集群的大多数都准备好了,就可以使用这项服务. 容错集群设置至少需要三个服务器,强烈建议使用奇数个服务器. 建议每个服务运行在单独 ...

最新文章

  1. 极客新闻——04、WiFi万能钥匙万玉权:管理应该是“自下而上”
  2. 植物数据库-小RNA注释数据库 sRNAanno(2021)
  3. 混合SSVEP-P300 BCI生产双频SSVEP
  4. 设计模式--状态(State)模式
  5. SpringCloud 应用在 Kubernetes 上的最佳实践 —— 高可用(容量评估)
  6. ajax 填充,自动填充ajax请求
  7. CCIE理论-第九篇-IPV6详细介绍
  8. 一种结合颜色特征和区域生长的疾病斑图像分割方法(复杂环境下分割效果好)
  9. Scala确实是门好语言
  10. [转] Noise Contrastive Estimation 噪声对比估计 资料
  11. Bzoj 3339: Rmq Problem Bzoj 3585: mex 莫队,树状数组,二分
  12. Tomcat下载安装配置详细过程
  13. Python 爬取4K美女图片
  14. exePath must be specified when not running inside a stand alone exe
  15. 光照模型-PBS在Unity中的应用
  16. Docker 安装及镜像加速器配置
  17. 三明市机器人协会_☞ 智能之花 绚丽绽放——2019年三明市区首届青少年机器人竞赛活动在三明市陈景润实验小学完美收官...
  18. 一位“技术宅”自制的自行车码表在B站火了,稚晖君点赞,网友催量产
  19. Justinmind恢复30天试用 For Mac
  20. 格雷希尔GripSeal快速密封接头G70外卡式、滑套式快速连接器型号规格

热门文章

  1. Swift 3 中的新特性
  2. tiny4412用 usb 连接计算机显示sec s5pc210 test b/d 解决方法
  3. 新型养老模式的优缺点
  4. labview自动保存报表_基于LabVIEW的数据存储及报表设计方法
  5. 尚医通 (三十五) --------- 预约下单
  6. socket in Linux
  7. Wrangle – 响应式的,触摸友好的多选插件
  8. TI_DSP_SRIO - DirectIO操作-LSU
  9. python爬取app图片_利用python爬取斗鱼app中照片方法实例
  10. 若依使用自带上传图片,时间插件