當前位置:首頁 » 密碼管理 » 訪問hbase

訪問hbase

發布時間: 2022-06-11 17:08:16

⑴ hbase使用出的錯,求幫助

一、客戶端訪問hbase時出現 no further information
使用java api訪問hbase時,一直連不上,查看日誌發現以下錯誤:
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:933)
10/06/25 15:44:23 WARN zookeeper.ClientCnxn: Ignoring exception ring shutdown input
java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.shutdownInput(Unknown Source)
at sun.nio.ch.SocketAdaptor.shutdownInput(Unknown Source)

查看hbase日誌發現有客戶端連接信息,但是響應之後一直客戶端便一直報上述錯誤。查資料得知該錯一般由於客戶端獲取hbase regionServer的Ip錯誤導致,查看zookeeper中的地址發現存的是localhost。經網上資料得知偽分布式式下若未配置host默認獲取地址為localhost(大概考慮偽分布式一般都為本機訪問吧),在host中將localhost配置成ip即可。
二、HBase同時出現TableNotEnabledException和TableNotDisabledException
在一次enable表的時候由於時間過長而直接ctrl+c結束,結果再次操作時出現TableNotDisabledException錯誤,而嘗試disable卻出現
TableNotEnabledException,導致無法啟用表。上網查詢得知是由於中斷操作導致zookeeper中記錄的表狀態不一致導致。通過以下方法解決。
1、連接zookeeper( 直接通過hbase的工具)hbase zkcli
2、刪除hbase下 對應表的數據(或者直接刪除/hbase/table路徑)delete /hbase/table/{表名}

3、重啟hbase

⑵ 外網訪問hbase;linux下使用eclipse

一、新建本地java工程
file->new->java project

二、添加jar包和配置文件
1、添加JAR包
右擊Propertie在彈出的快捷菜單中選擇Java Build Path對話框,在該對話框中單擊Libraries選項卡,在該選項卡下單擊
Add External JARs按鈕,定位到$HBASE/lib目錄下,並選取如下JAR包。
hadoop-core-1.0.0.jar
commons-loggings-version.jar
commons-cli-version.jar
commons-lang-version.jar
commons-configuration-version.jar
hbase-0.94.1.jar
zookeeper-3.4.3.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.5.8.jar
log4j-1.2.16.jar
protobuf-java-2.4.1.jar
2、添加hbase-site.xml配置文件
在工程根目錄下創建conf文件夾,將$HBASE_HOME/conf/目錄中的hbase-site.xml文件復制到該文件夾中。通過右鍵
選擇Propertie->Java Build Path->Libraries->Add Class Folder。

3、windows下開發HBase應用程序,HBase部署在linux環境中,在運行調試時可能會出現無法找到主機,類似異常信息如下:java.net.UnknownHostException: unknown host: master
解決辦法如下:在C:\WINDOWS\system32\drivers\etc\hosts文件中添加如下信息
192.168.2.34 master

⑶ 如何在python中訪問HBase的數據

Python連接HBase時需要先載入Thrift和HBase的相關包,之後創建與HBase的連接並進行後續操作,具體代碼如下:
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
from hbase.ttypes import *
import pymongo
import hashlib
import time
from datetime import datetime

class HBaseOperator():
def __init__(self):
self.host = "ip_address"
self.port = 9090
self.transport = TBufferedTransport(TSocket(self.host, self.port))
self.transport.open()
self.protocol = TBinaryProtocol.TBinaryProtocol(self.transport)
self.client = Hbase.Client(self.protocol)

def __del__(self):
self.transport.close()

def getAllTablesInfo(self):
#get table info
listTables = self.client.getTableNames()
print "="*40
print "Show all tables information...."

for tableName in listTables:
print "TableName:" + tableName
print " "
listColumns = self.client.getColumnDescriptors(tableName)
print listColumns
print " "

listTableRegions = self.client.getTableRegions(tableName)
print listTableRegions
print "+"*40

