做网站推广的公司,什么网站可以做兼职赚钱吗,网站关键词长尾词,沭阳做网站的公司8.3 Hive的安装和配置
安装模式#xff1a;
嵌入模式 #xff1a;不需要使用MySQL#xff0c;需要Hive自带的一个关系型数据库#xff1a;Derby本地模式、远程模式 ---- 需要MySQL数据库的支持
安装 hive 安装包
1、解压tar -zxvf apache-hive-2.3.0-bin.tar.gz -C…8.3 Hive的安装和配置
安装模式
嵌入模式 不需要使用MySQL需要Hive自带的一个关系型数据库Derby本地模式、远程模式 ---- 需要MySQL数据库的支持
安装 hive 安装包
1、解压tar -zxvf apache-hive-2.3.0-bin.tar.gz -C ~/training/
2、设置环境变量vi ~/.bash_profileHIVE_HOME/root/training/apache-hive-2.3.0-binexport HIVE_HOMEPATH$HIVE_HOME/bin:$PATHexport PATHsource ~/.bash_profile核心的配置文件 conf/hive-site.xml
8.3.1 嵌入模式
在嵌入模式下在哪个目录下执行的数据库初始化就应该在哪个目录下执行: hive
使用Hive自带的Derby数据库来存储元信息Hive只支持一个连接创建 conf/hive-site.xml用于开发和测试不能用于生产环境
参数文件配置参数参考值hive-site.xmljavax.jdo.option.ConnectionURLjdbc:derby:;databaseNamemetastore_db;createtruejavax.jdo.option.ConnectionDriverNameorg.apache.derby.jdbc.EmbeddedDriverhive.metastore.localtruehive.metastore.warehouse.dirfile:///root/training/apache-hive-2.3.0-bin/warehouse
conf/hive-site.xml
?xml version1.0 encodingUTF-8 standaloneno?
?xml-stylesheet typetext/xsl hrefconfiguration.xsl?
configuration propertynamejavax.jdo.option.ConnectionURL/namevaluejdbc:derby:;databaseNamemetastore_db;createtrue/value/property propertynamejavax.jdo.option.ConnectionDriverName/namevalueorg.apache.derby.jdbc.EmbeddedDriver/value/property propertynamehive.metastore.local/namevaluetrue/value/property propertynamehive.metastore.warehouse.dir/namevaluefile:///root/training/apache-hive-2.3.0-bin/warehouse/value/property
/configuration 初始化MetaStore schematool -dbType derby -initSchema 通过find -name 文件名可以查看文件所在的位置
启动hive 日志 Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases. hive 测试创建学生表 创建的学生表在 conf/hive-site.xml 配置文件的设置的路径下 8.3.2 安装配置MySQL数据库 在虚拟机上安装MySQL yum remove mysql-libs rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm rpm -ivh mysql-community-devel-5.7.19-1.el7.x86_64.rpm 可选 启动MySQLservice mysqld start 或者systemctl start mysqld.service 修改MySQL密码 查看root用户的密码cat /var/log/mysqld.log | grep password 登录后修改密码alter user ‘root’‘localhost’ identified by ‘Welcome_1’; MySQL数据库的配置 创建一个新的数据库create database hive; 创建一个新的用户create user ‘hiveowner’‘%’ identified by ‘Welcome_1’; 给该用户授权 grant all on hive.* TO ‘hiveowner’‘%’; grant all on hive.* TO ‘hiveowner’‘localhost’ identified by ‘Welcome_1’; 8.3.3 远程模式
远程模式MySQL
配置MySQL的数据库:http://www.mysqlfront.de/配置hive-site.xml JDBC的参数把MySQL数据库的驱动放到: Hive/lib下初始化MySQL数据库 老版本的Hive第一次运行Hive新版本的hiveschematool -dbType mysql -initSchema
参数文件配置参数参考值hive-site.xmljavax.jdo.option.ConnectionURLjdbc:mysql://localhost:3306/hive?useSSLfalsejavax.jdo.option.ConnectionDriverNamecom.mysql.jdbc.Driverjavax.jdo.option.ConnectionUserNamehiveownerjavax.jdo.option.ConnectionPasswordWelcome_1
?xml version1.0 encodingUTF-8 standaloneno?
?xml-stylesheet typetext/xsl hrefconfiguration.xsl?
configuration propertynamejavax.jdo.option.ConnectionURL/namevaluejdbc:mysql://localhost:3306/hive?useSSLfalse/value/property propertynamejavax.jdo.option.ConnectionDriverName/namevaluecom.mysql.jdbc.Driver/value/property propertynamejavax.jdo.option.ConnectionUserName/namevaluehiveowner/value/property propertynamejavax.jdo.option.ConnectionPassword/namevalueWelcome_1/value/property /configuration初始化MetaStore schematool -dbType derby -initSchema 网页端查看hive表
启动hive然后创建测试学生表同嵌入模式一样然后通过网页的方式进行查询 需要停止Hadoop环境修改hdfs-site.xml打开禁用HDFS的权限检查的功能然后重新启动