• Hive安装部署与配置


    Hive安装部署与配置

    1.1 Hive安装地址

    1)Hive官网地址:

    http://hive.apache.org/

    2)文档查看地址:

    https://cwiki.apache.org/confluence/display/Hive/GettingStarted

    3)下载地址:

    http://archive.apache.org/dist/hive/

    4)github地址:

    https://github.com/apache/hive

    1.2 Hive安装部署

    1)Hive安装及配置

    (1)使用rz命令上传

    (2)解压到执行目录

    tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /opt/module/

    (3)修改名称为hive

     mv apache-hive-1.2.1-bin/ hive

    (4)修改/opt/module/hive/conf目录下的hive-env.sh.template名称为hive-env.sh

    mv hive-env.sh.template hive-env.sh

    (5)配置hive-env.sh文件

    (a)配置HADOOP_HOME路径

    export HADOOP_HOME=/opt/module/hadoop-2.8.4

    (b)配置HIVE_CONF_DIR路径

    export HIVE_CONF_DIR=/opt/module/hive/conf

    注:Hive的log默认存放在/tmp/chenchuan/hive.log目录下(当前用户名下)。

    (1)修改hive的log存放日志到/opt/module/hive/logs

    (2)修改conf/hive-log4j.properties.template文件名称为hive-log4j.properties

     pwd /opt/module/hive/conf

     mv hive-log4j.properties.template hive-log4j.properties

    (3)在hive-log4j.properties文件中修改log存放位置

    hive.log.dir=/opt/module/hive/logs

    2)Hadoop集群配置

    (1)必须启动hdfs和yarn

     sbin/start-dfs.sh

     sbin/start-yarn.sh

    (2)在HDFS上创建/tmp和/user/hive/warehouse两个目录并修改他们的同组权限可写

    bin/hadoop fs -mkdir /tmp

     bin/hadoop fs -mkdir -p /user/hive/warehouse

     bin/hadoop fs -chmod g+w /tmp

     bin/hadoop fs -chmod g+w /user/hive/warehouse

    1.3 MySql安装

    官网下载地址

    https://dev.mysql.com/downloads/file/?id=471503

     

     检测本地是否有mysql已存在的包

    rpm -qa | grep mysql

     

     检测本地是否有mariadb已存在的包

    rpm -qa | grep mariadb

     

    如果存在,则使用yum命令卸载

    mariadb-libs-5.5.56-2.el7.x86_64

    yum -y remove mariadb-libs-5.5.56-2.el7.x86_64

    rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

     

    创建一个文件夹,上传jar包到/opt/software/mysql

    mkdir /opt/software/mysql

     

    解压mysql jar包

    tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar -C /opt/module/mysql

     

     安装mysql的 server、client、common、libs、lib-compat

    rpm -ivh --nodeps mysql-community-server-5.7.19-1.el7.x86_64.rpm

    rpm -ivh --nodeps mysql-community-client-5.7.19-1.el7.x86_64.rpm

    rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm

    rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm

    rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm

     

     查看mysql的服务是否启动

    systemctl status mysqld

     Active: inactive (dead)

     

     启动mysql的服务

    systemctl start mysqld

     

    再次检查mysql的服务是否启动

    systemctl status mysqld

       Active: active (running) since Thu 2019-03-21 07:23:08 EDT; 2s ago

     

    查看默认生成的密码

    cat /var/log/mysqld.log | grep password

    2019-03-21T11:23:01.643479Z 1 [Note] A temporary password is generated for root@localhost: iwkJGgd:j6jO

     

    登录mysql服务

    mysql -uroot -p’然后粘贴上密码’

     

    修改mysql密码规则

    0 or LOW

    长度

    1 or MEDIUM

    长度、大小写、数字、特殊字符

    2 or STRONG

    长度、大小写、数字、特殊字符、词典

     

    注:以下修改是临时修改

    a.密码强度检查等级,0/LOW、1/MEDIUM、2/STRONG

    mysql> set global validate_password_policy=0;

    Query OK, 0 rows affected (0.05 sec)

     

    b.密码至少要包含的小写字母个数和大写字母个数

    mysql> set global validate_password_mixed_case_count=0;

    Query OK, 0 rows affected (0.00 sec)

     

    c.密码至少要包含的数字个数 

    mysql> set global validate_password_number_count=3;

    Query OK, 0 rows affected (0.00 sec)

     

    d.密码至少要包含的特殊字符数

    mysql> set global validate_password_special_char_count=0;

    Query OK, 0 rows affected (0.00 sec)

     

    e.密码最小长度,参数默认为8

    它有最小值的限制,最小值为:validate_password_number_count + 密码至少要包含的数字个数validate_password_special_char_count +特殊字符

     (2 * validate_password_mixed_case_count)至少要包含的小写字母个数和大写字母个数

    mysql> set global validate_password_length=3;

    Query OK, 0 rows affected (0.00 sec)

    修改密码:

    alter user root@localhost identified by '000000';

    flush privileges;

    (这两步可以跳过)

     mysql> use mysql;

    mysql> SHOW VARIABLES LIKE 'validate_password%';

    +--------------------------------------+-------+

    | Variable_name                        | Value |

    +--------------------------------------+-------+

    | validate_password_dictionary_file    |       |

    | validate_password_length             | 3     |

    | validate_password_mixed_case_count   | 0     |

    | validate_password_number_count       | 3     |

    | validate_password_policy             | LOW   |

    | validate_password_special_char_count | 0     |

    +--------------------------------------+-------+

     修改远程登录权限

    大家默认的%的位置是localhost,即意味着只能本机访问

     

    查询当前user表内root的登录权限:

    select host,user from mysql.user;

    修改权限为所有%:

    update mysql.user set host = '%' where user = 'root';

    刷新缓存:

    flush privileges;

    1.4 Hive元数据配置到MySql

    1.4.1 驱动拷贝

    1)上传mysql-connector-java-5.1.27-bin.jar到/opt/module/hive/lib/

    cp mysql-connector-java-5.1.27-bin.jar /opt/module/hive/lib/

    1.4.2 配置MetastoreMySql

    1)在/opt/module/hive/conf目录下创建一个hive-site.xml

     touch /opt/module/hive/conf/hive-site.xml

    2)根据官方文档配置参数,拷贝数据到hive-site.xml文件中。

    https://cwiki.apache.org/confluence/display/Hive/AdminManual+MetastoreAdmin

     

    <?xml version="1.0"?>

    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

    <configuration>

            <property>

              <name>javax.jdo.option.ConnectionURL</name>

              <value>jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=true</value>

              <description>JDBC connect string for a JDBC metastore</description>

            </property>

            <property>

              <name>javax.jdo.option.ConnectionDriverName</name>

              <value>com.mysql.jdbc.Driver</value>

              <description>Driver class name for a JDBC metastore</description>

            </property>

            <property>

              <name>javax.jdo.option.ConnectionUserName</name>

              <value>root</value>

              <description>username to use against metastore database</description>

            </property>

            <property>

              <name>javax.jdo.option.ConnectionPassword</name>

              <value>000000</value>

              <description>password to use against metastore database</description>

            </property>

            <property>

                    <name>hive.metastore.warehouse.dir</name>

                    <value>/user/hive/warehouse</value>

                    <description>location of default database for the warehouse</description>

            </property>

            <property>

                    <name>hive.cli.print.header</name>

                    <value>true</value>

            </property>

            <property>

                    <name>hive.cli.print.current.db</name>

                    <value>true</value>

            </property>

    </configuration>

     

    3) 配置完毕后,如果启动hive异常,可以重新启动虚拟机。(重启后,别忘了启动hadoop集群)

    4) 在hive的bin目录下执行./schematool -dbType mysql -initSchema 

  • 相关阅读:
    JAVA 网格布局管理器
    JAVA 流式布局管理器
    JAVA 边界布局管理器
    JAVA 图形界面 JFrame容器
    MySQL联合查询语法内联、左联、右联、全联
    ASP.NET MVC URL重写与优化(进阶篇)-继承RouteBase玩转URL
    ASP.NET MVC URL重写与优化(初级篇)-使用Global路由表定制URL
    MVC过滤器详解
    Dapper的基本使用
    JQuery fullcalender文档
  • 原文地址:https://www.cnblogs.com/zhangchenchuan/p/11969909.html
Copyright © 2020-2023  润新知