1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| # hbase.apache.org/downloads.html # hbase-2.2.6-bin.tar.gz wget https://archive.apache.org/dist/hbase/2.2.6/hbase-2.2.6-bin.tar.gz tar zxvf hbase-2.2.6-bin.tar.gz mkdir -p /usr/local/hbase/hbase-2.2.6/hbase/ mkdir -p /usr/local/hbase/hbase-2.2.6/zookeeper/ vim /usr/local/hbase-2.2.6/conf/hbase-env.sh export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-2.b15.el7_2.x86_64 vim /usr/local/hbase-2.2.6/conf/hbase-site.xml <configuration> <!-- hbase存放数据目录 /data/soft/hbase-2.2.6/hbase为自定义地址 --> <property> <name>hbase.rootdir</name> <value>file:///data/soft/hbase-2.2.6/hbase</value> </property> <!-- ZooKeeper数据文件路径 --> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/usr/hbase/hbase-2.2.6/zookeeper</value> </property> <property> <name>hbase.unsafe.stream.capability.enforce</name> <value>false</value> <description> Controls whether HBase will check for stream capabilities (hflush/hsync). Disable this if you intend to run on LocalFileSystem, denoted by a rootdir with the 'file://' scheme, but be mindful of the NOTE below. WARNING: Setting this to false blinds you to potential data loss and inconsistent system state in the event of process and/or node failures. If HBase is complaining of an inability to use hsync or hflush it's most likely not a false positive. </description> </property> </configuration> export HBASE_HOME=/usr/local/hbase-2.2.6 export PATH=$HBASE_HOME/bin:$PATH # 启动hbase ./bin/start-hbase.sh # 停止hbase ./bin/stop-hbase.sh # http://9.134.196.182:16010/master-status # 连接 ./bin/hbase shell hbase(main):002:0> create_namespace 'test' Took 0.1420 seconds hbase(main):003:0> create 'test:wednesday', 'cf' Created table test:wednesday Took 0.7373 seconds => Hbase::Table - test:wednesday hbase(main):004:0> list 'test:wednesday' TABLE test:wednesday 1 row(s) Took 0.0191 seconds => ["test:wednesday"] hbase(main):005:0> desc 'test:wednesday' Table test:wednesday is ENABLED test:wednesday COLUMN FAMILIES DESCRIPTION {NAME => 'cf', VERSIONS => '1', EVICT_BLOCKS_ON_CLOSE => 'false', NEW_VERSION_BE HAVIOR => 'false', KEEP_DELETED_CELLS => 'FALSE', CACHE_DATA_ON_WRITE => 'false' , DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', MIN_VERSIONS => '0', REPLICAT ION_SCOPE => '0', BLOOMFILTER => 'ROW', CACHE_INDEX_ON_WRITE => 'false', IN_MEMO RY => 'false', CACHE_BLOOMS_ON_WRITE => 'false', PREFETCH_BLOCKS_ON_OPEN => 'fal se', COMPRESSION => 'NONE', BLOCKCACHE => 'true', BLOCKSIZE => '65536'} 1 row(s) QUOTAS 0 row(s) Took 0.1878 seconds hbase(main):007:0> put 'test:wednesday','r1','cf:k1','v1' Took 0.0056 seconds hbase(main):008:0> put 'test:wednesday','r2','cf:k2','v2' Took 0.0038 seconds hbase(main):009:0> put 'test:wednesday','r3','cf:k3','v3' Took 0.0038 seconds hbase(main):010:0> scan 'test:wednesday' ROW COLUMN+CELL r1 column=cf:k1, timestamp=1644406717928, value=v1 r2 column=cf:k2, timestamp=1644406748969, value=v2 r3 column=cf:k3, timestamp=1644406756410, value=v3 3 row(s) Took 0.0238 seconds hbase(main):011:0> get 'test:wednesday','r1' COLUMN CELL cf:k1 timestamp=1644406717928, value=v1 1 row(s) Took 0.0108 seconds # create 'xxx',{NAME =>'cf',VERSIONS=>1,COMPRESSION=>'snappy',TTL => 500},{SPLITS => ['1','2','3','4','5','6']}
|