Install mysql
rpm -qa | grep mysql //查看是否存在mysql rmp -e --nodeps mysql-libs-5.1.73-7.e16.x84_64 //卸载已有的的mysql cd /opt/software/mysql-libs/ //进入mysql-libs文件夹,其中有三个文件client、connector、server //1.安装mysql服务端 rpm -ivh MySQL-server-5.6.24-1.e16.x86_64.rpm //安装mysql服务端 cat /root/.mysql_secret //查看产生的随机密码:PassW0rd service mysql status //查看mysql状态 service mysql start //启动mysql //2.安装mysql客户端 rmp -ivh MySQL-client-5.6.24-1.e16.x86_64.rmp //安装mysql客户端 mysql -u root -p PassW0rd //链接mysql SET PASSWORD=PASSWORD('000000') //修改密码 exit //退出mysql //3.mysql中user表中主机配置,首先进入mysql select user,host,password from user //查询user表 update user set host='%' where host='localhost' //将user表中的host内容修改为% delete from user where host='hadoop102' //删除root用户的其他host flush privileges //刷新 quit //退出 //4.hive元数据配置到mysql tar -zxvf mysql-connector-java=5.1.27.tar.gz //解压驱动 rm -rf mysql-connector-java-5.1.27.tar.gz //删除tar包 cd mysql-connector-java=5.1.27 //进入驱动所在目录 cp ./mysql-connector-java-5.1.27-bin.jar opt/module/hive/lib/ //将当前路径下的mysql包传入到hive中 //5.修改hive的配置信息 cd /opt/module/hive/conf //进入hive的配置,修改信息 touch hive-site.xml //创建配置文件 chown qx:qx hive-site.xml //将hive-site文件的权限进行修改,根据官方文档添加内容,修改文件 //6.HiveJDBC访问 bin/hiveserver2 //进入hive的bin目录下启动hiveserver2服务 bin/beeline //启动beeline !connect jdbc:hive2://hadoop102:10000 //进入beeline目录执行此条语句后,输入用户名和密码,连接jdbc
hive commonly used commands
//1.常用交互命令 bin/hive -e "select id from student;" //不进入hive的交互窗口执行sql语句 bin/hive -f ./hive.hql //执行脚本文件中hql语句 bin/hive -f ./hive.hql > /opt/module/datas/hive_result.txt //执行文件中SQL语句并将结构写入文件中 //hive其他操作命令 dfs -ls / //在hive cli窗口中如何查看hdfs文件系统 ! ls /opt/module/datas //在hive cli命令窗口中查看本地文件系统 cat .hivehistory //进入到当前用户的根目录/root查看.hivehistory文件
hive common attribute configuration
- Data Warehouse Configuration position hive
- Under / user / hive / warehouse path: default location is the most primitive data warehouse on the hdfs
- In the warehouse catalog, not create a folder on the default database default. If a default database tables belong to, create a folder directly in the data warehouse catalog
- Data Warehouse modify default home position (the hive-default.xml.template follows copied to the hive-site.xml file)
<property> <name>hive.metastore.warehouse.dir<name> <value>/user/hive/warehouse</value> <description> location of default database for the warehouse </description> </property>
Configuring the same group of users have the right to perform
bin/hdfs dfs -chmod g+w /user/hive/warehouse
- After the query configuration information display
- Add the following information in hive-site.xml configuration file, the configuration can realize the display current database header information, and a lookup table
<property> <name>hive.cli.print.header</name> <value>true</value> </property> <property> <name>hive.cli.print.current.db</name> <value>true</value> </property>
- hive and logs Configuration
- The default log stored in the hive /tmp/qx/hive.log (current user name)
- Modify hive of log storage logs to / opt / module / hive / logs
mv hive-log4j.properties.template hive-log4j.properties //进入conf目录下,修改hive-log4j.properties.template文件名称为hive-log4j.properties hive.log.dir=/opt/module/hive/logs //在hive-log4j文件中修改kog存放位置
- hive configuration parameters
- Enter the set after set // into the hive: View all current configuration information
- Configuration parameters of three ways
//1.配置文件方式 默认配置文件:hive-default.xml 用户自定义配置文件:hive-site.xml 注意:用户自定义配置会覆盖默认配置 //命令行参数方式 启动hive时,可以在命令行添加-hiveconf param=value来设定参数 set mapred.reduce.tasks //进入hive中,查看设置 bin/hive -hiveconf mapred.reduce.task=10 //设置方法一 set mapred.reduce.tasks=11 //设置方法二
hive installation, configuration and properties common commands
Guess you like
Origin blog.csdn.net/qq_38358499/article/details/105343981
Recommended
Ranking