The following describes how to install hadoop on hbase ubuntu12.04. Suppose you have correctly installed hadoop before installing hbase (refer to the previous blog post ).
1.1 download and decompress the latest version and select an Apache download image: http://www.apache.org/dyn/closer.cgi/hbase/. download
Hbase releases. Click the stable directory, and then download the file with the suffix .tar.gz; for example, hbase-0.94.8.tar.gz.
tar -zxvf hbase-0.94.8.tar.gzcd hbase-0.94.8
Now you can start hbase. However, you may need to edit the conf/hbase-site.xml to configure hbase. rootdir to select the directory in which hbase writes data.
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>hbase.rootdir</name> <value>file:///DIRECTORY/hbase</value> </property> </configuration>
Replace directory with the directory of the file you want to write. hbase by default. rootdir is directed to/tmp/hbase-$ {user. name}, that is, you will lose data after the restart (when the restart
When the operating system clears the/tmp directory)
1.2. Start hbase
Start hbase now:
$ ./bin/start-hbase.sh
starting Master, logging to logs/hbase-user-master-example.org.out
Now you are running standalone elasticsearch. Therefore, all services run on a JVM, including hbase and zookeeper. Hbase logs are stored inlogs
Directory. When a problem occurs during startup,
Check this log.
Errors During installation:
1, error: org. Apache. hadoop. hbase. masternotrunningexception: retried 7 times
Obviously, the log says that the RPC protocol is inconsistent, and it is clear that I set rootdir to HDFS in the hbase configuration file, if the two RPC protocols are inconsistent, this problem will occur.
Solution:
Delete the JAR file of hadoop-core under the hbase/lib directory, and convert hadoop-****-core under the hadoop directory. copy the JAR file to hbase/lib and restart hbase.
2, error: org. Apache. hadoop. hbase. pleaseholdexception: org. Apache. hadoop. hbase.
Solution:
If the system is Ubuntu, pay attention
Whether or not 127.0.0.1 in/etc/hosts is 127.0.1.1. If so, modify it.
1.3 Test, hbase Shell
Use shell to connect to hbase
hbase(main):003:0> create 'test', 'c1'0 row(s) in 1.2200 secondshbase(main):003:0> list 'table'test1 row(s) in 0.0550 secondshbase(main):004:0> put 'test', 'row1', 'c1:a', 'value1'0 row(s) in 0.0560 secondshbase(main):005:0> put 'test', 'row2', 'c1:b', 'value2'0 row(s) in 0.0370 secondshbase(main):006:0> put 'test', 'row3', 'c1:c', 'value3'0 row(s) in 0.0450 seconds
We have inserted three rows above. The key of the first row isrow1
, Columnc1:a
The value isvalue1
. Columns in hbase are composed of column family prefixes and column names separated by colons.
For example, the column name of this row isa
.
Check the insert status: scan the table as follows:
Hbase (main): 007: 0> scan 'test'
Install zookeeper
(1) download from http://developer.bjtu.edu.cn/apache/zookeeper/stable.
I downloaded a zookeeper-3.4.4.
(2): Decompress to:/home/Zack/hadoop/zookeeper-3.4.4
(3): Copy zoo_sample.cfg under conf and rename it to: zoo. cfg.
The file content is as follows:
Synclimit = 5
Initlimit = 10
Ticktime = 2000
Clientport = 2181
Datadir =/home/Zack/hadoop/zookeeper/Data
Datalogdir =/home/Zack/hadoop/zookeeper/log
(4): Create the data and log directory under zookeeper, and attach chmod 777-r zookeeper
(5): Add environment variables:
Vim ~ /. Bashrc
Export zookeeper_install =/home/Zack/hadoop/zookeeper-3.4.4.
Export Path = $ path: $ zookeeper_install/bin
Source ~ /. Bashrc to make it take effect.
(6): zkserver. Sh start
For eclipse examples, see:
Http://blog.csdn.net/challenchenzhipeng/article/details/7887109
Note: If you have used eclipse to configure and operate hadoop before, you need to find a new eclipse that has not been configured for hbase programming.