hadoop hbase hive 集群安装

阅读更多
一:卸载redhat操作系统默认jdk
1:查找安装默认安装jdk
   rpm -qa | grep java
2:删除jdk
   rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.21.b17.el6.x86_64

二:安装oracle jdk
1:使用root账号安装
2:创建目录:/usr/java
3:下载jdk存放到/usr/java目录:jdk-6u33-linux-x64.bin
4:给安装文件添加执行权限:
   chmod +x jdk-6u43-linux-x64.bin
5:执行jdk安装包
   ./jdk-6u43-linux-x64.bin
6:在/etc/profile文件中添加环境变量
export JAVA_HOME=/usr/java/jdk1.6.0_43
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin

7:配置生效,执行下面命令
source /etc/profile

三:主机分配,在每一个机器的的/etc/hosts文件中添加下面四行内容
192.168.205.23 inm1
192.168.205.24 inm2
192.168.205.25 inm3
192.168.205.26 inm4
192.168.205.27 inm5
192.168.205.28 inm6
192.168.205.29 inm7
192.168.205.30 inm8
192.168.205.31 inm9
192.168.205.32 inm10


四:关闭所有机器防火墙
chkconfig iptables off
service iptables stop

五:在每台机器上创建hadoop用户组合hadoop用户
1:创建用户组:groupadd hadoop
2:创建用户:useradd -g hadoop hadoop
3:修改密码:passwd hadoop

六:在master.hadoop机器上配置SSH
[hadoop@master ~]$ ssh-keygen -t rsa -P ""
   Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): /home/hadoop/.ssh/id_rsa
[hadoop@master ~]cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
[hadoop@master ~]chmod 700 ~/.ssh/
[hadoop@master ~]chmod 600 ~/.ssh/authorized_key
验证
[hadoop@master ~]ssh localhost
[hadoop@master ~]ssh inm1
复制ssh配置到其它机器
[hadoop@master ~]ssh-copy-id -i $HOME/.ssh/id_rsa.pub hadoop@inm2
[hadoop@master ~]ssh-copy-id -i $HOME/.ssh/id_rsa.pub hadoop@inm3


七:zookeeper三节点集群安装
1:使用三台服务器安装zookeeper,安装在hadoop用户上
   192.168.205.24、192.168.205.25、192.168.205.26
2:使用cloudera版本zookeeper:zookeeper-3.4.5-cdh4.2.0.tar.gz
3:解压并修改目录名称
   tar -zxf zookeeper-3.4.5-cdh4.2.0.tar.gz
   mv zookeeper-3.4.5-cdh4.2.0/ zookeeper
4:配置zookeeper,在conf目录下创建zoo.cfg文件,添加文件内容
  tickTime=2000  
   initLimit=5   
   syncLimit=2   
   dataDir=/homt/hadoop/storage/zookeeper/data
   dataLogDir=/homt/hadoop/storage/zookeeper/logs   
   clientPort=2181 
   server.1=inm2:2888:3888   
   server.2=inm3:2888:3888  

   server.3=inm4:2888:3888
5:创建zookeeper的数据文件和日志存放目录
   /home/hadoop/storage/zookeeper/data
   /home/hadoop/storage/zookeeper/logs
   在/home/hadoop/storage/zookeeper/data目录中创建文件myid,添加内容为:1
6:复制安装的zookeeper和storage目录到inm3和inm4机器上。
   scp -r zookeeper inm4:/home/hadoop
   scp -r storage inm4:/home/hadoop
   修改inm3机器上myid文件中值为2
   修改inm3机器上myid文件中值为3
7:启动服务器
   ./bin/zkServer.sh start
8:验证安装
   ./bin/zkCli.sh -server inm3:2181 

