1 mariaDB安装
[ root@localhost
~]# rpm -qa | grep mariadb
[ root@localhost
~]# yum remove mysql mysql-server mysql-libs compat-mysql51 --删除自带的madiaDb
[ root@localhost
local]# tar -zxvf mariadb-10.1.14-linux-x86_64.tar.gz
[ root@localhost
local]# groupadd mysql
[ root@localhost
local]# useradd -g mysql mysql
[ root@localhost
local]# chown mysql:mysql -Rf /usr/local/mariadb-10.1.14-linux-x86_64
[ root@localhost
local]# chmod +x -Rf /usr/local/mariadb-10.1.12-linux-x86_64
[ root@localhost
local]# cp /usr/local/mariadb-10.1.14-linux-x86_64/support-files/my-medium.cnf /etc/my.cnf
[ root@localhost
local]# vi /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /usr/local/mysql.sock
[mysqld]
user=mysql
port = 3306
socket = /usr/local/mysql.sock
basedir =/usr/local/mariadb-10.1.14-linux-x86_64/
datadir =/usr/local/mariadb-10.1.14-linux-x86_64/
pid-file =/usr/local/mariadb-10.1.14-linux-x86_64/mysql.pid
log-error =/usr/local/mariadb-10.1.14-linux-x86_64/err.log
[ root@localhost
local]#
/usr/local/mariadb-10.1.14-linux-x86_64/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb-10.1.14-linux-x86_64/ --datadir=/usr/local/mariadb-10.1.14-linux-x86_64/& --
初始化数据库
[ root@localhost
support-files]# cp /usr/local/mariadb-10.1.14-linux-x86_64/support-files/mysql.server /etc/init.d/mysql
[ root@localhost
support-files]# vi /etc/init.d/mysql
basedir=/usr/local/mariadb-10.1.14-linux-x86_64
datadir=/usr/local/mariadb-10.1.14-linux-x86_64
mysqld_pid_file_path=/usr/local/mariadb-10.1.14-linux-x86_64/mysql.pid
[ root@localhost
support-files]# chkconfig mysql on
[ root@localhost
support-files]# service mysql start
[ root@localhost
bin]# ./mysqladmin -u root password root --设置root的密码
[ root@localhost
bin]# mysql -uroot -p
MariaDB [(none)]> create database hive;
2 hive的安装
[ root@localhost
local]# tar -zxvf apache-hive-2.1.0-bin.tar.gz
将
mysql-connector-java-x.x.x.jar复制到hive的lib目录下
[ root@localhost
local]# mkdir /usr/local/hive
[ root@localhost
conf]# cd /usr/local/apache-hive-2.1.0-bin/conf/
[ root@localhost
conf]# cp hive-env.sh.template hive-env.sh
[ root@localhost
conf]# vi hive-env.sh
HADOOP_HOME=/usr/local/hadoop-2.7.1/
[ root@localhost
conf]# cp hive-default.xml.template hive-site.xml
[ root@localhost
conf]# vi hive-site.xml
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
Driver class name for a JDBC metastore
javax.jdo.option.ConnectionUserName
root
Username to use against metastore database
javax.jdo.option.ConnectionPassword
root
password to use against metastore database
hive.exec.local.scratchdir
/usr/local/hive
Local scratch space for Hive jobs
hive.downloaded.resources.dir
/usr/local/hive
Temporary local directory for added resources in the remote file system.
[ root@localhost
conf]# cp hive-log4j2.properties.template hive-log4j2.properties
[ root@localhost
apache-hive-2.1.0-bin]# cd /usr/local/apache-hive-2.1.0-bin/bin/
[ root@localhost
bin]# vi hive-config.sh
export JAVA_HOME=/usr/local/jdk1.7.0_79/
export HIVE_HOME=/usr/local/apache-hive-2.1.0-bin/
export HADOOP_HOME=/usr/local/hadoop-2.7.1/
[ root@localhost
conf]# vi /etc/profile
HIVE_HOME=/usr/local/apache-hive-2.1.0-bin/
PATH=:$PATH
VE_HOME=/usr/local/apache-hive-2.1.0-bin/
export HIVE_HOME
[ root@localhost
conf]# source /etc/profile
[ root@localhost
bin]# ./schematool -initSchema -dbType mysql
启动hive
[ root@localhost
conf]# hive