HIVE 2.3.4 本地安装与部署 (Ubuntu) (2)

cd /usr/local/hive/bin
schematool -initSchema -dbType mysql
看到 schemaTool completed ,即初始化成功!

5.启动hive及测试 请先确保 hadoop 已正常启动! # 启动hive(由于已配置相关环境变量,直接使用): hive # 启动成功,启动过程提示信息结束后,回显: hive> # 说明已成功启动。同样,注意 ";" 标识一条命令结束! 5.1 测试 hive # 显示数据库: hive> show databases; OK default Time taken: 14.107 seconds, Fetched: 1 row(s) # 创建一个表: hive> create table test1(tid int, tname string); OK Time taken: 5.021 seconds # 显示tables: hive> show tables; OK test1 Time taken: 5.077 seconds, Fetched: 1 row(s) # 删除刚刚创建的表test1: hive> drop table test1; OK Time taken: 5.223 seconds # 重新创建表 test1(用于mysql测试): hive> create table test1(tid int, tname string); OK Time taken: 1.322 seconds # 退出 hive shell hive> exit; 5.2 测试 mysql # hadoop 用户进入mysql mysql -u hadoop -p # 输入密码后,进入mysql shell mysql> # 显示数据库: mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | hive | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.11 sec) # 使用hive数据库 mysql> use hive; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed # 显示我们刚刚创建的表(记录在table TBLS中) mysql> select * from TBLS; +--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+--------------------+ | TBL_ID | CREATE_TIME | DB_ID | LAST_ACCESS_TIME | OWNER | RETENTION | SD_ID | TBL_NAME | TBL_TYPE | VIEW_EXPANDED_TEXT | VIEW_ORIGINAL_TEXT | IS_REWRITE_ENABLED | +--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+--------------------+ | 1 | 1543335170 | 1 | 0 | hadoop | 0 | 1 | test1 | MANAGED_TABLE | NULL | NULL | | +--------+-------------+-------+------------------+--------+-----------+-------+----------+---------------+--------------------+--------------------+--------------------+ 1 row in set (0.00 sec) # 在上面,我们可以看到OWNER:hadoop,TBL_NAME:test1,即我们刚刚创建的表 # 退出: mysql> exit; Bye

到此,我们的配置就大功告成了!
如果想使用远程连接mysql,主要需要修改 hive-site.xml 文件中第一部分 ConnectionURL。

参考博客

感谢这些博主提供的基础步骤和问题解决方案!

https://ywnz.com/linuxysjk/2480.html

https://blog.csdn.net/SCGH_Fx/article/details/65947763

https://blog.csdn.net/u012922838/article/details/73291524

https://blog.csdn.net/u014695188/article/details/54646575

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpfxwg.html