Hive metadata arranged to MySql

Drive copy

1. Extracting mysql-connector-java-5.1.27.tar.gz driver package in / opt / software / mysql-libs directory

[root@hadoop102 mysql-libs]# tar -zxvf mysql-connector-java-5.1.27.tar.gz

2. Copy mysql-connector-java-5.1.27-bin.jar /opt/software/mysql-libs/mysql-connector-java-5.1.27 directory under the / opt / module / hive / lib /

[root@hadoop102 mysql-connector-java-5.1.27]# cp mysql-connector-java-5.1.27-bin.jar
 /opt/module/hive/lib/

2 configured to MySql Metastore

1. Create a hive-site.xml in / opt / module / hive / conf directory

[FLY@hadoop102 conf]$ touch hive-site.xml
[FLY@hadoop102 conf]$ vi hive-site.xml

2 configured to MySql Metastore

1. Create a hive-site.xml in / opt / module / hive / conf directory

[FLY@hadoop102 conf]$ touch hive-site.xml
[FLY@hadoop102 conf]$ vi hive-site.xml

2. According to the official document configuration parameters, copy the data to the hive-site.xml file

https://cwiki.apache.org/confluence/display/Hive/AdminManual+MetastoreAdmin

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
      <name>javax.jdo.option.ConnectionURL</name>
      <value>jdbc:mysql://hadoop102:3306/metastore?createDatabaseIfNotExist=true</value>
      <description>JDBC connect string for a JDBC metastore</description>
    </property>

    <property>
      <name>javax.jdo.option.ConnectionDriverName</name>
      <value>com.mysql.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>000000</value>
      <description>password to use against metastore database</description>
    </property>
</configuration>

3. Once configured, if you start hive exceptions, you can restart the virtual machine. (After restarting, do not forget to start hadoop cluster)

More than three windows start testing Hive

1. First start MySQL

[FLY@hadoop102 mysql-libs]$ mysql -uroot -p000000

Access to several databases

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql             |
| performance_schema |
| test               |
+--------------------+

2. Again open multiple windows, each hive start

[FLY@hadoop102 hive]$ bin/hive

3. After starting the hive, back window to view the MySQL database, the database shows an increase of metastore

    mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| metastore          |
| mysql             |
| performance_schema |
| test               |
+--------------------+

 

Guess you like

Origin www.cnblogs.com/tesla-turing/p/11668610.html