为了账号安全,请及时绑定邮箱和手机立即绑定

我该如何设置多个TSD对HBase集群问题,怎么解决?

/ 猿问

我该如何设置多个TSD对HBase集群问题,怎么解决?

慕码人2483693 2019-10-20 13:09:12

设置多个TSD对HBase集群问题,怎么解决


查看完整描述

3 回答

?
湖上湖

问题一:使用自己搭建的zookeeper集群而不使用hbase自带的zookeeper解决办法?
首先:在hbase-env.sh中修改如下参数:

屏蔽hbase自带的zookeeper
问题二:通过start-abase.sh启动hbase集群发现从节点报如下错误:
30 14:02:05,999 FATAL [regionserver60020] regionserver.HRegionServer: Master rejected startup because clock is out of sync

org.apache.hadoop.hbase.ClockOutOfSyncException: org.apache.hadoop.hbase.ClockOutOfSyncException: Server heres01,60020,1493532120370 has been rejected; Reported time i
s too far out of sync with master. Time difference of 2421573ms>max allowed of 30000ms
at org.apache.hadoop.hbase.master.ServerManager.checkClockSkew(ServerManager.java:314)
at org.apache.hadoop.hbase.master.ServerManager.regionServerStartup(ServerManager.java:215)
at org.apache.hadoop.hbase.master.HMaster.regionServerStartup(HMaster.java:1292)
at org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos$RegionServerStatusService$2.callBlockingMethod(RegionServerStatusProtos.java:5085)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2185)
at org.apache.hadoop.hbase.ipc.RpcServer$Handler.run(RpcServer.java:1889)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106)
at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:95)
at org.apache.hadoop.hbase.protobuf.ProtobufUtil.getRemoteException(ProtobufUtil.java:277)
at org.apache.hadoop.hbase.regionserver.HRegionServer.reportForDuty(HRegionServer.java:1955)
at org.apache.hadoop.hbase.regionserver.HRegionServer.run(HRegionServer.java:794)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException(org.apache.hadoop.hbase.ClockOutOfSyncException): org.apache.hadoop.hbase.ClockOutOfSyncException: Ser
ver heres01,60020,1493532120370 has been rejected; Reported time is too far out of sync with master. Time difference of 2421573ms>max allowed of 30000ms
at org.apache.hadoop.hbase.master.ServerManager.checkClockSkew(ServerManager.java:314)
at org.apache.hadoop.hbase.master.ServerManager.regionServerStartup(ServerManager.java:215)
at org.apache.hadoop.hbase.master.HMaster.regionServerStartup(HMaster.java:1292)
at org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos$RegionServerStatusService$2.callBlockingMethod(RegionServerStatusProtos.java:5085)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2185)
at org.apache.hadoop.hbase.ipc.RpcServer$Handler.run(RpcServer.java:1889)
at org.apache.hadoop.hbase.ipc.RpcClient.call(RpcClient.java:1454)
at org.apache.hadoop.hbase.ipc.RpcClient.callBlockingMethod(RpcClient.java:1658)
at org.apache.hadoop.hbase.ipc.RpcClient$BlockingRpcChannelImplementation.callBlockingMethod(RpcClient.java:1716)
at org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos$RegionServerStatusService$BlockingStub.regionServerStartup(RegionServerStatusProtos.java
:5402)
at org.apache.hadoop.hbase.regionserver.HRegionServer.reportForDuty(HRegionServer.java:1953)
... 2 more
出现该问题的原因:因为整个集群时间没有统一,导致master连接slave超时,所以导致从节点的HRegionServer进程没有正常启动,
解决办法:
1⃣️.在hbase-site.xml文件中 修改增加 ,将时间改大点
<property>
<name>hbase.master.maxclockskew</name>
<value>150000</value>
</property>
2⃣️.修改日期
date -s 11/23/2013
修改时间
date -s 15:14:00
检查硬件(CMOS)时间
clock -r
这个修改在系统重启后就失效了,因此为了将这个时间永久生效,需要将修改的时间写入CMOS。
clock -w
最后,关闭所有hbase集群的进程,重启启动,需要注意的一点是,在启动hbase集群前,先自己手动启动zookeeper集群



查看完整回答
反对 回复 2019-10-26
?
慕用2447696

使用maven+idea进行管理

maven

<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency>

<dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-shaded-client</artifactId> <version>1.2.3</version> </dependency>

代码如下:package hbase; import java.io.IOException; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.Bytes; /** * Created by Administrator on 2016/9/19. */ public class HbaseDemo { static Connection connection =null; static{ Configuration hbaseConfiguration = HBaseConfiguration.create(); hbaseConfiguration.set("hbase.zookeeper.property.clientPort", "2181"); hbaseConfiguration.set("hbase.zookeeper.quorum", "192.168.199.6,192.168.199.7,192.168.199.8"); try { connection = ConnectionFactory.createConnection(hbaseConfiguration); } catch (IOException e) { e.printStackTrace(); } } /** * 创建表 * @param tablename 表名 * @param columnFamily 列族 * @throws IOException * @throws ZooKeeperConnectionException * @throws MasterNotRunningException */ public static void CreateTable(String tablename,String columnFamily) throws MasterNotRunningException, ZooKeeperConnectionException, IOException{ Admin admin = connection.getAdmin(); TableName tableName =TableName.valueOf(tablename); HTableDescriptor tableDesc = new HTableDescriptor(tableName); tableDesc.addFamily(new HColumnDescriptor(columnFamily)); admin.createTable(tableDesc); System.out.println(tablename+"表已经成功创建!"); } /** * 向表中插入一条新数据 * @param tableName 表名 * @param row 行键key * @param columnFamily 列族 * @param column 列名 * @param data 要插入的数据 * @throws IOException */ public static void PutData(String tableName,String row,String columnFamily,String column,String data) throws IOException{ TableName tableName1 = TableName.valueOf(tableName); Table table = connection.getTa


查看完整回答
反对 回复 2019-10-26

添加回答

回复

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信