Construcción de grandes grupos de datos - "colmena" - novato Xiaohui
- Crear descompresión de carga
- Después de instalar mysql, debe crear una colmena de conjuntos de datos en mysql
- vi / etc / profile
vi /etc/profile
//添加
export HIVE_HOME=/opt/hive/apache-hive-2.3.3-bin
export PATH=$PATH:$HIVE_HOME/bin
//刷新环境变量
source /etc/profile
4. Pruebe las variables de entorno: hive --version
5. Cree y edite la configuración hive-site.xml
cd /opt/hive/apache-hive-2.3.3-bin/conf/
vi 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.80.128:3306/hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>HBQ521521cf*</value>
</property>
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
</configuration>
- Coloque el paquete jar de mysql en el directorio hive / lib
- Inicie colmena (inicie zookeeper y hadoop primero)
cd /opt/hive/apache-hive-2.3.3-bin/bin
//初始化
./schematool -initSchema -dbType mysql
./hive
- Adjuntar:
- Crea una tabla:
create table t1(id int,name String,age int ) row format delimited fields terminated by ',';
- Crea una tabla de particiones:
create table t3(id int,name String,age int) partitioned by(stuid int ) row format delimited fields terminated by ',';