hive 支持postgresql吗
安装Hive的前提条件是已经部署了Hadoop和PostgreSQL。PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS)
安装步骤
第一步:下载安装包apache-hive-2.3.6-bin.tar.gz并上传到服务器;
第二步:解压缩后,将安装文件拷贝到/usr/local/目录下。
tar xzvf apache-hive-2.3.6-bin.tar.gz mv apache-hive-2.3.6-bin /usr/local/hive
第三步:打开/etc/profile,配置环境变量。
vi /etc/profile
输入以下内容:
export HIVE_HOME=/usr/local/hive export PATH=$HIVE_HOME/bin:$PATH
保存后生效:
source /etc/profile
第四步:配置PostgreSQL作为元数据库
进入/usr/local/hive/conf/目录,执行如下操作
cp hive-default.xml.template hive-site.xml vi hive-site.xml
找到如下内容的name并修改对应的value
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:postgresql://{hostname}:5432/{hivedatabase}?createDatabaseIfNotExist=true</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>org.postgresql.Driver</value> <description>Driver class name for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>{hivepassword}</value> <description>password to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>{hiveusername}</value> <description>Username to use against metastore database</description> </property> <property> <name>hive.metastore.schema.verification</name> <value>false</value> <description> Enforce metastore schema version consistency. True: Verify that version information stored in is compatible with one from Hive jars. Also disable automatic schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures proper metastore schema migration. (Default) False: Warn if the version information stored in metastore doesn't match with one from in Hive jars. </description> </property>
调整临时目录
<property> <name>hive.exec.local.scratchdir</name> <value>/usr/local/hive/tmp</value> <description>Local scratch space for Hive jobs</description> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/usr/local/hive/tmp/resources</value> <description>Temporary local directory for added resources in the remote file system.</description> </property> <property> <name>hive.querylog.location</name> <value>/usr/local/hive/tmp</value> <description>Location of Hive run time structured log file</description> </property> <property> <name>hive.server2.logging.operation.log.location</name> <value>/usr/local/hive/tmp/operation_logs</value> <description>Top level directory where operation logs are stored if logging functionality is enabled</description> </property>
第五步:使用schematool 初始化metastore的schema
schematool -dbType postgres -initSchema
第六步:启动hive
# hive
来源:PY学习网:原文地址:https://www.py.cn/article.html