欢迎投稿

今日深度:

hive搭建,

hive搭建,


hive搭建

 

 

安装mysql

        

1.在安装mysql之前先删除mariadb

         rpm  -qa  |grep  -i  mariadb             (查看mariadb是否存在)

        rpm  -e  --nodeps  mariadb-libs-5.5.44-2.el7.centos.x86_64             (卸载)

        rpm  -qa  |grep  -i  mysql                  (查看mysql是否存在)

 

2.安装mysql-servre

         rpm  -ivh  MySQL-server-5.5.24-1.rhel5.x86_64.rpm

3.安装mysql-devel

         rpm  -ivh  MySQL-devel-5.5.24-1.rhel5.x86_64.rpm

4.安装mysql-client

         rpm  -ivh  MySQL-client-5.5.24-1.rhel5.x86_64.rpm

5.由于不知道初始密码,所以关闭服务,去掉密码,再开启服务,设置密码。

         systemctl  stop  mysql

         systemctl  set-environment  MYSQLD_OPTS="--skip-grant-tables"

         systemctl  start  mysql

6.无密码状态下登录mysql

         mysql  -u  root

         设置密码

 

7.设置用户名密码这些,并且刷新

 

         update user set authentication_string = password('123456') where user = 'root';

         update mysql.user set password = password('123456') where user = 'root';

         flush privileges;

 

8.将之前改不用密码登陆的设置改回来

 

         systemctl  stop  mysql

         systemctl  unset-environment  MYSQLD_OPTS

         systemctl  start  mysql

 

9.登录试试,登录成功

        

         mysql  -u  root  -p

         密码是:123456

 

 

10.创建一个hive的用户并设置权限

 

         create  user  'hive'@'%'  identified  by  'hive';

         grant  all  privileges  on *.* to  'hive'@'%'  with  grant  option;

         flush  privileges;

 

 

11.退出root用户解压hive

 

         exit

         ls

         cd

         tar  -zxvf  apache-hive-2.3.3-bin.tar.gz

 

12.将名字改为hive-2.3.3(也可以不改)

 

         ls

         mv  apache-hive-2.3.3-bin  hive-2.3.3

 

 

13.修改环境变量

 

         su  root

         vi  /etc/profile

         增加环境变量export  HIVE_HOME=/home/hadoop/hive-2.3.3

         在PATH变量后面增加:$ HIVE_HOME/bin:$ HIVE_HOME/conf

 

 

14.退出root用户,来到conf目录新增hive-site.xml,设置元数据库为mysql和别的配置

 

         cd  conf

         ls

         vi  hive-site.xml

 

<configuration>

        <property>

          <name>hive.metastore.schema.verification</name>

          <value>false</value>

        </property>

         <!--JDBC元数据仓库连接字符串-->

        <property>

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

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

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

        </property>

       <!--JDBC元数据仓库驱动类名-->

                 <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>123456</value>

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

        </property>

        <property>

          <name>datanucleus.readOnlyDatastore</name>

          <value>false</value>

        </property>

        <property>

          <name>datanucleus.fixedDatastore</name>

          <value>false</value>

        </property>

        <property>

          <name>datanucleus.autoCreateSchema</name>

          <value>true</value>

        </property>

        <property>

          <name>datanucleus.autoCreateTables</name>

          <value>true</value>

        </property>

        <property>

          <name>datanucleus.autoCreateColumns</name>

          <value>true</value>

        </property>

        <property>

          <name>hive.exec.local.scratchdir</name>

          <value>/home/hadoop/hive-2.3.3/iotmp</value>

          <description>Local scratch space for Hive jobs</description>

        </property>

         <property>

          <name>hive.querylog.location</name>

          <value>/home/hadoop/hive-2.3.3/iotmp/</value>

          <description>Location of Hive run time structured log file</description>

        </property>

        <property>

          <name>hive.downloaded.resources.dir</name>

          <value>/home/hadoop/hive-2.3.3/iotmp/</value>

          <description>Temporary local directory for added resources in the remote file system.</description>

        </property>

</configuration>

 

 

 

15.启动hive的metastore

 

         ./bin/hive --service metastore &

 

16.启动hive的jdbc等服务程序,提供jdbc,beeline远端连接服务

 

         ./bin/hive --service hiveserver2&

 

如果有两个RunJar那么就启动成功了

 

 

17.启动hive

 

         现在我使用hive

方式一:(平常使用)

         hive

 

方式二:(常用来寻找错误)

         hive  -hiveconf  hive.root.logger=DEBUG,console(启动这个可以打印出各种log)

 

18.测试(查看表并创建一个表)

 

         show  tables;

         create  table  t1(id  string);

         show  tables;

 

编码问题:

         alter database hive character set latin1;

 

www.htsjk.Com true http://www.htsjk.com/mariadb/33780.html NewsArticle hive搭建, hive搭建     安装mysql          1.在安装mysql之前先删除mariadb          rpm  -qa  |grep  -i  mariadb             (查看mariadb是否存在)         rpm  -e  --nodeps  m...
相关文章
    暂无相关文章
评论暂时关闭