• Hive 安装配置


    记录个 hive 的安装配置流程

    下载解压

    安装版本:apache-hive-3.1.2-bin.tar.gz

    $ tar xzvf apache-hive-3.1.2-bin.tar.gz -C /home/hadoop/local/

    $ cd /home/hadoop/local/

    $ ln -s apache-hive-3.1.2-bin hive

    添加环境变量

    $ vim /etc/profile.d/my_env.sh

    1. HIVE_HOME=/home/hadoop/local/hive
    2. PATH=$PATH:$HIVE_HOME/bin
    3. export HIVE_HOME PATH

    $ source /etc/profile

    解决日志 Jar 包冲突

    $ cd /home/hadoop/local/hive/lib

    $ rm -rf log4j-slf4j-impl-2.10.0.jar

    拷贝 MySQL 驱动包

    $ cp mysql-connector-java-8.0.11.jar /home/hadoop/local/hive/lib/

    配置

    $ vim conf/hive-site.xml

    1. "1.0"?>
    2. "text/xsl" href="configuration.xsl"?>
    3. <configuration>
    4. <property>
    5. <name>javax.jdo.option.ConnectionURLname>
    6. <value>jdbc:mysql://ns1:3306/metastore?useSSL=falsevalue>
    7. property>
    8. <property>
    9. <name>javax.jdo.option.ConnectionDriverNamename>
    10. <value>com.mysql.cj.jdbc.Drivervalue>
    11. property>
    12. <property>
    13. <name>javax.jdo.option.ConnectionUserNamename>
    14. <value>rootvalue>
    15. property>
    16. <property>
    17. <name>javax.jdo.option.ConnectionPasswordname>
    18. <value>123456value>
    19. property>
    20. <property>
    21. <name>hive.metastore.warehouse.dirname>
    22. <value>/user/hive/warehousevalue>
    23. property>
    24. <property>
    25. <name>hive.metastore.schema.verificationname>
    26. <value>falsevalue>
    27. property>
    28. <property>
    29. <name>hive.server2.thrift.portname>
    30. <value>10000value>
    31. property>
    32. <property>
    33. <name>hive.server2.thrift.bind.hostname>
    34. <value>ns1value>
    35. property>
    36. <property>
    37. <name>hive.metastore.event.db.notification.api.authname>
    38. <value>falsevalue>
    39. property>
    40. <property>
    41. <name>hive.cli.print.headername>
    42. <value>truevalue>
    43. property>
    44. <property>
    45. <name>hive.cli.print.current.dbname>
    46. <value>truevalue>
    47. property>
    48. configuration>

    修改日志存放路径

    $ cd /home/hadoop/local/hive/conf/

    $ mv hive-log4j2.properties.template hive-log4j2.properties

    $ vim hive-log4j2.properties

    修改日志存放路径配置:

    property.hive.log.dir = /home/hadoop/local/hive/logs

    初始化元数据库

    创建数据库:

    mysql> create database metastore;

    初始化:

    $ cd /home/hadoop/local/hive/bin/

    $ schematool -initSchema -dbType mysql -verbose

    初始化后会自动在数据库中创建表:

    1. MySQL [metastore]> show tables;
    2. +-------------------------------+
    3. | Tables_in_metastore |
    4. +-------------------------------+
    5. | AUX_TABLE |
    6. | BUCKETING_COLS |
    7. | CDS |
    8. | COLUMNS_V2 |
    9. | COMPACTION_QUEUE |
    10. | COMPLETED_COMPACTIONS |
    11. | COMPLETED_TXN_COMPONENTS |
    12. | CTLGS |
    13. | DATABASE_PARAMS |
    14. | DBS |
    15. | DB_PRIVS |
    16. | DELEGATION_TOKENS |
    17. | FUNCS |
    18. | FUNC_RU |
    19. | GLOBAL_PRIVS |
    20. | HIVE_LOCKS |
    21. | IDXS |
    22. | INDEX_PARAMS |
    23. | I_SCHEMA |
    24. | KEY_CONSTRAINTS |
    25. | MASTER_KEYS |
    26. | MATERIALIZATION_REBUILD_LOCKS |
    27. | METASTORE_DB_PROPERTIES |
    28. | MIN_HISTORY_LEVEL |
    29. | MV_CREATION_METADATA |
    30. | MV_TABLES_USED |
    31. | NEXT_COMPACTION_QUEUE_ID |
    32. | NEXT_LOCK_ID |
    33. | NEXT_TXN_ID |
    34. | NEXT_WRITE_ID |
    35. | NOTIFICATION_LOG |
    36. | NOTIFICATION_SEQUENCE |
    37. | NUCLEUS_TABLES |
    38. | PARTITIONS |
    39. | PARTITION_EVENTS |
    40. | PARTITION_KEYS |
    41. | PARTITION_KEY_VALS |
    42. | PARTITION_PARAMS |
    43. | PART_COL_PRIVS |
    44. | PART_COL_STATS |
    45. | PART_PRIVS |
    46. | REPL_TXN_MAP |
    47. | ROLES |
    48. | ROLE_MAP |
    49. | RUNTIME_STATS |
    50. | SCHEMA_VERSION |
    51. | SDS |
    52. | SD_PARAMS |
    53. | SEQUENCE_TABLE |
    54. | SERDES |
    55. | SERDE_PARAMS |
    56. | SKEWED_COL_NAMES |
    57. | SKEWED_COL_VALUE_LOC_MAP |
    58. | SKEWED_STRING_LIST |
    59. | SKEWED_STRING_LIST_VALUES |
    60. | SKEWED_VALUES |
    61. | SORT_COLS |
    62. | TABLE_PARAMS |
    63. | TAB_COL_STATS |
    64. | TBLS |
    65. | TBL_COL_PRIVS |
    66. | TBL_PRIVS |
    67. | TXNS |
    68. | TXN_COMPONENTS |
    69. | TXN_TO_WRITE_ID |
    70. | TYPES |
    71. | TYPE_FIELDS |
    72. | VERSION |
    73. | WM_MAPPING |
    74. | WM_POOL |
    75. | WM_POOL_TO_TRIGGER |
    76. | WM_RESOURCEPLAN |
    77. | WM_TRIGGER |
    78. | WRITE_SET |
    79. +-------------------------------+
    80. 74 rows in set (0.00 sec)

    启动 hive 客户端

    $ hive

    hive(default)> show databases;

    1. OK
    2. database_name
    3. default
    4. Time taken: 0.712 seconds, Fetched: 1 row(s)

  • 相关阅读:
    挑选适合您的优秀项目管理软件
    下载bigemap建筑物轮廓在arcscene如何生成模型
    Ubuntu18.04 velodyne 运行loam_velodyne
    【机器学习项目实战10例】(二):利用LightGBM实现天气变化的时间序列预测
    Android Studio Koala | 2024.1.1 发布,快来看看有什么更新吧
    描述Java中的备忘录模式。
    大语言模型LLM推理加速:Hugging Face Transformers优化LLM推理技术(LLM系列12)
    【工具篇】SQLite本地数据库在Unity3D的应用
    气球派对服务小程序商城的效果是什么
    【算法优选】 滑动窗口专题——贰
  • 原文地址:https://blog.csdn.net/zhy0414/article/details/126777784