Please be sure to indicate the original address for reprinting: http://dongkelun.com/2018/03/24/hiveConf/
Because it is only learning on its own virtual machine, hive is only the simplest configuration, and other complex configuration files are not configured.
Hadoop stand-alone mode installation see: [centos7 hadoop stand-alone mode installation configuration] (http://dongkelun.com/2018/03/23/hadoopConf/)
Please refer to the MySQL database installation process: Centos 7.2 Install Mysql 5.7.13
Download address: http://mirror.bit.edu.cn/apache/hive/, I downloaded apache-hive-2.3.2-bin.tar.gz.
wget http://mirror.bit.edu.cn/apache/hive/hive-2.3.2/apache-hive-2.3.2-bin.tar.gz
Or download to the local, upload to the virtual machine through the tool
tar -zxvf apache-hive-2.3.2-bin.tar.gz -C /opt/
<!- - more -->
vim /etc/profile
export HIVE_HOME=/opt/apache-hive-2.3.2-bin
export PATH=$PATH:$HIVE_HOME/bin
source /etc/profile
Among them, ConnectionUserName and ConnectionPassword are the username and password of mysql remote access, and hive_metadata is the mysql database, which is named as you like.
cd /opt/apache-hive-2.3.2-bin/conf/
vim hive-site.xml
<? xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration><property><name>javax.jdo.option.ConnectionURL</name><value>jdbc:mysql://192.168.44.128:3306/hive_metadata?&createDatabaseIfNotExist=true&characterEncoding=UTF-8&useSSL=false</value></property><property><name>javax.jdo.option.ConnectionUserName</name><value>root</value></property><property><name>javax.jdo.option.ConnectionPassword</name><value>Root-123456</value></property><property><name>javax.jdo.option.ConnectionDriverName</name><value>com.mysql.jdbc.Driver</value></property><property><name>datanucleus.schema.autoCreateAll</name><value>true</value></property><property><name>hive.metastore.schema.verification</name><value>false</value></property></configuration>
cp hive-env.sh.template hive-env.sh
vim hive-env.sh
HADOOP_HOME=/opt/hadoop-2.7.5export HIVE_CONF_DIR=/opt/apache-hive-2.3.2-bin/conf
The specific location is as follows:
Download link: http://dev.mysql.com/downloads/connector/j/
What I downloaded is: mysql-connector-java-5.1.46.tar.gz, unzip and put the mysql-connector-java-5.1.46-bin.jar in hive/lib
The specific path is: /opt/apache-hive-2.3.2-bin/lib
schematool -initSchema -dbType mysql
Start hadoop before starting hive, otherwise it will report Connection refused exception, check whether hadoop started successfully on the command line jps and then start hive
hive
Then simple test:
show databases;
If the following figure appears, it means the configuration is successful!
Build a table:
CREATE TABLE IF NOT EXISTS test(id INT,name STRING)ROW FORMAT DELIMITED FIELDS TERMINATED BY " " LINES TERMINATED BY "\n";
Insert data
insert into test values(1,'Zhang San');
Inquire
select *from test;
Recommended Posts