避免regionServer宕机,避免regionserver宕
因为regionserver 的管理信息主要记录在zookeeper,regionserver的宕机判断依据是session expired。ok
那么regionserver 和Zookeeper的session expired原因有哪些尼?
1. 网络不好。 2. Java full GC, 这会block所有的线程。如果时间比较长,也会导致session expired. 解决办法: 1. 将Zookeeper的timeout时间加长。 2. 配置“hbase.regionserver.restart.on.zk.expire” 为true。 这样子,遇到ZooKeeper session expired , regionserver将选择 restart 而不是 abort 具体的配置是,在hbase-site.xml中加入 <property> <name>zookeeper.session.timeout</name> <value>90000</value> <description>ZooKeeper session timeout. HBase passes this to the zk quorum as suggested maximum time for a session. See http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html#ch_zkSessions “The client sends a requested timeout, the server responds with the timeout that it can give the client. The current implementation requires that the timeout be a minimum of 2 times the tickTime (as set in the server configuration) and a maximum of 20 times the tickTime.” Set the zk ticktime with hbase.zookeeper.property.tickTime. In milliseconds. </description> </property> <property> <name>hbase.regionserver.restart.on.zk.expire</name> <value>true</value> <description> Zookeeper session expired will force regionserver exit. Enable this will make the regionserver restart. </description> </property> 3、为了避免java full GC suspend thread 对Zookeeper heartbeat的影响,我们还需要对hbase-env.sh进行配置。 设置jvm的内存回收算法:
-XX:+CMSParallelRemarkEnabled。
如下所示:
export HBASE_OPTS="-Xms16g -Xmx16g -Xmn2g -Xss200k -XX:MaxNewSize=2g -XX:SurvivorRatio=2 -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseParNewGC -XX:MaxPermSize=300m -XX:MaxTenuringThreshold=5 -XX:GCTimeRatio=19 -XX:ParallelGCThreads=10 -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:-UseGCOverheadLimit "
最后启动 regionserver: 命令:hbase-daemon.sh start regionserver
开启balance命令:balance_switch true
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。