八:安装hadoop-2.0.0-cdh4.2.0
用户hadoop账号进入系统
1:解压tar -xvzf hadoop-2.0.0-cdh4.2.0.tar.gz ,修改目录名称:mv hadoop-2.0.0-cdh4.2.0 hadoop
2:配置Hadoop环境变量:修改vi ~/.bashrc,在文件最后面加上如下配置:
export HADOOP_HOME=/home/hadoop/hadoop
export HIVE_HOME=/home/hadoop/hive
export HBASE_HOME=/home/hadoop/hbase

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_YARN_HOME=${HADOOP_HOME}
export HADOOP_CONF_DIR=${HADOOP_HOME}/etc/hadoop
export HDFS_CONF_DIR=${HADOOP_HOME}/etc/hadoop
export YARN_CONF_DIR=${HADOOP_HOME}/etc/hadoop

export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HBASE_HOME/bin:$HIVE_HOME/bin

3:使配置生效
   source .bashrc
4:修改HADOOP_HOME/etc/hadoop目录下mastes和slaves文件
   masters文件内容:
   inm1
   slaves文件内容:
   inm2
   inm3
   inm4
5:修改HADOOP_HOME/etc/hadoop/core-site.xml文件配置

  
    fs.defaultFS
    hdfs://inm1:9000
  
  
  
    io.file.buffer.size
    131072
    Size of read/write buffer used in SequenceFiles.
  
  
  
    io.native.lib.available
    true
  

6:修改HADOOP_HOME/etc/hadoop/hdfs-site.xml文件配置

  
      dfs.replication
      3
  
  
      hadoop.tmp.dir
      /home/hadoop/storage/hadoop/tmp
  
  
		dfs.name.dir
		/home/hadoop/storage/hadoop/name
	
	
		dfs.data.dir
		/home/hadoop/storage/hadoop/data
	
  
		dfs.block.size
		67108864
		HDFS blocksize of 64MB for large file-systems.
	
  
      dfs.namenode.http-address
      inm1:50070
  
  
      dfs.webhdfs.enabled
      true
  

7:修改HADOOP_HOME/etc/hadoop/mapred-site.xml文件配置

  
    mapreduce.framework.name
    yarn
  

  
    mapreduce.jobhistory.address
    inm1:10020
  

  
    mapreduce.jobhistory.webapp.address
    inm1:19888
  

