QQ Exchange Group: 335671559, Welcome to Exchange
First, what is hive metadata. Hive metadata is some of the basic elements of hive, including the basic properties of hive tables, as follows (1) The database name, table name, field name and type of Hive table, partition field and type (2) table partition, attribute location of partition, etc. (3) Serdeproperties, tblproperties, etc. you can view the table's properties by DESC formatted tablename. Hive Default Metabase Derby (embedded mode) Hive-default.xml is configured with the following configuration settings
<name>Javax.jdo.option.ConnectionURL</name><value>Jdbc:derby:;d atabasename=metastore_db;create=true</value><Description>JDBC connect string for a JDBC Metastore</Description></ Property>< Property><name>Javax.jdo.option.ConnectionDriverName</name><value>Org.apache.derby.jdbc.EmbeddedDriver</value><Description>Driver class name for a JDBC metastore</Description></ Property>Apache Derby is very small and the core part of Derby.jar is only 2 m, so it can be used as a separate database server or embedded in the application. So Hive uses Derby as an inline metabase to complete a simple test of hive installation. After the hive installation is complete, you can perform some basic operations in the hive shell, creating tables, queries, and so on. If you're careful, you'll find a problem: When you start a terminal in a directory and go into the hive shell, hive defaults to generating a derby file and a metastore_db directory in the current directory, which basically holds some of the two files that have just been manipulated in the shell. The results of QL, such as new tables, added partitions, and so on, are a disadvantage of this storage method. 1. Only one hive client can use database 2 in the same directory. Switch directory to start a new shell, unable to view the previously created table, cannot realize the sharing of table data three, using MySQL as a metabase due to the use of the default metabase some drawbacks, so using the MySQL save hive metadata to solve the problem above. All of the metadata for hive is stored in the same library so that tables created by different developers can be shared.
MySQL configuration is divided into several situations: (1) MySQL is deployed on the hive server, using local services (test, learn to use)
(2) MySQL is deployed on other machines, the hive server opens the metadata service and operates hive on the hive server
(3) MySQL is deployed on other machines, the hive server opens the metadata service, and the hive client accesses hive's metadata service
Configure MySQL: When you configure MySQL, first copy the Mysql-jdbc-driver.jar to the $HIVE _home/lib directory, modify the Hive-default.xml name to Hive-site.xml first case, HIVE The-site.xml is configured as follows< Property><name>Hive.metastore.local</name><value>True</value></ Property> < Property><name>Javax.jdo.option.ConnectionURL</name><value>Jdbc:mysql://localhost/hive?createdatabaseifnotexist=true</value></ Property>< Property><name>Javax.jdo.option.ConnectionDriverName</name><value>Com.mysql.jdbc.Driver</value></ Property>< Property><name>Javax.jdo.option.ConnectionUserName</name><value>Hive</value></ Property>< Property><name>Javax.jdo.option.ConnectionPassword</name><value>Password</value></ Property>
In the second case, the Hive-site.xml configuration< Property><name>Javax.jdo.option.ConnectionURL</name> <value>Jdbc:mysql://192.168.0.1:3306/hive?createdatabaseifnotexist=true</value></ Property>< Property><name