Hive installation (based MariaDB)
Download and install MariaDB
Download as https://mariadb.com/downloads/ , decompress After downloading the archive, the following list
Use rpm -ivh MariaDB-gssapi-server- 10.4.7-1.el7.centos.x86_64.rpm --nodeps --force install server
used rpm -ivh MariaDB-client-10.4.7-1.el7.centos .x86_64.rpm --nodeps --force install client
Start mariadb, start a command service mysql start
Start the client, there is no default user name and password, use mysqladmin -u root -p password ex carriage return after setting a user name and password, enter the command, then enter the password
MariaDB arranged as a metadata repository hive
Landing mysql, will host the next table instead of mysql.user wildcard ip
update mysql.user set host='%' where host='localhost';
flush privileges;
Use maven download mysql connector
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.46</version> </dependency>
The mysql-connector-java-5.1.46.jar lib directory into the hive installation path
Change the hive-site.xml configuration
<property> <name>javax.jdo.option.ConnectionURL</name> <!--jdbc:derby:;databaseName=metastore_db;create=true--> <value>jdbc:mysql://master:3306/metastore?createDatabaseIfNotExist=true</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>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>123456</value> <description>password to use against metastore database</description> </property>
Hive initialize metadata database using ./schematool -dbType mysql -initSchema designated a hive mariadb as metadata repository
Log mariadb verify, enter show databases; find command already exists Metabase "metastore", and this library already exists a metadata table.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| metastore |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.001 sec)
Error Handling
wrong reason
solution
This error may be caused by two reasons, connections and user rights issues, resolve as follows (1): The auth_socket connection instead mysql_native_password. Mysql restart the service, the following command
update mysql.user set authentication_string=PASSWORD('123456'), plugin='mysql_native_password' where user='root';
flush privileges;
service mysql restart
(2): mysql root user authority, you can change the root privileges
mysql> grant all privileges on *.* to root@'localhost' identified by '密码';
mysql> flush privileges;
Reference article
- CentOS 7 Why give up MySQL, and change the use of MariaDB?
- mariaDB download official website
- Set the root password initial operation after installation mariaDB
- Ubuntu mysql: MySQL ERROR 1698 (28000) error
- Solve Access denied for user 'root' @ 'localhost' problem
- Big Data Learning Series Four ----- Hadoop + Hive environment to build Detailed graphics (stand-alone)
- _08_Hive Big Data technologies of learning _01_Hive entry + Hive install, configure and use + Hive Data Types