Hive deployment
What is Hive?
Hive is a translator that translates SQL statements into a MapReduce program.
Common data analysis engines: Hive, Pig, Impala, Spark SQL
Hive is a data analysis engine (data warehouse) based on Hadoop.
Hives HDFS
Table-> catalog
Data-> file
Partition-> directory
Environment deployment:
Prepare before deployment:
Environment variable: vi ~ / .bash_profile
HIVE_HOME=/root/training/apache-hive-2.3.0-bin
Export HIVE_HOME
PATH=$HIVE_HOME/bin:$PATH
Export PATH
Embedded deployment:
(1) use the Derby database that comes with Hive to store meta information
(2) Hive only supports one connection
Create conf/hive-site.xml
Javax.jdo.option.ConnectionURL
Jdbc:derby:;databaseName=metastore_db;create=true
Javax.jdo.option.ConnectionDriverName
Org.apache.derby.jdbc.EmbeddedDriver
Hive.metastore.local
True
Hive.metastore.warehouse.dir
File:///root/training/apache-hive-2.3.0-bin/warehouse
Initialize MetaStore:
Schematool-dbType derby-initSchema
Remote mode (requires MySQL database):
1. Install the MySQL database (omitted here)
two。 Configure hive-site.xml (parameters for JDBC)
Javax.jdo.option.ConnectionURL
Jdbc:mysql://localhost:3306/hive?useSSL=false
Javax.jdo.option.ConnectionDriverName
Com.mysql.jdbc.Driver
Javax.jdo.option.ConnectionUserName
Hiveowner
Javax.jdo.option.ConnectionPassword
Welcome_1
3. Put the driver of MySQL database under: Hive/lib
4. Initialize the MySQL database
Older versions of hive automatically initialize the MySQL database the first time it is run
The new version of hive requires the execution of commands:
Schematool-dbType mysql-initSchema