需要用到的安装包:
jdk-8u221-linux-x64.tar.gz提取码: tmxp
MySQL-client-5.6.46-1.el7.x86_64.rpm提取码: wedy
MySQL-server-5.6.46-1.el7.x86_64.rpm提取码: 6n7k
hadoop2.6.0提取码: ebui
zookeeper3.4.6提取码: 95ni
hbase1.2.0提取码: nh27
hive1.1.05p8f
注:本文采用复制虚拟机也可重新创建hadoop
vi /etc/hosts
rm -rf /opt/soft/hadoop260/tmp
解压文件
tar -zxvf hadoop-2.6.0-cdh5.14.2 /opt/soft
tar -zxvf hbase-1.2.0-cdh5.14.2 /opt/soft
tar -zxvf hive-1.1.0-cdh5.14.2 /opt/soft
tar -zxvf jdk1.8.0_221 /opt/soft
tar -zxvf zookeeper-3.4.6 /opt/soft
改名
mv hadoop-2.6.0-cdh5.14.2 hadoop260
mv hbase-1.2.0-cdh5.14.2 hbase120
mv hive-1.1.0-cdh5.14.2 hive110
mv jdk1.8.0_221 java8
mv zookeeper-3.4.6 zookeeper
vi /etc/profile
export JAVA_HOME=/opt/soft/java8
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/rt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
export HADOOP_HOME=/opt/soft/hadoop260
export HBASE_HOME=/opt/soft/hbase120
export HIVE_HOME=/opt/soft/hive110
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 HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$HADOOP_HOME/sbin:$HADOOP_HOME/bin:$HBASE_HOME/bin:$HIVE_HOME/bin
source /etc/profile
启动3台虚拟机
修改两台克隆的ip地址并重启网络(更改IPADDR)
vi /etc/sysconfig/network-scripts/ifcfg-ens33
systemctl restart network
hostnamectl set-hostname hadoop102
hostnamectl set-hostname hadoop103
hostname
或
vi /etc/hostname
vi /etc/hosts
ssh-keygen -t rsa -P ""
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
ssh-copy-id -i .ssh/id_rsa.pub -p22 root@hadoop102
ssh-copy-id -i .ssh/id_rsa.pub -p22 root@hadoop103
ssh root@hadoop102
ssh root@hadoop103
exit
exit
cd /opt/soft/hadoop260/etc/hadoop
vi hdfs-site.xml
vi slaves
略
方法二:将主机修改好的配置文件复制到其他副机上
scp hdfs-site.xml root@192.168.19.102:/opt/hadoop/etc/hadoop/hdfs-site.xml
scp hdfs-site.xml root@192.168.19.103:/opt/hadoop/etc/hadoop/hdfs-site.xml
scp slaves root@192.168.19.102:/opt/hadoop/etc/hadoop/slaves
scp slaves root@192.168.19.103:/opt/hadoop/etc/hadoop/slaves
hadoop namenode -format
start-all.sh
stop-all.sh
注:最少3台虚拟机,并且数量是奇数,时区必须同步
在Hadoop包解压完成
cd /opt/soft/zookeeper/conf/
vi zoo_sample.cfg
# The number of milliseconds of each tick
tickTime=2000
#最大节点行数不限
maxClientCnxns=0
# The number of ticks that the initial
# synchronization phase can take
#初始化最小进程数
initLimit=50
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
#数据目录
dataDir=/opt/soft/zookeeper/zkData
# the port at which the clients will connect
clientPort=2181
#配置server
server.1=hadoop101:2888:3888
server.2=hadoop102:2888:3888
server.3=hadoop103:2888:3888
mv zoo_sample.cfg zoo.cfg
scp zoo.cfg root@hadoop102:/opt/zookeeper/conf/
scp zoo.cfg root@hadoop103:/opt/zookeeper/conf/
mkdir /opt/soft/zookeeper/zkData
echo "1" > mkdir /opt/soft/zookeeper/zkData/myid
./bin/zkServer.sh start
tail zookeeper.out
注:hbase包解压完成,环境变量HBASE_HOME和PATH添加完成
cd /opt/hbase/conf/
vi hbase-site.xml
hbase.rootdir</name>
hdfs://hadoop101:9000/hbase</value>
The directory shared by region servers.</description>
</property>
hbase.cluster.distributed</name>
true</value>
</property>
hbase.master.port</name>
60000</value>
</property>
hbase.zookeeper.quorum</name>
hadoop101,hadoop102,hadoop103</value>
</property>
hbase.regionserver.handler.count</name>
300</value>
</property>
hbase.hstore.blockingStoreFiles</name>
70</value>
</property>
zookeeper.session.timeout</name>
60000</value>
</property>
hbase.regionserver.restart.on.zk.expire</name>
true</value>
Zookeeper session expired will force regionserver exit.
Enable this will make the regionserver restart.
</description>
</property>
hbase.replication</name>
false</value>
</property>
hfile.block.cache.size</name>
0.4</value>
</property>
hbase.regionserver.global.memstore.upperLimit</name>
0.35</value>
</property>
hbase.hregion.memstore.block.multiplier</name>
8</value>
</property>
hbase.server.thread.wakefrequency</name>
100</value>
</property>
hbase.master.distributed.log.splitting</name>
false</value>
</property>
hbase.regionserver.hlog.splitlog.writer.threads</name>
3</value>
</property>
hbase.hstore.blockingStoreFiles</name>
20</value>
</property>
hbase.hregion.memstore.flush.size</name>
134217728</value>
</property>
hbase.hregion.memstore.mslab.enabled</name>
true</value>
</property>
</configuration>
vi hbase-env.sh
#28行
export JAVA_HOME=/opt/java8
#31行位置为hadoop配置文件位置
export HBASE_CLASSPATH=/opt/hadoop/etc/hadoop 31行hadoop配置文件位置
#34行
export HBASE_HEAPSIZE=4000
# 37释放
export HBASE_OFFHEAPSIZE=1G
#44行添加
export HBASE_OPTS="-Xmx4g -Xms4g -Xmn128m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-$(hostname)-hbase.log"
#121释放
export HBASE_PID_DIR=/var/hadoop/pids
#130行
export HBASE_MANAGES_ZK=false
vi log4j.properties
#18行改为警告级以上
hbase.root.logger=WARN,console
#94行
log4j.logger.org.apache.hadoop.hbase=WARN
vi regionservers
hadoop101
hadoop102
hadoop103
scp hbase-site.xml root@hadoop102:/opt/hbase/conf/hbase-site.xml
scp hbase-site.xml root@hadoop103:/opt/hbase/conf/hbase-site.xml
scp hbase-env.sh root@hadoop102:/opt/hbase/conf/hbase-env.sh
scp hbase-env.sh root@hadoop103:/opt/hbase/conf/hbase-env.sh
scp log4j.properties root@hadoop102:/opt/hbase/conf/log4j.properties
scp log4j.properties root@hadoop103:/opt/hbase/conf/log4j.properties
scp regionservers root@hadoop102:/opt/hbase/conf/regionservers
scp regionservers root@hadoop103:/opt/hbase/conf/regionservers
./bin/start-hbase.sh
hbase shell
./bin/stop-hbase.sh
注:与mysql语句差不多,hive主要是用来查询比较方便
rpm -qa | grep mariadb
rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps
cd /opt
yum install -y net-tools
yum install -y perl
yum install -y autoconf
rpm -ivh MySQL-client-5.6.46-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.46-1.el7.x86_64.rpm
vi /usr/my.cnf
[client]
default-character-set = utf8
[mysqld]
skip-grant-tables
character_set_server = utf8
collation_server = utf8_general_ci
lower_case_table_names
service mysql start
update user set password=password('ok');
#创建一个bigdata用户
mysql> create user 'bigdata'@'hadoop101' IDENTIFIED BY 'ok';
#创建hive_metedata库
mysql> create database hive_metedata;
#给予权限
mysql> grant all privileges on *.* to 'bigdata'@'hadoop101';
#flush及时生效
mysql> flush privileges;
注:hive包解压完成,环境变量HIVE_HOME和PATH添加完成
cd /opt/soft/hive110
mv conf/hive-env.sh.template conf/hive-env.sh
vi conf/hive-env.sh
#49行
export HADOOP_HOME=/opt/soft/hadoop260
#52行
export HIVE_CONF_DIR=/opt/soft/hive110/conf
#56行
export HIVE_AUX_JARS_PATH=/opt/soft/hive110/lib
#57行
export JAVA_HOME=/opt/java8
vi hive-site.xml
"1.0" encoding="UTF-8" standalone="no"?>
-stylesheet type="text/xsl" href="configuration.xsl"?>
hive.metastore.warehouse.dir</name>
/opt/soft/hive110/warehouse</value>
</property>
hive.metastore.local</name>
true</value>
</property>
<!-- 如果是远程mysql数据库的话需要在这里写入远程的IP或hosts -->
javax.jdo.option.ConnectionURL</name>
jdbc:mysql://127.0.0.1:3306/hive_metadata?createDatabaseIfNotExist=true</value>
</property>
javax.jdo.option.ConnectionDriverName</name>
com.mysql.jdbc.Driver</value>
</property>
javax.jdo.option.ConnectionUserName</name>
root</value>
</property>
javax.jdo.option.ConnectionPassword</name>
ok</value>
</property>
</configuration>
mv /opt/mysql-connector-java-5.1.48-bin.jar /opt/soft/hive110/lib/
hadoop fs -mkdir -p /opt/soft/hive110/warehouse
hadoop fs -chmod -R 777 /opt/soft/hive110/
schematool -dbType mysql -initSchema
# nohup hive --service metastore &
# hive
nohup hive --service hiveserver2 &
#或直接命令
#hiveservice2
start-all.sh
./bin/zkServer.sh start-------------------zookeeper目录下启动
service mysql start
Hive
注:hadoop安装与配置