一.修改主机名
vim /etc/hosts
修改主机名为hadoop-standalone //主机名可以自定义
yum -y install net-tools ntp lrzsz vim
二.配置环境变量:
vim ~/.bashrc
将下面代码复制到里面保存退出
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0
export PATH= P A T H : PATH: PATH:JAVA_HOME/bin
export CLASSPATH=.: J A V A H O M E / l i b / d t . j a r : JAVA_HOME/lib/dt.jar: JAVAHOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
#zookeeper
export ZOOKEEPER_HOME=$/opt/zookeeper
export PATH= P A T H : PATH: PATH:ZOOKEEPER_HOME/bin
#hadoop
export HADOOP_HOME=/opt/hadoop
export HADOOP_PREFIX=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH= P A T H : PATH: PATH:HADOOP_HOME/bin:$HADOOP_HOME/sbin
export HADOOP_INSTALL=$HADOOP_HOME
#hbase
export HBASE_HOME=/opt/hbase
export PATH= P A T H : PATH: PATH:HBASE_HOME/bin
三.远程授权设置:
RSAAuthentication yes
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
systemctl restart sshd
四.配置zookeeper:
cd /opt/zookeeper/conf/
cp zoo_sample.cfg zoo.cfg
五.Hadoop配置
vim core-site.xml
#core-site.xml
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop/tmp</value>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://hadoop-standalone:8020</value>
</property>
配置hdfs:
vim hdfs-site.xml
#hdfs-site.xml
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///hdfs/name</value>/opt/hadoop/data
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///hdfs/data</value>/opt/hadoop/temp
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
六.Hbase配置
vim hbase-site.xml
#hbsae-site.xml
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://hadoop-standalone:8020/hbase</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop-standalone</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/zookeeper/data</value>
</property>
<property>
<name>hbase.procedure.store.wal.use.hsync</name>
<value>true</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
七.启动服务
启动zookeeper:zkServer.sh start
启动hadoop的dfs:start-dfs.sh
启动hbase:start-hbase.sh
八.验证服务
查看服务是否启动完整:jps
5122 Jps
5028 HRegionServer
4917 HMaster
4183 QuorumPeerMain
4343 NameNode
4472 DataNode
4638 SecondaryNameNode
有以上七个服务表示环境搭建完成
九.验证hbase数据库:(自带的脚本命令)
->hbase shell
->status
显示数据库信息,表示安装完成