版本 |
---|
jdk-8u211-linux-x64 |
apache-phoenix-5.0.0-HBase-2.0-bin |
apache-zookeeper-3.5.5-bin |
hadoop-3.1.2 |
hbase-2.0.5 |
spark-2.3.3-bin-hadoop2.7 |
vim /etc/hostname
vim /etc/hosts
sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
vim /etc/selinux/config
将SELinux status参数设定为关闭状态
SELinux status: disabled
解压后放至:/usr/local/java/jdk1.8.0_211
vim /etc/profile
将java目录添加进环境
#java 1.8
JAVA_HOME=/usr/local/java/jdk1.8.0_211
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
useradd -m hadoop
passwd hadoop #123456(忽略警告)
usermod -a -G hadoop hadoop # 将hadoop用户移进hadoop用户组
cat /etc/group #查看用户组
vi /etc/sudoers
##在行 root ALL=(ALL) ALL下添加
%hadoop ALL=(ALL) ALL
hadoop ALL=(ALL) ALL
su hadoop
生成rsa密钥
ssh-keygen -t rsa
将生成的rsa追加写入授权文件
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
给授权文件权限
chmod 600 ~/.ssh/authorized_keys
对本机ssh测试(第一次需要密码)
ssh master
在目录/home/hadoop/hadoop-3.1.2/etc/hadoop
下:
fs.defaultFS
hdfs://master:9000/
hadoop.tmp.dir
/home/hadoop/hadoop-3.1.2/tmp
ha.zookeeper.quorum
master:2181
添加pid文件生成路径
export HADOOP_PID_DIR=/home/hadoop/hadoop-3.1.2/tmp/pid
<configuration>
<property>
<name>dfs.namenode.name.dirname>
<value>/home/hadoop/hadoop-3.1.2/namenodevalue>
property>
<property>
<name>dfs.datanode.data.dirname>
<value>/home/hadoop/hadoop-3.1.2/datanodevalue>
property>
<property>
<name>dfs.replicationname>
<value>1value>
property>
configuration>
mapreduce.framework.name
yarn
yarn.app.mapreduce.am.env
HADOOP_MAPRED_HOME=/home/hadoop/hadoop-3.1.2
mapreduce.map.env
HADOOP_MAPRED_HOME=/home/hadoop/hadoop-3.1.2
mapreduce.reduce.env
HADOOP_MAPRED_HOME=/home/hadoop/hadoop-3.1.2
<configuration>
<property>
<name>yarn.resourcemanager.hostnamename>
<value>mastervalue>
property>
<property>
<name>yarn.nodemanager.aux-servicesname>
<value>mapreduce_shufflevalue>
property>
<property>
<name>yarn.resourcemanager.zk-addressname>
<value>master:2181value>
property>
configuration>
修改为:
master
这两个文件在hadoop-3.1.2/sbin/中,分别在 start-dfs.sh 和 stop-dfs.sh中添加如下内容
HDFS_JOURNALNODE_USER=root
HDFS_ZKFC_USER=hadoop
HDFS_DATANODE_USER=hadoop
HDFS_DATANODE_SECURE_USER=hdfs
HDFS_NAMENODE_USER=hadoop
HDFS_SECONDARYNAMENODE_USER=hadoop
这两个文件在 hadoop-3.1.2/sbin/ 中,分别在 start-yarn.sh 和 stop-yarn.sh 中添加如下内容
YARN_RESOURCEMANAGER_USER=hadoop
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=hadoop
$ vim ~/.bashrc
#java 1.8
JAVA_HOME=/usr/local/java/jdk1.8.0_211
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
export HADOOP_HOME=/home/hadoop/hadoop-3.1.2
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
更新环境变量:source ~/.bashrc
编辑环境变量:vi ~/.bashrc
,添加下面的内容
#zookeeper
export ZOOKEEPER_HOME=/home/hadoop/apache-zookeeper-3.5.5-bin
export PATH=.:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$JAVA_HOME/bin:$PATH
更新环境变量:source ~/.bashrc
需要将 $ZOOKEEPER_HOME/conf
目录下的zoo_sample.cfg
重命名为 zoo.cfg
cp $ZOOKEEPER_HOME/conf/zoo_sample.cfg $ZOOKEEPER_HOME/conf/zoo.cfg
在zoo.cf里注释dataDir并添加:
dataDir=/home/hadoop/apache-zookeeper-3.5.5-bin/data
dataLogDir=/home/hadoop/apache-zookeeper-3.5.5-bin/logs
master.1=master:2888:3888
zookeeper目录下创建data文件夹,并生成myid在data文件夹中
mkdir data
cd data
echo “1” > myid
vi ~/.bashrc
添加
export HBASE_HOME=/home/hadoop/hbase-2.0.5
export PATH=$HBASE_HOME/bin:$PATH
更新变量
source ~/.bashrc
修改 hbase-2.0.5conf目录下的hbase-env.sh文件
export JAVA_HOME=/usr/local/java/jdk1.8.0_211
export HBASE_MANAGES_ZK=false
其中HBASE_MANAGES_ZK=false表示我们使用自己安装zookeeper集群而不是hbase自带的zookeeper集群
修改hbase-2.0.5/conf目录下的hbase-site.xml文件
hbase.rootdir
hdfs://master:9000/hbase
hbase.cluster.distributed
true
hbase.zookeeper.quorum
master
hbase.zookeeper.property.dataDir
/home/hadoop/apache-zookeeper-3.5.5-bin/data
hbase.unsafe.stream.capability.enforce
false
修改hbase-2.0.5/conf目录下的regionservers
vim regionservers
将localhost删除,修改为附节点(注意一个节点占一行)
master
jar包就在phoenix目录下
cp phoenix-core-5.0.0-HBase-2.0.jar phoenix-5.0.0-HBase-2.0-server.jar /home/hadoop/hbase-2.0.5/lib/
hbase-site.xml
到phoenix安装目录下的bin中:cp hbase-site.xml /home/hadoop/apache-phoenix-5.0.0-HBase-2.0-bin/bin/
cp core-site.xml hdfs-site.xml /home/hadoop/apache-phoenix-5.0.0-HBase-2.0-bin/bin/
vim ~/.bashrc
添加
#phoenix
export PHOENIX_HOME=/home/hadoop/apache-phoenix-5.0.0-HBase-2.0-bin
export PHOENIX_CLASSPATH=$PHOENIX_HOME
export PATH=$PATH:$PHOENIX_HOME/bin
在/home/hadoop/apache-phoenix-5.0.0-HBase-2.0-bin/bin目录下:
chmod 777 psql.py
chmod 777 sqlline.py
#spark
export SPARK_HOME=/home/hadoop/spark-2.3.3-bin-hadoop2.7
export SPARK_CLASSPATH=$SPARK_HOME
export PATH=$PATH:$SPARK_HOME/bin
在安装目录下的conf文件夹中
将spark-env.sh.template修改为spark-env.sh,并编辑
cp spark-env.sh.template spark-env.sh
vim spark-env.sh
在spark-env.sh中添加(不同的slave中SPARK_LOCAL_IP需要对应的修改):
SPARK_LOCAL_IP=master #本机ip或hostname
SPARK_MASTER_IP=master #master节点ip或hostname
export HADOOP_CONF_DIR=/home/hadoop/hadoop-3.1.2 #hadoop的配置路径
export YARN_CONF_DIR=/home/hadoop/hadoop-3.1.2 #yarn路径配置
将slaves.template修改为slaves,并编辑
cp slaves.template slaves
vim slaves
删除原有的localhost,添加:
master
cd /hadoop-3.1.2/bin
hdfs namenode -format
start-all.sh
(只有一个节点)
zkServer.sh start
start-hbase.sh
cd /home/hadoop/spark-2.3.3-bin-hadoop2.7/sbin
start-all.sh
sqlline.py master:2181
将home/hadoop目录的权限设为hadoop用户
chown -R hadoop:hadoop hadoop
http://IP:9870/
http://IP:16010
http://IP:8080/
#java 1.8
JAVA_HOME=/usr/local/java/jdk1.8.0_211
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
#hadoop
export HADOOP_HOME=/home/hadoop/hadoop-3.1.2
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
#hbase
export HBASE_HOME=/home/hadoop/hbase-2.0.5
export PATH=$HBASE_HOME/bin:$PATH
#zookeeper
export ZOOKEEPER_HOME=/home/hadoop/apache-zookeeper-3.5.5-bin
export PATH=.:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$JAVA_HOME/bin:$PATH
#phoenix
export PHOENIX_HOME=/home/hadoop/apache-phoenix-5.0.0-HBase-2.0-bin
export PHOENIX_CLASSPATH=$PHOENIX_HOME
export PATH=$PATH:$PHOENIX_HOME/bin
#spark
export SPARK_HOME=/home/hadoop/spark-2.3.3-bin-hadoop2.7
export SPARK_CLASSPATH=$SPARK_HOME
export PATH=$PATH:$SPARK_HOME/bin