1、配置文件修改hive-env.sh
复制hive-env.sh文件conf文件夹下:cp hive-env.sh.template hive-env.sh
配置HADOOP_HOME和HIVE_CONF_DIR
2、配置HIVE_HOME
vim /etc/profile
source /etc/profile
3、启动hive
启动命令(使用derby做元数据存储):hive
4、hive的一些操作(derby做元数据存储)
使用derby做元数据存储
5、hive操作,(mysql做元数据存储)
必须要有mysql环境,
master上为hive创建MySQL账户,赋予足够权限
create user 'hive' identified by 'root';
GRANT ALL PRIVILEGES ON *.* TO hive@'%' IDENTIFIED BY 'root' with grant option;
GRANT ALL PRIVILEGES ON *.* TO hive@'localhost' IDENTIFIED BY 'root' with grant option; flush privileges;
配置hive-site.xml 文件
复制hive-default.xml.template的开头作为hive-site.xml的头
配置hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive_local?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>
</property>
6、验证
启动hive:hive
创建数据库
create datbase test;
验证