HDFS
wget https://mirror.bit.edu.cn/apache/hadoop/common/hadoop-3.2.1/hadoop-3.2.1.tar.gz
tar xf hadoop-3.2.1.tar.gz && cd hadoop-3.2.1
vim etc/hadoop/core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
vim etc/hadoop/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
./bin/hdfs namenode -format
./sbin/start-dfs.sh
jps
# 26369 DataNode
# 26260 NameNode
# 26541 SecondaryNameNode
./bin/hdfs dfs -mkdir /test
./bin/hdfs dfs -ls /
ZooKeeper
wget https://mirror.bit.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.5.8-bin.tar.gz
tar xf apache-zookeeper-3.5.8-bin.tar.gz && cd apache-zookeeper-3.5.8-bin
cp conf/zoo_sample.cfg conf/zoo.cfg
./bin/zkServer.sh start
jps | grep Quorum
# 26788 QuorumPeerMain
HBase
wget https://mirror.bit.edu.cn/apache/hbase/2.2.6/hbase-2.2.6-bin.tar.gz
tar xf hbase-2.2.6-bin.tar.gz && cd hbase-2.2.6
vim conf/hbase-site.xml
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
./bin/start-hbase.sh
jps | grep -e 'HMaster' -e ' HRegionServer'
# 40225 HMaster
# 40288 HRegionServer
./bin/local-master-backup.sh start 2 3 4
jps | grep HMaster
# 40225 HMaster
# 41779 HMaster
# 41688 HMaster
# 41737 HMaster
# cat /tmp/hbase-*-master.pid | xargs kill -9
./bin/local-regionservers.sh start 2 3 4
jps | grep HRegionServer
# 40288 HRegionServer
# 41985 HRegionServer
# 42052 HRegionServer
# 41938 HRegionServer
# ./bin/local-regionservers.sh stop 2 3 4
# HDFS命令行工具
./bin/hdfs dfs -ls /hbase
./bin/hbase shell
# help
# 创建表 并设置表名和列簇名
create 'test', 'cf'
list
put 'test', 'row1', 'cf:a', 'value1'
get 'test', 'row1'
Test
./bin/stop-hbase.sh
cd ..
rm -rf hbase-2.2.6
./bin/start-hbase.sh
./bin/hbase shell
list
get 'test', 'row1'
References
网友评论