HBase 创建表已经存在,删除表又不存在的问题
2017-04-07 17:28
253 查看
1. 创建表,提示已经存在
[root@node1]# hbase shell 2017-04-07 14:13:46,230 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/lib/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/lib/hadoop/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 1.2.4, r67592f3d062743907f8c5ae00dbbe1ae4f69e5af, Tue Oct 25 18:10:20 CDT 2016 hbase(main):001:0> hbase(main):012:0> create 'googlebook','cf1' ERROR: Table already exists: googlebook! Here is some help for this command: Creates a table. Pass a table name, and a set of column family specifications (at least one), and, optionally, table configuration. Column specification can be a simple string (name), or a dictionary (dictionaries are described below in main help output), necessarily including NAME attribute. Examples: Create a table with namespace=ns1 and table qualifier=t1 hbase> create 'ns1:t1', {NAME => 'f1', VERSIONS => 5} Create a table with namespace=default and table qualifier=t1 hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'} hbase> # The above in shorthand would be the following: hbase> create 't1', 'f1', 'f2', 'f3' hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true} hbase> create 't1', {NAME => 'f1', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => '10'}} Table configuration options can be put at the end. Examples: hbase> create 'ns1:t1', 'f1', SPLITS => ['10', '20', '30', '40'] hbase> create 't1', 'f1', SPLITS => ['10', '20', '30', '40'] hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe' hbase> create 't1', {NAME => 'f1', VERSIONS => 5}, METADATA => { 'mykey' => 'myvalue' } hbase> # Optionally pre-split the table into NUMREGIONS, using hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname) hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'} hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit', REGION_REPLICATION => 2, CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}} hbase> create 't1', {NAME => 'f1', DFS_REPLICATION => 1} You can also keep around a reference to the created table: hbase> t1 = create 't1', 'f1' Which gives you a reference to the table named 't1', on which you can then
2. 删除该表时,提示不存在
hbase(main):024:0> disable 'googlebook' ERROR: Table googlebook does not exist. Here is some help for this command: Start disable of named table: hbase> disable 't1' hbase> disable 'ns1:t1' hbase(main):025:0> drop 'googlebook' ERROR: Table googlebook does not exist. Here is some help for this command: Drop the named table. Table must first be disabled: hbase> drop 't1' hbase> drop 'ns1:t1' hbase(main):026:0>
3. 解决办法
清除Zookeeper内存数据库中的相关数据[root@node1]# zkCli.sh [zk: localhost:2181(CONNECTED) 0] ls / [zookeeper, hadoop-ha, hbase] [zk: localhost:2181(CONNECTED) 1] ls /hbase [replication, meta-region-server, rs, splitWAL, backup-masters, table-lock, flush-table-proc, region-in-transition, online-snapshot, master, running, balancer, recovering-regions, draining, namespace, hbaseid, table]
删除 /hbase/table-lock下的相关数据
[zk: localhost:2181(CONNECTED) 2] ls /hbase/table-lock [google, googlebook1, hbase:namespace, t1, googlebook] [zk: localhost:2181(CONNECTED) 4] rmr /hbase/table-lock/googlebook [zk: localhost:2181(CONNECTED) 7] ls /hbase/table-lock [google, googlebook1, hbase:namespace, t1]
删除 /hbase/table下的相关数据
[zk: localhost:2181(CONNECTED) 9] ls /hbase/table [google, googlebook1, hbase:namespace, t1, googlebook] [zk: localhost:2181(CONNECTED) 10] rmr /hbase/table/googlebook [zk: localhost:2181(CONNECTED) 7] ls /hbase/table [google, googlebook1, hbase:namespace, t1]
4. 重新创建表
[root@node1]# hbase shell 2017-04-07 15:13:55,669 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/lib/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/lib/hadoop/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 1.2.4, r67592f3d062743907f8c5ae00dbbe1ae4f69e5af, Tue Oct 25 18:10:20 CDT 2016 hbase(main):001:0> create 'googlebook','cf1' 0 row(s) in 2.4910 seconds => Hbase::Table - googlebook hbase(main):002:0>
相关文章推荐
- 【转】通过文件锁实现,程序开始运行时,先判断文件是否存在,若存在则表明该程序已经在运行了,如果不存在就用open函数创建该文件,程序退出时关闭文件并删除文件
- 通过文件锁实现,程序开始运行时,先判断文件是否存在,若存在则表明该程序已经在运行了,如果不存在就用open函数创建该文件,程序退出时关闭文件并删除文件。
- 通过文件锁实现,程序开始运行时,先判断文件是否存在,若存在则表明该程序已经在运行了,如果不存在就用open函数创建该文件,程序退出时关闭文件并删除文件
- (my)eclipse工作空间中删除项目重新导入会遇到项目已经存在的问题
- 大数据_Kafka_Kafka自动创建不存在的Topics / 删除已存在的Topics
- 在删除表前,oracle如何判断表是否存在,存在就删再创建,不存在直接创建!
- winform中判断文件夹以及文件是否存在,文件夹不存在进行创建,文件存在进行删除
- 已经删除了datanode所有数据,但是Hbase创建表格时,仍Hbase Table already exists的处理方法~!
- 附:MySQL常见错误代码说明 1005:创建表失败 1006:创建数据库失败 1007:数据库已存在,创建数据库失败 1008:数据库不存在,删除数据库失败 1009:不能删除数据库文件导
- IntelliJ IDEA 创建maven项目一次后,然后删除,再次保存到此目录下,提供此目录已经被占用的问题。
- Oracle数据库中如果存在表就删除不存在就创建的实例
- ORACLE如果存在表就删除不存在就创建
- hbase非正常删除表之后,以原来表名删除和创建时报错问题
- hbase表list不存在,但是创建时报错:已存在
- MySQL存储过程----创建索引前,先判断索引是否已经存在,如果存在,则不添加,如果不存在,添加
- MySQL存储过程----创建索引前,先判断索引是否已经存在,如果存在,则不添加,如果不存在,添加
- Doc的窗口就创建一个,如果已经存在就激活那个窗口,不存在就建立Doc(转自CSDN)
- 使用闪回归档区+创建表时指定闪回归档区+为已经存在的表指定闪回归档区+删除表的闪回归档区+查询指定闪回归档区的信息
- Dos判断文件夹有没有存在,如果存在删除,不存在创建
- SQL Server"错误 21002: [SQL-DMO]用户 * 已经存在问题解决