CentOS6.9+Hadoop2.8.1+Hive2.3.0伪分布式配置摘要

一、SSH免密登陆配置
初次登陆记得启动ssh服务

service sshd restart
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh-add ~/.ssh/id_rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
ssh localhost

二、Hadoop文件配置

<!-- core-site.xml -->
<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000/</value>
    </property>
    <property>
        <name>hadoop.tmp.dir</name>
        <value>/home/tagyona/apps/hadoop/tmp</value>
    </property>
</configuration>
<!-- hdfs-site.xml -->
<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
    <property>
        <name>dfs.namenode.name.dir</name>
        <value>/home/tagyona/data/name</value>
    </property>
    <property>
        <name>dfs.namenode.data.dir</name>
        <value>/home/tagyona/data/data</value>
    </property>
    <property>
        <name>dfs.secondary.http.address</name>
        <value>localhost:50090</value>
    </property>
</configuration>
<!-- mapred-site.xml-->
<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
</configuration>
<!-- yarn-site.xml -->
<configuration>
<!-- Site specific YARN configuration properties -->
    <property>
        <name>yarn.resourcemanager.hostname</name>
        <value>localhost</value>
    </property>
    <property>
        <name>yarn.nodemanager.aux-services</name>
        <value>mapreduce_shuffle</value>
    </property>
</configuration>

三、Hive文件配置

<!-- hive-site.xml -->
<configuration>
    <property>
        <name>hive.metastore.warehouse.dir</name>
        <value>/usr/hive/warehouse</value>
    </property>
    <property>
        <name>hive.metastore.local</name>
        <value>true</value>
    </property>
    <property>
         <name>hive.exec.scratchdir</name>
         <value>/tmp/hive</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://localhost/hive?createDatabaseIfNotExist=true</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property> <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>hive</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>hive</value>
    </property>
 </configuration>

 

四、Mysql账户及权限配置

CREATE DATABASE hive;
use hive;
CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';
GRANT ALL on hive.* to 'hive'@'localhost' IDENTIFIED BY 'hive';
GRANT ALL on hive.* to 'hive'@'%' IDENTIFIED BY 'hive';
FLUSH PRIVILEGES;

 

 

 

Hive元数据初始化:

schematool -dbType mysql -initSchema