Hadoop環(huán)境配置之hive環(huán)境配置詳解
1、將下載的hive壓縮包拉到/opt/software/文件夾下
安裝包版本:apache-hive-3.1.2-bin.tar.gz
2、將安裝包解壓到/opt/module/文件夾中,命令:
cd /opt/software/ tar -zxvf 壓縮包名 -C /opt/module/
3、修改系統(tǒng)環(huán)境變量,命令:
vi /etc/profile
?在編輯面板中添加如下代碼:
export HIVE_HOME=/opt/module/apache-hive-3.1.2-bin export PATH=$PATH:$HADOOP_HOME/sbin:$HIVE_HOME/bin
4、重啟環(huán)境配置,命令:
source /etc/profile
5、修改hive環(huán)境變量
cd /opt/module/apache-hive-3.1.2-bin/bin/
①配置hive-config.sh文件
vi hive-config.sh
在編輯面板中添加如下代碼:
export JAVA_HOME=/opt/module/jdk1.8.0_212 export HIVE_HOME=/opt/module/apache-hive-3.1.2-bin export HADOOP_HOME=/opt/module/hadoop-3.2.0 export HIVE_CONF_DIR=/opt/module/apache-hive-3.1.2-bin/conf
6、拷貝hive配置文件,命令:
cd /opt/module/apache-hive-3.1.2-bin/conf/ cp hive-default.xml.template hive-site.xml
7、修改hive配置文件,找到對應(yīng)位置按一下代碼進(jìn)行修改:
vi hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.cj.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>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://192.168.1.100:3306/hive?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT</value> <description> JDBC connect string for a JDBC metastore. To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL. For example, jdbc:postgresql://myhost/db?ssl=true for postgres database. </description> </property> <property> <name>datanucleus.schema.autoCreateAll</name> <value>true</value> <description>Auto creates necessary schema on a startup if one doesn't exist. Set this to false, after creating it once.To enable auto create also set hive.metastore.schema.verification=false. Auto creation is not recommended for production use cases, run schematool command instead.</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>/opt/module/apache-hive-3.1.2-bin/tmp/${user.name}</value> <description>Local scratch space for Hive jobs</description> </property> <property> <name>system:java.io.tmpdir</name> <value>/opt/module/apache-hive-3.1.2-bin/iotmp</value> <description/> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/opt/module/apache-hive-3.1.2-bin/tmp/${hive.session.id}_resources</value> <description>Temporary local directory for added resources in the remote file system.</description> </property> <property> <name>hive.querylog.location</name> <value>/opt/module/apache-hive-3.1.2-bin/tmp/${system:user.name}</value> <description>Location of Hive run time structured log file</description> </property> <property> <name>hive.server2.logging.operation.log.location</name> <value>/opt/module/apache-hive-3.1.2-bin/tmp/${system:user.name}/operation_logs</value> <description>Top level directory where operation logs are stored if logging functionality is enabled</description> </property> <property> <name>hive.metastore.db.type</name> <value>mysql</value> <description> Expects one of [derby, oracle, mysql, mssql, postgres]. Type of database used by the metastore. Information schema & JDBCStorageHandler depend on it. </description> </property> <property> <name>hive.cli.print.current.db</name> <value>true</value> <description>Whether to include the current database in the Hive prompt.</description> </property> <property> <name>hive.cli.print.header</name> <value>true</value> <description>Whether to print the names of the columns in query output.</description> </property> <property> <name>hive.metastore.warehouse.dir</name> <value>/opt/hive/warehouse</value> <description>location of default database for the warehouse</description> </property> </configuration>
8、上傳mysql驅(qū)動包到/opt/module/apache-hive-3.1.2-bin/lib/文件夾下
驅(qū)動包:mysql-connector-java-8.0.15.zip,解壓后從里面獲取jar包
9、進(jìn)入數(shù)據(jù)庫,在數(shù)據(jù)庫中新建名為hive的數(shù)據(jù)庫,確保 mysql數(shù)據(jù)庫中有名稱為hive的數(shù)據(jù)庫
mysql> create database hive;
10、初始化元數(shù)據(jù)庫,命令:
schematool -dbType mysql -initSchema
11、群起,命令:
start-all.sh Hadoop100上 start-yarn.sh Hadoop101上
12、啟動hive,命令:
hive
13、檢測是否啟動成功,命令:
show databases;
出現(xiàn)各類數(shù)據(jù)庫,則啟動成功
到此這篇關(guān)于Hadoop環(huán)境配置之hive環(huán)境配置的文章就介紹到這了,更多相關(guān)Hadoop?hive環(huán)境配置內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
使用springMVC通過Filter實現(xiàn)防止xss注入
這篇文章主要介紹了使用springMVC通過Filter實現(xiàn)防止xss注入的操作,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-07-07Java Lambda表達(dá)式原理及多線程實現(xiàn)
這篇文章主要介紹了Java Lambda表達(dá)式原理及多線程實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-07-07Java使用MulticastSocket實現(xiàn)群聊應(yīng)用程序
這篇文章主要為大家詳細(xì)介紹了Java使用MulticastSocket實現(xiàn)群聊應(yīng)用程序,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-05-05SpringBoot SSE服務(wù)端主動推送事件的實現(xiàn)
本文主要介紹了SpringBoot SSE服務(wù)端主動推送事件的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06IntelliJ?idea報junit?no?tasks?available問題的解決辦法
這篇文章主要給大家介紹了關(guān)于IntelliJ?idea報junit?no?tasks?available問題的解決辦法,文中通過圖文介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-11-11Java?詳解Collection集合之ArrayList和HashSet
本章具體介紹了ArrayList和HashSet兩種集合的基本使用方法和區(qū)別,圖解穿插代碼實現(xiàn)。?JAVA成仙路從基礎(chǔ)開始講,后續(xù)會講到JAVA高級,中間會穿插面試題和項目實戰(zhàn),希望能給大家?guī)韼椭?/div> 2022-03-03Spring獲取當(dāng)前類在容器中的beanname實現(xiàn)思路
這篇文章主要介紹了Spring獲取當(dāng)前類在容器中的beanname,實現(xiàn)思路只需繼承BeanNameAware接口,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-07-07最新評論