Installing MariaDB
Hive stores metadata in the database. Before installing Hive, you need to install the database software and configure database information in hive-site.xml. Common databases include Derby, MySQL, and MariaDB. This document uses MariaDB as an example. The deployment of other databases is similar.
- Install MariaDB on server 1.
- Install MariaDB.
Before installing MariaDB, ensure that the Yum source has been configured.
1yum -y install mariadb*
- Start the MariaDB service.
1systemctl start mariadb.service
- Optional: Configuring autostart upon power-on.
1systemctl enable mariadb.service
- Install MariaDB.
- Configure the permissions and password.
- Log in to the database and press Enter twice. No password is required for the first login.
1mysql -uroot -p
- Access the MySQL database.
1use mysql;
- Grant all permissions to the root user and set a password for the root user.
1grant all on *.* to root@'server1' identified by 'xxxxxxxx';
- server1 indicates the name of the host where MySQL is installed.
- Replace the example password xxxxxxxx with your desired one.
- Update the permissions.
1flush privileges;
- Exit the database.
1quit;
- Log in to the database and press Enter twice. No password is required for the first login.
- Set the UTF-8 character encoding.
- Open the mariadb-server.cnf configuration file.
1vi /etc/my.cnf.d/mariadb-server.cnf - Press i to enter the insert mode and add the following content to the [mysqld] label:
1 2 3 4 5
init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the mysql-clients.cnf file.
1vi /etc/my.cnf.d/mysql-clients.cnf - Press i to enter the insert mode and add the following content (if the [client] section exists, simply append the parameter):
1 2
[client] default-character-set=utf8
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the mysql-clients.cnf file.
1vi /etc/my.cnf.d/mysql-clients.cnf - Press i to enter the insert mode and add the following content to the [mysql] label:
1default-character-set=utf8
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Restart MariaDB.
1systemctl restart mariadb.service
- Open the mariadb-server.cnf configuration file.
Parent topic: Deploying Hive