⑷ Maven項目訪問Hbase為何在master執行

從zookeeper上獲取唯一一個代表activemaster的鎖,用來阻止其它master成為活著的master。
由於master只維護表和region的元數據,而不參與表數據IO的過程,master下線僅導致所有元數據的修改被凍結(無法創建刪除表,無法修改表的schema,無法進行region的負載均衡,無法處理region上下線,無法進行region的合並,唯一例外的是region的split可以正常進行,因為只有regionserver參與),表的數據讀寫還可以正常進行。因此master下線短時間內對整個hbase集群沒有影響。
向HBase插入數據時程序一直處於卡死狀態。一般出現這種問題都是因為主機映射沒有配置或者防火牆沒有關閉,然而我早早就配置號了映射和關閉了。

⑸ 部署應用 怎麼配置訪問hbase集群名稱

1>准備工作a>已經配置完成的Hadoop集群b>所需要的軟體包zookeeper-3.4.4.tar.gzhbase-0.94.5.tar.gz2>單獨安裝的ZooKeeper集群,不基於HBase集群管理a>在master01上解壓zookeeper-3.4.4.tar.gz#tar-zxvfzookeeper-3.4.4.tar.gzb>修改Zookeeper的配置文件#vim/root/zookeeper-3.4.4/conf/zoo.cfg

⑹ client使用hbase RPC協議與什麼進行數據讀寫

client整個HBase集群的訪問入口;使用HBase RPC機制與HMaster和HRegionServer進行通信;client與HMaster進行通信進行管理表的操作;client與HRegionServer進行數據讀寫類操作;包含訪問HBase的介面,並維護cache來加快對HBase的訪問。
RPC(遠程過程調用協議)是不同主機進程間通訊的一種方式,協議採用客戶機-伺服器模式的架構,請求程序為客戶機,服務提供程序為伺服器,hbase在client與server通信上採用的也是RPC協議,並在client端與server端實現了具體的RPC協議內容。

⑺ 在hbase三層結構下客戶端怎麼樣訪問到數據的

首先訪問Zookeeper,獲取-ROOT表的位置信息,然後訪問-ROOT表,獲得.MATA.表的信息,接著訪問.MATA.表,找到所需的Region具體位於哪個伺服器,最後才找到該Region伺服器讀取數據。

⑻ 在本地訪問hbase 一定要改host文件嗎

不一定的。當不想用本地的hosts文件時,將空白的hosts文件替換,想啟用時,再替換過來。

⑼ 本地如何連接hbase資料庫

1.使用xshell或者crt等工具連接到hbase所在的伺服器
2.然後通過ls查找到hbase
3.然後cd
切換到hbase目錄下
4.bin/start-hbase.sh
5.bin/hbase
shell
6.list
查看該用戶下的所有表格

⑽ Python訪問hbase集群

HBase-thrift項目是對HBase Thrift介面的封裝,屏蔽底層的細節,使用戶可以方便地通過HBase Thrift介面訪問HBase集群,python通過thrift訪問HBase。

熱點內容
怎麼引入安卓項目 發布:2025-05-14 21:26:39 瀏覽:823
游戲輔編程 發布:2025-05-14 21:18:49 瀏覽:686
三菱plc一段二段密碼什麼意思 發布:2025-05-14 21:17:16 瀏覽:527
電腦開機密碼忘記了怎麼破解 發布:2025-05-14 21:09:40 瀏覽:56
pythondict格式 發布:2025-05-14 21:09:38 瀏覽:885
落葉片拍攝腳本 發布:2025-05-14 20:40:49 瀏覽:798
安卓為什麼不能用cmwap 發布:2025-05-14 20:40:43 瀏覽:657
jquery獲取上傳文件 發布:2025-05-14 20:27:57 瀏覽:44
雲web伺服器搭建 發布:2025-05-14 20:25:36 瀏覽:526
汽修汽配源碼 發布:2025-05-14 20:08:53 瀏覽:743