zookeeper 修改储存的大小

1、zookeeper 默认的储存的大小是1M ,如果修改在zkServer.sh 中添加一下参数:-Djute.maxbuffer=10240000


ZOO_USER_CFG="-Djute.maxbuffer=10240000" 


修改后的文件为:


  1. #!/bin/sh  
  2.   
  3. # Licensed to the Apache Software Foundation (ASF) under one or more  
  4. # contributor license agreements.  See the NOTICE file distributed with  
  5. # this work for additional information regarding copyright ownership.  
  6. # The ASF licenses this file to You under the Apache License, Version 2.0  
  7. # (the "License"); you may not use this file except in compliance with  
  8. # the License.  You may obtain a copy of the License at  
  9. #  
  10. #     http://www.apache.org/licenses/LICENSE-2.0  
  11. #  
  12. # Unless required by applicable law or agreed to in writing, software  
  13. # distributed under the License is distributed on an "AS IS" BASIS,  
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
  15. # See the License for the specific language governing permissions and  
  16. # limitations under the License.  
  17.   
  18. #  
  19. # If this scripted is run out of /usr/bin or some other system bin directory  
  20. # it should be linked to and not copied. Things like java jar files are found  
  21. # relative to the canonical path of this script.  
  22. #  
  23.   
  24. # See the following page for extensive details on setting  
  25. # up the JVM to accept JMX remote management:  
  26. # http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html  
  27. # by default we allow local JMX connections  
  28.   
  29. ZOO_USER_CFG="-Djute.maxbuffer=10240000"  
  30.   
  31. if [ "x$JMXLOCALONLY" = "x" ]  
  32. then  
  33.     JMXLOCALONLY=false  
  34. fi  
  35.   
  36. if [ "x$JMXDISABLE" = "x" ]  
  37. then  
  38.     echo "JMX enabled by default" >&2  
  39.     # for some reason these two options are necessary on jdk6 on Ubuntu  
  40.     #   accord to the docs they are not necessary, but otw jconsole cannot  
  41.     #   do a local attach  
  42.     ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain"  
  43. else  
  44.     echo "JMX disabled by user request" >&2  
  45.     ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"  
  46. fi  
  47.   
  48. # Only follow symlinks if readlink supports it  
  49. if readlink -f "$0" > /dev/null 2>&1  
  50. then  
  51.   ZOOBIN=`readlink -f "$0"`  
  52. else  
  53.   ZOOBIN="$0"  
  54. fi  
  55. ZOOBINDIR=`dirname "$ZOOBIN"`  
  56.   
  57. . "$ZOOBINDIR"/zkEnv.sh  
  58.   
  59. if [ "x$SERVER_JVMFLAGS" ]  
  60. then  
  61.     JVMFLAGS="$SERVER_JVMFLAGS $JVMFLAGS"  
  62. fi  
  63.   
  64. if [ "x$2" != "x" ]  
  65. then  
  66.     ZOOCFG="$ZOOCFGDIR/$2"  
  67. fi  
  68.   
  69. # if we give a more complicated path to the config, don't screw around in $ZOOCFGDIR  
  70. if [ "x`dirname $ZOOCFG`" != "x$ZOOCFGDIR" ]  
  71. then  
  72.     ZOOCFG="$2"  
  73.     echo "Using config:$2" >&2  
  74. fi  
  75.   
  76. if $cygwin  
  77. then  
  78.     ZOOCFG=`cygpath -wp "$ZOOCFG"`  
  79.     # cygwin has a "kill" in the shell itself, gets confused  
  80.     KILL=/bin/kill  
  81. else  
  82.     KILL=kill  
  83. fi  
  84.   
  85. echo "Using config: $ZOOCFG" >&2  
  86.   
  87. if [ -z $ZOOPIDFILE ]  
  88.   then ZOOPIDFILE=$(grep dataDir "$ZOOCFG" | sed -e 's/.*=//')/zookeeper_server.pid  
  89. fi  
  90.   
  91. _ZOO_DAEMON_OUT="$ZOO_LOG_DIR/zookeeper.out"  
  92.   
  93. case $1 in  
  94. start)  
  95.     echo  -n "Starting zookeeper ... "  
  96.     if [ -f $ZOOPIDFILE ]; then  
  97.       if kill -0 `cat $ZOOPIDFILE` > /dev/null 2>&1; then  
  98.          echo $command already running as process `cat $ZOOPIDFILE`.   
  99.          exit 0  
  100.       fi  
  101.     fi  
  102.     nohup $JAVA "$ZOO_USER_CFG" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \  
  103.     -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT" 2>&1 < /dev/null &  
  104.     if [ $? -eq 0 ]  
  105.     then  
  106.       if /bin/echo -n $! > "$ZOOPIDFILE"  
  107.       then  
  108.         sleep 1  
  109.         echo STARTED  
  110.       else  
  111.         echo FAILED TO WRITE PID  
  112.         exit 1  
  113.       fi  
  114.     else  
  115.       echo SERVER DID NOT START  
  116.       exit 1  
  117.     fi  
  118.     ;;  
  119. start-foreground)  
  120.     ZOO_CMD="exec $JAVA"  
  121.     if [ "${ZOO_NOEXEC}" != "" ]; then  
  122.       ZOO_CMD="$JAVA"  
  123.     fi  
  124.     $ZOO_CMD "$ZOO_USER_CFG" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \  
  125.     -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG"  
  126.     ;;  
  127. print-cmd)  
  128.     echo "$JAVA -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\" -cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\" > \"$_ZOO_DAEMON_OUT\" 2>&1 < /dev/null"  
  129.     ;;  
  130. stop)  
  131.     echo -n "Stopping zookeeper ... "  
  132.     if [ ! -f "$ZOOPIDFILE" ]  
  133.     then  
  134.       echo "no zookeeper to stop (could not find file $ZOOPIDFILE)"  
  135.     else  
  136.       $KILL -9 $(cat "$ZOOPIDFILE")  
  137.       rm "$ZOOPIDFILE"  
  138.       echo STOPPED  
  139.     fi  
  140.     ;;  
  141. upgrade)  
  142.     shift  
  143.     echo "upgrading the servers to 3.*"  
  144.     $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \  
  145.     -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@}  
  146.     echo "Upgrading ... "  
  147.     ;;  
  148. restart)  
  149.     shift  
  150.     "$0" stop ${@}  
  151.     sleep 3  
  152.     "$0" start ${@}  
  153.     ;;  
  154. status)  
  155.     # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output  
  156.     STAT=`$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \  
  157.              -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain localhost \  
  158.              $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//') srvr 2> /dev/null    \  
  159.           | grep Mode`  
  160.     if [ "x$STAT" = "x" ]  
  161.     then  
  162.         echo "Error contacting service. It is probably not running."  
  163.         exit 1  
  164.     else  
  165.         echo $STAT  
  166.         exit 0  
  167.     fi  
  168.     ;;  
  169. *)  
  170.     echo "Usage: $0 {start|start-foreground|stop|restart|status|upgrade|print-cmd}" >&2  
  171.   
  172. esac  

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值