8:修改HADOOP_HOME/etc/hadoop/yarn-site.xml文件配置

  
    yarn.resourcemanager.resource-tracker.address
    inm1:8031
  
  
    yarn.resourcemanager.address
    inm1:8032
  
  
    yarn.resourcemanager.scheduler.address
    inm1:8030
  
  
    yarn.resourcemanager.admin.address
    inm1:8033
  
  
     yarn.resourcemanager.webapp.address
     inm1:8088
   
   
      Classpath for typical applications.
      yarn.application.classpath
      $HADOOP_CONF_DIR,$HADOOP_COMMON_HOME/share/hadoop/common/*,
          $HADOOP_COMMON_HOME/share/hadoop/common/lib/*,
          $HADOOP_HDFS_HOME/share/hadoop/hdfs/*,$HADOOP_HDFS_HOME/share/hadoop/hdfs/lib/*,
          $YARN_HOME/share/hadoop/yarn/*,$YARN_HOME/share/hadoop/yarn/lib/*,
          $YARN_HOME/share/hadoop/mapreduce/*,$YARN_HOME/share/hadoop/mapreduce/lib/*
    
    
      yarn.nodemanager.aux-services
      mapreduce.shuffle
   
   
      yarn.nodemanager.aux-services.mapreduce.shuffle.class
      org.apache.hadoop.mapred.ShuffleHandler
   

  
      yarn.nodemanager.local-dirs
      /home/hadoop/storage/yarn/local
   
   
      yarn.nodemanager.log-dirs
      /home/hadoop/storage/yarn/logs
   
   
      Where to aggregate logs
      yarn.nodemanager.remote-app-log-dir
      /home/hadoop/storage/yarn/logs
   

  
      yarn.app.mapreduce.am.staging-dir
      /user
  

9:同步hadoop工程到inm2,inm3,inm4机器上面
scp -r hadoop inm2:/home/hadoop
scp -r hadoop inm2:/home/hadoop
scp -r hadoop inm2:/home/hadoop

10:格式文件系统
hadoop namenode -format

11:启动hdfs和yarn,启动脚本在HADOOP_HOME/sbin目录中
./start-hdfs.sh
./start-yarn.sh

八:安装hbase-0.94.2-cdh4.2.0
1:解压tar -xvzf hbase-0.94.2-cdh4.2.0.tar.gz ,修改目录名称:mv hbase-0.94.2-cdh4.2.0.tar.gz hbase
2:修改HBASE_HOME/conf/regionservers文件,添加运行HRegionServer进程的机器名称。
  
inm2
   inm3
   inm4

3:修改HBASE_HOME/conf/hbase-site.xml文件

  
    hbase.rootdir
    hdfs://inm1/hbase
  
  
    hbase.cluster.distributed
    true
  
  
  
    hbase.tmp.dir
    /home/hadoop/storage/hbase
  
  
  
    hbase.zookeeper.quorum
    inm2,inm3,inm4
  

4:同步hbase工程到inm2,inm3,inm4机器上面
scp -r hbase inm2:/home/hadoop
scp -r hbase inm2:/home/hadoop
scp -r hbase inm2:/home/hadoop

5:在inm1上启动hbase集群
HBASE_HOME/bin/start-hbase.sh

6:执行hbase shell进入hbase console。执行list命令验证安装。

九:安装hive-0.10.0-cdh4.2.0
1:解压tar -xvzf hive-0.10.0-cdh4.2.0.tar.gz ,修改目录名称:mv hive-0.10.0-cdh4.2.0 hive
2:修改HIVE_HOME/conf/hive-site.xml文件



  
    javax.jdo.option.ConnectionURL
    jdbc:mysql://192.168.205.31:3306/hive?useUnicode=true&characterEncoding=UTF-8
    JDBC connect string for a JDBC metastore
  
  
  
    javax.jdo.option.ConnectionDriverName
    com.mysql.jdbc.Driver
    Driver class name for a JDBC metastore
  
  
  
    javax.jdo.option.ConnectionUserName
    hive
    username to use against metastore database
  
  
  
    javax.jdo.option.ConnectionPassword
    hive2013
    password to use against metastore database
  
  
  
   mapred.job.tracker
   inm1:8031
  
  
  
   mapreduce.framework.name
   yarn
  
  
  
    hive.aux.jars.path
    file:///home/hadoop/hive/lib/zookeeper-3.4.5-cdh4.2.0.jar,
      file:///home/hadoop/hive/lib/hive-hbase-handler-0.10.0-cdh4.2.0.jar,
      file:///home/hadoop/hive/lib/hbase-0.94.2-cdh4.2.0.jar,
      file:///home/hadoop/hive/lib/guava-11.0.2.jar
  
  
  
    hive.querylog.location
    /home/hadoop/storage/hive/querylog
    
      Location of Hive run time structured log file
    
  
  
  
    hive.support.concurrency
    Enable Hive's Table Lock Manager Service
    true
  
  
  
    hive.zookeeper.quorum
    Zookeeper quorum used by Hive's Table Lock Manager
    inm2,inm3,inm4
  
  
  
    hive.hwi.listen.host
    inm1
    This is the host address the Hive Web Interface will listen on
  
  
  
    hive.hwi.listen.port
    9999
    This is the port the Hive Web Interface will listen on
  
  
  
    hive.hwi.war.file
    lib/hive-hwi-0.10.0-cdh4.2.0.war
    This is the WAR file with the jsp content for Hive Web Interface
  



3:添加mysql驱动修改HIVE_HOME/lib目录。
4:进入hive console,执行show databases,验证安装是否成功!

你可能感兴趣的:(hadoop hbase hive 集群安装)